You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But after pressing the button, state is not changeable.
If I leave strings.setLanguage('it'); in the component, after reloading the app, language is switched to 'it'.
So, is it not possible to change the language on fly?
Should I save the language to database, and set the language from database during app loading?
Thank you!
My code:
const App = () => {
let strings = new LocalizedStrings({
'en-US': {
how: 'How do you want your egg today?',
},
en: {
how: 'How do you want your egg today?',
},
ru: {
how: 'даd',
},
it: {
how: 'si',
},
});
const [, setLanguage] = useState(0);
const setLanguageHandler = () => {
console.log('language');
strings.setLanguage('it');
setLanguage(1);
}
return (
<>
<Button onPress={setLanguageHandler}/>
<Text>{strings.how}</Text>
</>
)
};
The text was updated successfully, but these errors were encountered:
"react-native-localization": "^2.1.7",
"react-native": "0.64.2",
Language in iOS: 'ru'
Trying change to: 'it'
But after pressing the button, state is not changeable.
If I leave
strings.setLanguage('it');
in the component, after reloading the app, language is switched to 'it'.So, is it not possible to change the language on fly?
Should I save the language to database, and set the language from database during app loading?
Thank you!
My code:
The text was updated successfully, but these errors were encountered: