violentmonkey / violentmonkey

Violentmonkey provides userscripts support for browsers. It works on browsers with WebExtensions support.

Home Page:https://violentmonkey.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] UserScripts localization for zh-* broken on Firefox Android

JasonHK opened this issue · comments

Sequence of actions:

Problem:

Firefox for Android, weirdly, uses "zh-Hant-TW" instead of "zh-TW" as the language code for Traditional Chinese (Taiwan), which breaks the function (see below) used to get localized metadata since most (if not all) of the scripts use the code "zh-TW". Same should happen on Simplified Chinese (zh-CN, zh-Hans-CN).

.map(lang => meta[`${key}:${lang}`] || meta[`${key}:${lang.toLowerCase()}`])

Expected result:

Language code should be minimized first using function like new Intl.Locale("zh-Hant-TW").minimize().baseName // -> "zh-TW".

Devtools console contents:

N/A

Environment:

  • OS: Android 14
  • Browser: Firefox Nightly for Android 124.0a1
  • Violentmonkey Version: 2.18.0