File tree 2 files changed +7
-26
lines changed
2 files changed +7
-26
lines changed Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
2
import VueI18n , { type Locale } from 'vue-i18n'
3
3
import { SupportedLocales } from '@/globals'
4
- import getBrowserLocale from '@/util/get-browser-locale'
5
4
import messages from '@/locales/en.yaml'
6
5
import { I18nLocales } from '@/dynamicImports'
7
6
@@ -22,11 +21,14 @@ export const getAllLocales = (): Intl.LocalesArgument => {
22
21
* Loads the starting locale for the user.
23
22
*/
24
23
export const getStartingLocale = ( ) => {
25
- const browserLocale = getBrowserLocale ( { countryCodeOnly : true } )
24
+ const navigatorLocale = getNavigatorLocales ( ) [ 0 ]
25
+ const countryCode = navigatorLocale . split ( / - | _ / ) [ 0 ]
26
+
26
27
if (
27
- browserLocale &&
28
- SupportedLocales . findIndex ( locale => locale . code === browserLocale ) >= 0 ) {
29
- return browserLocale
28
+ countryCode &&
29
+ SupportedLocales . some ( locale => locale . code === countryCode )
30
+ ) {
31
+ return countryCode
30
32
} else {
31
33
return import . meta. env . VUE_APP_I18N_LOCALE || 'en'
32
34
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments