You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many languages have locale (country-specific) variants. In such variants only specific words/phrases differ from the general language. Currently you have to duplicate the whole language-pack and replace the region specific phrases, which makes maintenance a nuisance.
Since intl-messageformat conforms BCP 47 I'd suggest that during translation the code should check if there is a translation that matches the first part of the language string:
varsimilarLanguage=language.split("-")[0];vartranslatedValue;if(!key||!resources||!language||!(resources[language]||resources[similarLanguage]))return;// Cache the key/value pairs for the same language, so that we don't// do extra work if we're just reusing strings across an application.if(resources[language])translatedValue=resources[language][key];if(!translatedValue&&resources[similarLanguage])translatedValue=resources[similarLanguage][key];
Expected outcome
The translation of it's superset should be output.
Actual outcome
Nothing is output.
Browsers Affected
Chrome
Firefox
Safari 9
Safari 8
Safari 7
Edge
IE 11
IE 10
The text was updated successfully, but these errors were encountered:
Description
Many languages have locale (country-specific) variants. In such variants only specific words/phrases differ from the general language. Currently you have to duplicate the whole language-pack and replace the region specific phrases, which makes maintenance a nuisance.
Since intl-messageformat conforms BCP 47 I'd suggest that during translation the code should check if there is a translation that matches the first part of the
language
string:Expected outcome
The translation of it's superset should be output.
Actual outcome
Nothing is output.
Browsers Affected
The text was updated successfully, but these errors were encountered: