
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@ahmedrowaihi/react-native-i18n-storage
Advanced tools
React Native I18n Storage is a simple library to manage your app's I18nManager settings and language by keeping them in sync with local storage from the initial native app launch!.
Sync your I18n Manager from Native Side Without hassle!
React Native I18n Storage is a simple library to manage your app's I18nManager settings and language by keeping them in sync with local storage from the initial native app launch! Which means that you can change the locale from native side and the app will restart with the new locale from the local storage!
if you have not installed them yet, you can install them by running the following commands:
// you can use npm instead of yarn
yarn add @react-native-async-storage/async-storage react-native-restart
// you can use npm instead of yarn
yarn add @ahmedrowaihi/react-native-i18n-storage
AppDelegate.mm
:// ios/your-app-name/AppDelegate.mm
#import "AppDelegate.h"
#import <I18nStorage.h>
didFinishLaunchingWithOptions
method:// ios/your-app-name/AppDelegate.mm
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
I18nStorage *i18nStorage = [[I18nStorage alloc] init]; // <--- Add this line at the top
[i18nStorage SyncI18nStorage]; // <- call the SyncI18nStorage method
// rest of the code ...
}
MainApplication.java
// android/app/src/main/java/com/your-app-name/MainApplication.java
import com.facebook.react.ReactApplication;
import com.i18nstorage.I18nStorageUtility; // <-- Add this line
// ... rest of the imports
onCreate
method:// android/app/src/main/java/com/your-app-name/MainApplication.java
@Override
public void onCreate() {
super.onCreate();
I18nStorageUtility.SyncI18nStorage(this); // <-- Add this line
// rest of the code ...
}
import { setI18nStorage } from '@ahmedrowaihi/react-native-i18n-storage';
import { Platform, Settings } from 'react-native';
await setI18nStorage({
locale: 'ar', // or any other locale
forceRTL: true, // or false
allowRTL: true, // or false
doLeftAndRightSwapInRTL: true, // or false
});
or with optional parameters
await setI18nStorage(
{
locale: 'ar', // or any other locale
forceRTL: true, // or false
allowRTL: true, // or false
doLeftAndRightSwapInRTL: true, // or false
},
false, // (restart) default is true
() => {} // (callback before restart) default is undefined
);
/**
* @returns {Promise<{locale: string, forceRTL: boolean, allowRTL: boolean, doLeftAndRightSwapInRTL: boolean}>}
*/
import { getI18nStorage } from '@ahmedrowaihi/react-native-i18n-storage';
const I18nStorage = await getI18nStorage();
import { resetI18nStorage } from '@ahmedrowaihi/react-native-i18n-storage';
await resetI18nStorage();
or with optional parameters
await resetI18nStorage(
false, // (restart) default is true
() => {} // (callback before restart) default is undefined
);
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
development workflow.
MIT
FAQs
React Native I18n Storage is a simple library to manage your app's I18nManager settings and language by keeping them in sync with local storage from the initial native app launch!.
We found that @ahmedrowaihi/react-native-i18n-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.