mirror of https://github.com/trezor/trezor-wallet
parent
f7bde2d306
commit
1eb9f71fdc
@ -0,0 +1,11 @@
|
|||||||
|
import { LANGUAGE } from 'config/variables';
|
||||||
|
|
||||||
|
export const getInitialLocale = (defaultLocale = 'en') => {
|
||||||
|
const browserLocale = navigator.language.split('-')[0];
|
||||||
|
if (LANGUAGE.some(e => e.code === browserLocale)) {
|
||||||
|
// Array of supported languages contains the locale we're looking for
|
||||||
|
return browserLocale;
|
||||||
|
}
|
||||||
|
// if browser lang is not supported return en as default locale
|
||||||
|
return defaultLocale;
|
||||||
|
};
|
Loading…
Reference in new issue