fitst commit

This commit is contained in:
Samandar Turgunboyev
2026-01-28 18:26:50 +05:00
parent 166a55b1e9
commit 124798419b
196 changed files with 26627 additions and 421 deletions

37
i18n/i18n.ts Normal file
View File

@@ -0,0 +1,37 @@
// i18n.ts
import AsyncStorage from '@react-native-async-storage/async-storage';
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import en from './locales/en.json';
import ru from './locales/ru.json';
import uz from './locales/uz.json';
const languageDetector = {
type: 'languageDetector' as const,
async: true,
detect: async (callback: (lang: string) => void) => {
const savedLang = await AsyncStorage.getItem('lang');
callback(savedLang || 'uz');
},
init: () => {},
cacheUserLanguage: async (lang: string) => {
await AsyncStorage.setItem('lang', lang);
},
};
i18n
.use(languageDetector as any)
.use(initReactI18next)
.init({
resources: {
uz: { translation: uz },
ru: { translation: ru },
en: { translation: en },
},
fallbackLng: 'uz',
interpolation: { escapeValue: false },
react: { useSuspense: false },
});
export default i18n;