Skip to content

Commit

Permalink
fix(localization): fix js error if "sh" locale set (#4905)
Browse files Browse the repository at this point in the history
Support for Serbian Latin has been added in UI5, now we add support for the same in UI5 Web Components.
For Serbian, there are Cyrillic and Latin scripts - "sr" maps to Cyrillic (supported prior to the change), while "sh" and "sr_latn" map to "Latin" (now supported with the current change).

FIXES: #4904
  • Loading branch information
ilhan007 committed Mar 22, 2022
1 parent 927995c commit 9ace82c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/base/src/asset-registries/LocaleData.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const M_ISO639_OLD_TO_NEW = {
"iw": "he",
"ji": "yi",
"in": "id",
"sh": "sr",
};

const DEV_MODE = false;
Expand Down Expand Up @@ -48,6 +47,12 @@ const calcLocale = (language, region, script) => {
}
}

// Special case 3: for Serbian, there are cyrillic and latin scripts, "sh" and "sr-latn" map to "latin", "sr" maps to cyrillic.
if (language === "sh" || (language === "sr" && script === "Latn")) {
language = "sr";
region = "Latn";
}

// try language + region
let localeId = `${language}_${region}`;
if (SUPPORTED_LOCALES.includes(localeId)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/localization/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
65ggwN6ZkFOPO38ZE2UOXXibHi8=
WxDe3QUtrOjzNXLHZ65GIiIMnKU=
1 change: 1 addition & 0 deletions packages/tools/assets-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const assetsMeta = {
"sk",
"sl",
"sr",
"sr_Latn",
"sv",
"th",
"tr",
Expand Down

0 comments on commit 9ace82c

Please sign in to comment.