mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-24 16:56:16 -04:00
try the generalized version of a language code before resorting to the default language (es-US -> es)
This commit is contained in:
parent
dd31f375a4
commit
84986e4eef
2 changed files with 14 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue