-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
"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:
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>
</>
)
};
martynas-bajoraitis-riawolf, Rajat9610, newtons-apple, 7dp, Nembie and 4 more
Metadata
Metadata
Assignees
Labels
No labels