Skip to content

declarative `language to locale` transformation rules

Pavlo Mashliakovskiy requested to merge feat/en_us into master
  • declarative language to locale: new section in ubConfig.json application.localization.irregularLangToLocaleMap can contain a language to locale transformation rules. For example, by default UB consider en language is en-GB locale, therefore formatByPattern.formatDate('2021-12-30', 'date') returns 30/12/2021 (dd/mm/yy), but if we define "irregularLangToLocaleMap": {"en": "en-US"} in config, the same function will return 12/30/2021 (mm/dd/yy) as in American locale. Prior to these changes, the developer had to use the JS function formatByPattern.setLang2LocaleHook in the model to achieve the same result
  • allLocales endpoint now combine not only /model/locale/lang-${lang}.json files, but also /model/locale/lang-${locale}.json. This allows to define a different localization for different locale, for example by adding locale/lang-en-US.json for US
  • csShared.formatByPattern will use irregularLangToLocaleMap if available on both AsyncConnection and from inside server

Merge request reports

Loading