react-native-i18n icon indicating copy to clipboard operation
react-native-i18n copied to clipboard

Language changing properly only after reopening the app

Open ajithes111 opened this issue 5 years ago • 3 comments

After changing language to Arabic all text data are automatically aligned to the Right side of the screen properly. But all other components like Icons are aligning only after re-opening the app.

export function langSet(type){
    if(type == "en"){
    I18n.locale = type;
    const currentLocale = I18n.currentLocale();
    }else{
        I18n.locale = type;
        const currentLocale = I18n.currentLocale();
        ReactNative.I18nManager.allowRTL(true);
        ReactNative.I18nManager.forceRTL(true);
    }
}

ajithes111 avatar May 06 '19 11:05 ajithes111

@ajithes111 you need to restart the app for RTL aligning to take place. You can easily do that with https://github.com/avishayil/react-native-restart

pavelbely avatar Sep 10 '19 10:09 pavelbely

Hey You just need to save your I18n.Locale in your Cache You can use Redux Persist or asyncStorage

Younext19 avatar Nov 24 '20 12:11 Younext19