Issues with Displaying Language Tags Compliant with RFC 5646

Hello,

I'm currently facing some issues with localization for the Safari extension on iOS:

Issues with Language Tags:

  • Folder names like pt-BR (Brazilian Portuguese) and pt-PT (European Portuguese) placed in the Resources/_locales/ directory are not displaying the respective languages correctly; instead, the default English is shown.
  • Similarly, using folder names like zh-CN (Simplified Chinese) and zh-TW (Traditional Chinese) also results in default English display instead of the intended Chinese language.
  • Conversely, when changing the folder names to pt (Portuguese general) and zh (Chinese general), the languages display correctly.

Could you please provide any recommendations or tips regarding language tag settings and how to ensure they are properly recognized according to RFC 5646?

Thanks for your help!

Best,

Answered by Frameworks Engineer in 810115022

Safari Web Extensions use zh_CN for Simplified Chinese and zh_TW for Traditional Chinese.

You will want to put the messages.json file in a zh_CN or zh_TW folder in _locales.

If you are still seeing issues, make sure the JSON file is valid, as that might be causing it to skip that locale. You also might want to check that your region is correct, China mainland or Brazil, since region is separate from the preferred languages list.

Please file feedback with a test extension if the issue persists with details on your system language settings.

Did you try something like zh_CN where zh is a language designator (ISO 639), CN is a locale ID, and _ (underscore) is the separator? See Language and Locale IDs for more information.

Also, the Resources/_locales/ directory doesn't look right to me. On Apple's platforms, the resources of a certain localization must be in a .lproj folder, and the folder is under the Resources folder. For example, <app bundle root>/Contents/Resources/zh_CN.lproj contains Simplified Chinese resources.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Thank you for your response.

I attempted to use the zh_CN and pt_BR formats with underscores as suggested. Unfortunately, these did not display correctly within the Safari extension's description section in the Preferences.

From my testing, if a directory for zh or pt exists, it is prioritized. If these directories are not present, the content from messages.json in the en directory is shown instead. This behavior aligns with the issues I previously observed, where zh and pt directories work correctly, but zh_CN and pt_BR do not. I tested this on iOS versions 18.0 (22A5350a) and 17.5 (21F79).

Could you provide any further recommendations or insights on how to resolve this issue?

Best,

It seems to me that the Safari extension localization has something special then. Would you mind to start with filing a feedback report with screenshots to show the following information, and share your report ID here? I'd see if I have more to say from there.

  • The structure of your main app and extension bundle, including all the .lproj folders.
  • The system language settings of your device.
  • The per-app language settings, if any.
  • The issue.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

I believe this affects all Safari extensions. It is affecting mine and it also appears to be affecting this extension here: https://github.com/adobe/helix-sidekick-extension/issues/721

Safari Web Extensions use zh_CN for Simplified Chinese and zh_TW for Traditional Chinese.

You will want to put the messages.json file in a zh_CN or zh_TW folder in _locales.

If you are still seeing issues, make sure the JSON file is valid, as that might be causing it to skip that locale. You also might want to check that your region is correct, China mainland or Brazil, since region is separate from the preferred languages list.

Please file feedback with a test extension if the issue persists with details on your system language settings.

Issues with Displaying Language Tags Compliant with RFC 5646
 
 
Q