Skip to content

Commit a91f790

Browse files
committed
Merge branch 'frontend-use-typed-apis'
2 parents ccbe841 + 0cd7d49 commit a91f790

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

frontends/web/src/i18n/config.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Copyright 2018 Shift Devices AG
3-
* Copyright 2023 Shift Crypto AG
3+
* Copyright 2023-2024 Shift Crypto AG
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -16,7 +16,8 @@
1616
*/
1717

1818
import { LanguageDetectorAsyncModule } from 'i18next';
19-
import { apiGet } from '../utils/request';
19+
import { getNativeLocale } from '../api/nativelocale';
20+
import { getConfig } from '../utils/config';
2021
import { i18nextFormat } from './utils';
2122

2223
const defaultUserLanguage = 'en';
@@ -25,12 +26,12 @@ export const languageFromConfig: LanguageDetectorAsyncModule = {
2526
type: 'languageDetector',
2627
async: true,
2728
detect: (cb) => {
28-
apiGet('config').then(({ backend }) => {
29+
getConfig().then(({ backend }) => {
2930
if (backend && backend.userLanguage) {
3031
cb(backend.userLanguage);
3132
return;
3233
}
33-
apiGet('native-locale').then(locale => {
34+
getNativeLocale().then(locale => {
3435
if (typeof locale === 'string' && locale) {
3536
try {
3637
new Date().toLocaleString(i18nextFormat(locale));

0 commit comments

Comments
 (0)