diff --git a/src/screens/Startup/Startup.tsx b/src/screens/Startup/Startup.tsx index 4a5d729..448b4fd 100644 --- a/src/screens/Startup/Startup.tsx +++ b/src/screens/Startup/Startup.tsx @@ -1,5 +1,6 @@ import React, { useEffect } from 'react'; -import { ActivityIndicator, View } from 'react-native'; +import { ActivityIndicator, View, NativeModules, Platform } from 'react-native'; +import { useTranslation } from 'react-i18next'; import { useTheme } from '../../hooks'; import { Brand } from '../../components'; import PoweredByFlux from '../../components/PoweredByFlux/PoweredByFlux'; @@ -7,9 +8,18 @@ import { setDefaultTheme } from '../../store/theme'; import { ApplicationScreenProps } from '../../../@types/navigation'; const Startup = ({ navigation }: ApplicationScreenProps) => { + const { i18n } = useTranslation(); const { Layout, Gutters } = useTheme(); const init = async () => { + const deviceLanguage = + Platform.OS === 'ios' + ? NativeModules.SettingsManager.settings.AppleLocale || + NativeModules.SettingsManager.settings.AppleLanguages[0] // iOS 13 + : NativeModules.I18nManager.localeIdentifier; + + console.log(deviceLanguage); // en_US + await i18n.changeLanguage(deviceLanguage.split('_')[0].split('-')[0]); // use system language await new Promise((resolve) => setTimeout(() => { resolve(true); diff --git a/src/translations/resources/index.ts b/src/translations/resources/index.ts index 3ef214f..2bdc329 100644 --- a/src/translations/resources/index.ts +++ b/src/translations/resources/index.ts @@ -1,2 +1,2 @@ export { default as en } from './en/_index'; -export { default as fr } from './fr/_index'; +export { default as id } from './id/_index';