|
|
@@ -58,6 +58,29 @@ if (Platform.OS === "web") {
|
|
|
NCoreConfig.initialSelectedLocale = langParam as keyof NCoreUIKit.LocaleKey;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (!NCoreConfig.initialSelectedLocale) {
|
|
|
+ const browserLang = window.navigator.language || "";
|
|
|
+
|
|
|
+ const exactMatch = defaultLocaleJSON.find(item => item.locale === browserLang);
|
|
|
+
|
|
|
+ if (exactMatch) {
|
|
|
+ NCoreConfig.initialSelectedLocale = exactMatch.locale as keyof NCoreUIKit.LocaleKey;
|
|
|
+ } else {
|
|
|
+ const primaryLang = (browserLang.split(/[-_]/)[0] || "").toLowerCase();
|
|
|
+
|
|
|
+ const similarMatch = defaultLocaleJSON.find(item =>
|
|
|
+ item.locale.toLowerCase() === primaryLang ||
|
|
|
+ item.locale.toLowerCase().startsWith(`${primaryLang}-`)
|
|
|
+ );
|
|
|
+
|
|
|
+ if (similarMatch) {
|
|
|
+ NCoreConfig.initialSelectedLocale = similarMatch.locale as keyof NCoreUIKit.LocaleKey;
|
|
|
+ } else {
|
|
|
+ NCoreConfig.initialSelectedLocale = (primaryLang === "tr" ? "tr-TR" : "en-US") as keyof NCoreUIKit.LocaleKey;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const NCoreUIKitBase = setupNCoreUIKit(NCoreConfig);
|