mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-05 17:33:49 +00:00
try the generalized version of a language code before resorting to the default language (es-US -> es)
This commit is contained in:
@@ -31,7 +31,13 @@ class Localization {
|
||||
}
|
||||
|
||||
static getSupportedOrDefault(locales) {
|
||||
return locales.find(Localization.isSupported) || Localization.defaultLocale;
|
||||
let localesGeneric = locales
|
||||
.map(locale => locale.split("-")[0])
|
||||
.filter(locale => locales.indexOf(locale) === -1);
|
||||
|
||||
return locales.find(Localization.isSupported)
|
||||
|| localesGeneric.find(Localization.isSupported)
|
||||
|| Localization.defaultLocale;
|
||||
}
|
||||
|
||||
static async setTranslation(locale) {
|
||||
|
||||
@@ -31,7 +31,13 @@ class Localization {
|
||||
}
|
||||
|
||||
static getSupportedOrDefault(locales) {
|
||||
return locales.find(Localization.isSupported) || Localization.defaultLocale;
|
||||
let localesGeneric = locales
|
||||
.map(locale => locale.split("-")[0])
|
||||
.filter(locale => locales.indexOf(locale) === -1);
|
||||
|
||||
return locales.find(Localization.isSupported)
|
||||
|| localesGeneric.find(Localization.isSupported)
|
||||
|| Localization.defaultLocale;
|
||||
}
|
||||
|
||||
static async setTranslation(locale) {
|
||||
|
||||
Reference in New Issue
Block a user