mirror of https://github.com/tooot-app/app
Fix default language not set
This commit is contained in:
parent
20d1cd4f8f
commit
5ddc370588
|
@ -9,7 +9,10 @@ import netInfo from '@root/startup/netInfo'
|
|||
import sentry from '@root/startup/sentry'
|
||||
import { persistor, store } from '@root/store'
|
||||
import AccessibilityManager from '@utils/accessibility/AccessibilityManager'
|
||||
import { getSettingsLanguage } from '@utils/slices/settingsSlice'
|
||||
import {
|
||||
changeLanguage,
|
||||
getSettingsLanguage
|
||||
} from '@utils/slices/settingsSlice'
|
||||
import ThemeManager from '@utils/styles/ThemeManager'
|
||||
import * as Notifications from 'expo-notifications'
|
||||
import * as SplashScreen from 'expo-splash-screen'
|
||||
|
@ -86,6 +89,9 @@ const App: React.FC = () => {
|
|||
if (bootstrapped) {
|
||||
log('log', 'App', 'loading actual app :)')
|
||||
const language = getSettingsLanguage(store.getState())
|
||||
if (!language) {
|
||||
store.dispatch(changeLanguage('en'))
|
||||
}
|
||||
i18n.changeLanguage(language)
|
||||
return (
|
||||
<ActionSheetProvider>
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useTranslateQuery } from '@utils/queryHooks/translate'
|
|||
import { getSettingsLanguage } from '@utils/slices/settingsSlice'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import * as Localization from 'expo-localization'
|
||||
import React, { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Pressable, StyleSheet, Text } from 'react-native'
|
||||
|
@ -48,7 +49,7 @@ const TimelineTranslate = React.memo(
|
|||
const [enabled, setEnabled] = useState(false)
|
||||
const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({
|
||||
source: status.language,
|
||||
target: settingsLanguage,
|
||||
target: Localization.locale || settingsLanguage || 'en',
|
||||
text,
|
||||
options: { enabled }
|
||||
})
|
||||
|
@ -92,7 +93,9 @@ const TimelineTranslate = React.memo(
|
|||
source: data?.sourceLanguage
|
||||
})
|
||||
: t('shared.translate.default')}
|
||||
{__DEV__ ? ` Source: ${status.language}` : undefined}
|
||||
{__DEV__
|
||||
? ` Source: ${status.language}; Target: ${settingsLanguage}`
|
||||
: undefined}
|
||||
</Text>
|
||||
{isLoading ? (
|
||||
<Circle
|
||||
|
|
Loading…
Reference in New Issue