From c4d412a7d54039e3d36fcfac3a5465ffc92f4a0b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 5 Jun 2025 11:55:05 -0300 Subject: content: fix language.typicallyLowerCase intent, add heuristics --- src/data/things/language.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/data/things/language.js b/src/data/things/language.js index b0124c10..e3689643 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -867,14 +867,14 @@ export class Language extends Thing { typicallyLowerCase(string) { // Utter nonsense implementation, so this only works on strings, - // not actual HTML content, and will loudly disrespect *intentful* + // not actual HTML content, and may rudely disrespect *intentful* // capitalization of whatever goes into it. - if (typeof string === 'string') { - return string[0].toLowerCase() + string.slice(1).toLowerCase(); - } else { - return string; - } + if (typeof string !== 'string') return string; + if (string.length <= 1) return string; + if (/^\S+?[A-Z]/.test(string)) return string; + + return string[0].toLowerCase() + string.slice(1); } // Utility function to quickly provide a useful string key -- cgit 1.3.0-6-gf8a5