Closed ph0ngp closed 3 weeks ago
Hi!
I just tried this with Chrome on Windows and it looks like you can't set the language to zh-hans
only zh-CN
? This page seems to confirm that.
I guess Firefox allows zh_hans
though since I believe this localization is working for @SaltfishAmi.
I'll need to test if renaming the folder to zh_CN
continues working with Firefox (and also fixes Chrome and Safari).
I never tested the localization for the previous two years, since I cannot change language for the extension only, and I do not personally use chinese interface for other parts of my computer. sorry...
It worked when I first added it many years ago.
I've made up a PR to fix this in Chrome at least and I've verified that it doesn't break Firefox. (I'm not sure if it was actually broken in Firefox to begin with because the original approach I used for testing turned out to be wrong.)
However, it won't fix Safari because it looks like Safari doesn't handle language subtags correctly: https://forums.developer.apple.com/forums/thread/762697 (see also https://github.com/adobe/helix-sidekick-extension/issues/721) despite the discussion here indicating Safari does handle subtags.
@birtles With this change, I'm seeing zh_CN
being loaded and used in Safari 18 for your extension. We look for zh_CN
, zh
, then en
(default_locale
).
@birtles With this change, I'm seeing
zh_CN
being loaded and used in Safari 18 for your extension. We look forzh_CN
,zh
, thenen
(default_locale
).
@xeenon thank you so much for checking! I tried this yesterday on Safari 18.0.1 on my Mac and it failed to show the zh_CN
locale in the settings page although Japanese worked fine. I won't be near a Mac for a few days but I'll take a screen recording next time I am.
@birtles Make sure you also change your Region to "China mainland", otherwise it will try zh_JP
or whatever region you are in currently. Japanese likely worked since it is just ja
.
@birtles I found that we can improve this, as setting the region to "China mainland" or "Taiwan" shouldn't be required. I’ve submitted a fix with new tests and error handling. Thanks for bringing this up!
@birtles I found that we can improve this, as setting the region to "China mainland" or "Taiwan" shouldn't be required. I’ve submitted a fix with new tests and error handling. Thanks for bringing this up!
@xeenon Thank you! You're amazing. That's perfect. I was confused because the Safari interface changed after updating the language (but not the region) whilst the extension interface did not. Not having the change the region would make the extension interface consistent with the Safari interface.
@birtles My fix also makes zh_hans
and zh_hant
work if used in _locales
too. You might want to open a WECG issue and / or Chrome bug report about zh_hans
not working in Chrome.
@birtles My fix also makes
zh_hans
andzh_hant
work if used in_locales
too. You might want to open a WECG issue and / or Chrome bug report aboutzh_hans
not working in Chrome.
Thanks! I filed Chromium issue 375528194 and updated the WECG thread.
When I set the system language to Simplified Chinese, I still see all the UI texts in English. I have tested on Chrome (macOS), Safari (macOS), Safari (iOS). They all have this behavior. Somehow the locale
zh_hans
is not detected. When I set the system language to Japanese, they all work normally (displaying Japanese UI text).