OpenUI5 doesn't catch "i18n_he.properties", only "i18n_iw.properties" for Hebrew
See original GitHub issueOpenUI5 version: 1.77.0
Steps to reproduce the problem:
- Set in Chrome (
chrome://settings/languages
) Hebrew as a priority # 1 in “Order languages based on your preference” - In your UI5 app create
i18n_he.properties
- Load the app
What is the expected result?
UI5 will load i18n_he.properties
What happens instead?
UI5 looks for i18n_iw.properties
, can’t find it and tries to load the priority # 2.
Any other information? (attach screenshot if possible)
If I rename the i18n_he.properties
to i18n_iw.properties
everything is OK.
In Identifying the Language Code / Locale it’s written that UI5 supports:
- BCP-47
- ISO 639 alpha-2
- ISO 639 alpha-3
- ISO 3166 alpha-2
If so, then why UI5 expects iw
instead of he
for Hebrew?
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
Sapui5 Raw Applications Create Error 404 - ADocLib
OpenUI5 doesn't catch "i18nhe.properties", only "i18niw.properties" for Hebrew. <p>If I rename the <code>i18nhe.properties</code> to <.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @pubmikeb,
this was indeed a problem for years. When we started UI5, our internal translation service provided an interface for the Java platform. Therefore, our
ResourceBundle
implementation took over the specifics of that platform, including the*.properties
file format as well as the underscore in the language codes and, last but not least, the legacy ISO codes “in”, “iw”, “ji”, “no” and “sh”.I’m sure this is documented somewhere, but I can’t find it quickly (which obviously is a problem by itself).
Luckily, since 1.77, there’s a solution for this and for other problems around localization.
ResourceBundles
(or more precisely,ResourceModels
) that are declared in the manifest can now declare their set ofsupportedLocales
. If this set contains “he”, the framework knows that Hebrew should be loaded from the “messagebundle_he.properties” file, whereas when the list contains “iw”, the framework will request “messagebundle_iw.properties” when the current language is Hebrew (no matter whether it is configured as “he” or “iw”).This list of supported locales also finally helps to avoid the 404s for “en_US” etc. when those locales don’t exist in the backend. And it allows to configure the locales per bundle, which is important for bigger, componentized apps.
In 1.77, only the runtime mechanisms is present and can be used via manifest.json or via API. For future versions of the ui5-tooling, it is planned to fill the corresponding manifest entries automatically, based on the existing resources of a project.
More has been done regarding
ResourceBundles
and addtl. documentation will follow soon (hopefully).HTH + Kind Regards
To avoid extra-loading or 404s, configuring the
supportedLocales
usually is enough. ThefallbackLocale
only needs to be configured, if “en” (the default fallback locale) is not part of thesupportedLocales
or if you think that a language other than “en” fits better to look for texts that might be missing in the other text files.Within SAP, we create texts first in the file without locale (we call that the “raw” locale) and we create them as English text. Obviously, that file therefore would be a natural candidate for the
fallbackLocale
. But after translation, “en” might be more appropriate for a native speaker and therefore we introduced another fallback “en” that is checked before the “raw” file. That’s howfallbackLocale
came into life.Without any configuration, we would search the following sequence of files for a text (assuming the session language is “pt_BR”):
The search stops when a text is found.
fallbackLocale
you can pick another locale for the step before the raw localesupportedLocales
, you can limit the whole sequence to the specified set of locales.BTW: if you don’t need a
fallbackLocale
for missing text keys (because all properties files are complete or because text quality doesn’t differ between locales), then you can also configure fallbackLocale=“” and thereby skip the 3rd step above. Only makes a difference, if text files are not complete.