feat(settings): respect settings from server (#1013)
This commit is contained in:
parent
32aa47e701
commit
9a41b9b7d7
27 changed files with 230 additions and 167 deletions
16
utils/language.ts
Normal file
16
utils/language.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
export function matchLanguages(languages: string[], acceptLanguages: string[]): string | null {
|
||||
{
|
||||
const lang = acceptLanguages.map(userLang => languages.find(lang => lang.startsWith(userLang))).filter(v => !!v)[0]
|
||||
if (lang)
|
||||
return lang
|
||||
}
|
||||
|
||||
const lang = acceptLanguages.map((userLang) => {
|
||||
userLang = userLang.split('-')[0]!
|
||||
return languages.find(lang => lang.startsWith(userLang))
|
||||
}).filter(v => !!v)[0]
|
||||
if (lang)
|
||||
return lang
|
||||
|
||||
return null
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue