Registry / storage / i18next-react-native-async-storage

i18next-react-native-async-storage

JSON →
library1.0.4jsnpmunverified

Caches user language preference in React Native's AsyncStorage for i18next. Version 1.0.4 is current; no active release cadence. Differentiator: lightweight plugin that persists language across app restarts. Requires i18next >=13.0.1 and React Native AsyncStorage (e.g., @react-native-async-storage/async-storage).

npm install i18next-react-native-async-storage
INSTALL
IMPORT
SIG · I18NEXT-REACT-NATI
I
i18next-react-native-async-storage
storagejavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (AsyncStoragePlugin)
import AsyncStoragePlugin from 'i18next-react-native-async-storage'
const AsyncStoragePlugin = require('i18next-react-native-async-storage')
Package is ESM-only; CommonJS require may fail in some bundlers. Default export is a function.
AsyncStoragePlugin() usage
i18n.use(AsyncStoragePlugin())
i18n.use(AsyncStoragePlugin)
AsyncStoragePlugin is a factory function that must be called (with optional fallback) before passing to .use().
Fallback function parameter
i18n.use(AsyncStoragePlugin(() => 'en'))
i18n.use(AsyncStoragePlugin('en'))
When passing a fallback function, it must be a function that takes a callback, not a string. String fallback is also valid, but the function signature is different.

Initializes i18next with React Native Async Storage caching, using react-i18next bridge.

import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import AsyncStoragePlugin from 'i18next-react-native-async-storage'; const resources = { en: { translation: { key: 'hello' } }, es: { translation: { key: 'hola' } }, }; i18n .use(AsyncStoragePlugin()) .use(initReactI18next) .init({ resources, fallbackLng: 'en', interpolation: { escapeValue: false }, }); export default i18n;
Debug
Known issues
gotchaAsyncStoragePlugin() must be called, not passed as reference.
fix
Always execute the factory: i18n.use(AsyncStoragePlugin())
affects: >=1.0.0
gotchaRequires @react-native-async-storage/async-storage to be linked; not included as dependency.
fix
Install @react-native-async-storage/async-storage separately.
affects: >=1.0.0
breakingPackage was renamed from 'i18next-react-native-async-storage' (original scoped version may differ).
fix
Use current name: i18next-react-native-async-storage
affects: >=0.0.0
gotchaFallback function signature expects a callback (err, lng) but docs show a promise-based example that may not work as expected.
fix
Use callback-style: (callback) => { callback(null, 'en'); }
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: _async_storage.default.getItem is not a function
AsyncStorage default export is not a function in newer versions of @react-native-async-storage/async-storage.
fix
Ensure @react-native-async-storage/async-storage is installed and properly linked. If using Expo, use expo-secure-store or a custom solution.
Module not found: Can't resolve 'i18next-react-native-async-storage'
Package not installed or spelled incorrectly.
fix
Run: npm install i18next-react-native-async-storage
Cannot use import statement outside a module
Package uses ESM, and your project may be configured as CommonJS.
fix
Set "type": "module" in package.json or use dynamic import.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
i18nextrequiredpeer dependency, required for plugin to integrate with i18next instance
@react-native-async-storage/async-storagerequiredrequired at runtime to store/retrieve language, must be installed separately
Agent activity
18 hits · last 30 days
node
18
Resources
i18next-react-native-async-storage — npm install i18next-react-native-async-storage · libregistry