Skip to content

Commit

Permalink
Merge pull request wso2#4331 from DilshanSenarath/conformance-test-is…
Browse files Browse the repository at this point in the history
…sues

Update ui_locales resolving logic
  • Loading branch information
JayaShakthi97 authored Oct 26, 2023
2 parents 4e9a0c9 + 77f6e16 commit f96c11b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-foxes-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/identity-apps-core": patch
---

Update the ui_locales resolving logic
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,35 @@
if (localeFromCookie != null) {
lang = localeFromCookie;
try {
String langStr = lang.split("_")[0];
String langLocale = lang.split("_")[1];
String langStr = "en";
String langLocale = "US";
if (lang.contains("_")) {
langStr = lang.split("_")[0];
langLocale = lang.split("_")[1];
} else if (lang.contains("-")) {
langStr = lang.split("-")[0];
langLocale = lang.split("-")[1];
}
userLocale = new Locale(langStr, langLocale);
} catch (Exception e) {
// In case the language is defined but not in the correct format
userLocale = browserLocale;
}
} else if (uiLocaleFromURL != null) {
for (String localeStr : uiLocaleFromURL.split(" ")) {
String langStr = localeStr.split("_")[0];
String langLocale = localeStr.split("_")[1];
String langStr = "en";
String langLocale = "US";
if (lang.contains("_")) {
langStr = lang.split("_")[0];
langLocale = lang.split("_")[1];
} else if (lang.contains("-")) {
langStr = lang.split("-")[0];
langLocale = lang.split("-")[1];
}
Locale tempLocale = new Locale(langStr, langLocale);
// Trying to find out whether we have a resource bundle for the given locale
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,16 @@
lang = localeFromCookie;
try {
String langStr = lang.split("_")[0];
String langLocale = lang.split("_")[1];
String langStr = "en";
String langLocale = "US";
if (lang.contains("_")) {
langStr = lang.split("_")[0];
langLocale = lang.split("_")[1];
} else if (lang.contains("-")) {
langStr = lang.split("-")[0];
langLocale = lang.split("-")[1];
}
userLocale = new Locale(langStr, langLocale);
} catch (Exception e) {
Expand All @@ -59,8 +67,16 @@
}
} else if (uiLocaleFromURL != null) {
for (String localeStr : uiLocaleFromURL.split(" ")) {
String langStr = localeStr.split("_")[0];
String langLocale = localeStr.split("_")[1];
String langStr = "en";
String langLocale = "US";
if (localeStr.contains("_")) {
langStr = localeStr.split("_")[0];
langLocale = localeStr.split("_")[1];
} else if (localeStr.contains("-")) {
langStr = localeStr.split("-")[0];
langLocale = localeStr.split("-")[1];
}
Locale tempLocale = new Locale(langStr, langLocale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,35 @@
if (localeFromCookie != null) {
lang = localeFromCookie;
try {
String langStr = lang.split("_")[0];
String langLocale = lang.split("_")[1];
String langStr = "en";
String langLocale = "US";
if (lang.contains("_")) {
langStr = lang.split("_")[0];
langLocale = lang.split("_")[1];
} else if (lang.contains("-")) {
langStr = lang.split("-")[0];
langLocale = lang.split("-")[1];
}
userLocale = new Locale(langStr, langLocale);
} catch (Exception e) {
// In case the language is defined but not in the correct format
userLocale = browserLocale;
}
} else if (uiLocaleFromURL != null) {
for (String localeStr : uiLocaleFromURL.split(" ")) {
String langStr = localeStr.split("_")[0];
String langLocale = localeStr.split("_")[1];
String langStr = "en";
String langLocale = "US";
if (localeStr.contains("_")) {
langStr = localeStr.split("_")[0];
langLocale = localeStr.split("_")[1];
} else if (localeStr.contains("-")) {
langStr = localeStr.split("-")[0];
langLocale = localeStr.split("-")[1];
}
Locale tempLocale = new Locale(langStr, langLocale);
// Trying to find out whether we have a resource bundle for the given locale
try {
Expand Down

0 comments on commit f96c11b

Please sign in to comment.