react-native-change-ios-locale
v0.1.4
Published
Force ios to change the language for the native module
Downloads
836
Readme
Under development
currently working with IOS only
react-native-change-ios-locale
Force ios to sync the language change with the i18 localization or react native localization,
When should I use this package
Use this package when: you are using a native module or library that provides a separate way to detect the localization
Installation
npm install react-native-change-ios-locale
Usage
Follow the instruction from https://www.npmjs.com/package/react-native-localization
let strings = new LocalizedStrings({
en:{
///...
},
ar:{
// ....
},
// ...
});
import { switchLang } from "react-native-change-ios-locale";
// ...
useEffect(() => {
async function changeLocalization() {
// Change the Language for the translation Package
await translations.setLanguage(selectedLocale);
}
if (selectedLocale) {
changeLocalization().then(() => {
// then trigger the switchLang to set the language for the IOS
if (Platform.OS === 'ios') {
switchLang(selectedLocale);
}
// reload app iff needed using react native restart
});
}
}, [selectedLocale]);
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT