File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* Copyright 2018 Shift Devices AG
3
- * Copyright 2023 Shift Crypto AG
3
+ * Copyright 2023-2024 Shift Crypto AG
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
16
16
*/
17
17
18
18
import { LanguageDetectorAsyncModule } from 'i18next' ;
19
- import { apiGet } from '../utils/request' ;
19
+ import { getNativeLocale } from '../api/nativelocale' ;
20
+ import { getConfig } from '../utils/config' ;
20
21
import { i18nextFormat } from './utils' ;
21
22
22
23
const defaultUserLanguage = 'en' ;
@@ -25,12 +26,12 @@ export const languageFromConfig: LanguageDetectorAsyncModule = {
25
26
type : 'languageDetector' ,
26
27
async : true ,
27
28
detect : ( cb ) => {
28
- apiGet ( 'config' ) . then ( ( { backend } ) => {
29
+ getConfig ( ) . then ( ( { backend } ) => {
29
30
if ( backend && backend . userLanguage ) {
30
31
cb ( backend . userLanguage ) ;
31
32
return ;
32
33
}
33
- apiGet ( 'native-locale' ) . then ( locale => {
34
+ getNativeLocale ( ) . then ( locale => {
34
35
if ( typeof locale === 'string' && locale ) {
35
36
try {
36
37
new Date ( ) . toLocaleString ( i18nextFormat ( locale ) ) ;
You can’t perform that action at this time.
0 commit comments