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