Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zh_hans locale not working #2051

Closed
ph0ngp opened this issue Oct 18, 2024 · 10 comments · Fixed by #2058
Closed

zh_hans locale not working #2051

ph0ngp opened this issue Oct 18, 2024 · 10 comments · Fixed by #2058

Comments

@ph0ngp
Copy link
Contributor

ph0ngp commented Oct 18, 2024

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).

@birtles
Copy link
Member

birtles commented Oct 18, 2024

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).

@SaltfishAmi
Copy link
Contributor

SaltfishAmi commented Oct 18, 2024

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.

birtles added a commit that referenced this issue Oct 21, 2024
Both Chrome and Safari seem only to recognize zh_CN and in my testing
zh_CN works in Firefox too so let's use that.

Fixes #2051.
@birtles
Copy link
Member

birtles commented Oct 21, 2024

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 adobe/helix-sidekick-extension#721) despite the discussion here indicating Safari does handle subtags.

birtles added a commit that referenced this issue Oct 21, 2024
Chrome onlys seems to recognize zh_CN and in my testing zh_CN works in
Firefox too so let's use that.

Safari doesn't seem to handle subtags correctly so this still won't work
there. See:

- https://forums.developer.apple.com/forums/thread/762697
- adobe/helix-sidekick-extension#721

Fixes #2051 for Chrome at least.
@xeenon
Copy link

xeenon commented Oct 21, 2024

@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
Copy link
Member

birtles commented Oct 21, 2024

@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).

@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.

@xeenon
Copy link

xeenon commented Oct 22, 2024

@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.

@xeenon
Copy link

xeenon commented Oct 22, 2024

@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
Copy link
Member

birtles commented Oct 23, 2024

@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.

@xeenon
Copy link

xeenon commented Oct 24, 2024

@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
Copy link
Member

birtles commented Oct 25, 2024

@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.

Thanks! I filed Chromium issue 375528194 and updated the WECG thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants