mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
Fix several browser-language -> translation-file mapping gaps: - isLanguageSupported is now case-insensitive (requested) via a new TAPi18n.resolveTag() that maps any input to the canonical languages.js tag case-insensitively AND underscore<->hyphen-insensitively (so 'zh-hant'->'zh-Hant', 'JA-JP'->'ja-JP', browser 'af-ZA'->legacy key 'af_ZA'). loadLanguage/setLanguage/ensureLanguageLoaded resolve through it, so the loaded file, the i18next code and the stored current tag all agree. - Bare base codes with no plain-code file resolve via an alias map: 'zh' -> 'zh-Hans' (Chinese has only script/region files), so plain 'zh' gives Simplified, not English. - Browser detection (client/lib/i18n.js) now strips trailing subtags progressively instead of jumping to the first segment: 'zh-Hans-CN' -> 'zh-Hans', 'zh-Hant-TW' -> 'zh-Hant' (Chrome sends these), rather than -> 'zh' -> English. - languages.js: fix the 'cmn' entry whose tag was the typo 'cnm' (and code 'cn'), which mismatched supportedLngs and broke selecting Mandarin; now tag/code = 'cmn'. Adds i18n.test.js coverage for resolveTag, case-insensitive isLanguageSupported, the zh alias, the underscore/hyphen match, and each Japanese variant loading its own file.