Skip to content
Snippets Groups Projects
Commit 427e7184 authored by Léopold Chappuis's avatar Léopold Chappuis
Browse files

locales: set language based on system

Change-Id: I015d71380d4881e2d53148ba8d5d023a8df966bd
parent 6e2948f3
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,13 @@ const languagesInfosPromises = availableLanguages.map(async (item: any) => ({
export const languagesInfos: readonly LanguageInfo[] = await Promise.all(languagesInfosPromises)
const lastLanguage = localStorage.getItem('language')
const defaultLanguage = lastLanguage ? lastLanguage : 'en'
// transifex uses underscores instead of dashes
const systemLanguage = navigator.language.replace('-', '_')
const defaultLanguage = lastLanguage
? lastLanguage
: availableLanguages.includes(systemLanguage)
? systemLanguage
: 'en'
const initialResources = await getTranslation(defaultLanguage)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment