A caching layer backend for i18next that stores and retrieves translation resources using React Native AsyncStorage. Version 2.1.0 (stable, actively maintained) leverages @react-native-async-storage/async-storage for reliable persistent storage. It is designed for React Native apps using i18next, often combined with i18next-chained-backend to fallback to an async resource loader like XHR. Key differentiators include configurable expiration time, version-based cache control, and namespace-level cache skipping. It requires manual installation of the peer dependency @react-native-async-storage/async-storage and ships TypeScript types.
npm install i18next-async-storage-backend2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup with i18next-chained-backend using AsyncStorage as primary cache and XHR fallback.
Install @react-native-async-storage/async-storage as a dependency: npx expo install @react-native-async-storage/async-storage
Use 'i18next-async-storage-backend2' instead of 'i18next-async-storage-cache'.
Always pair with a fallback backend like i18next-xhr-backend or i18next-http-backend.
Set expirationTime appropriately at initialization and avoid changing it later to prevent unexpected cache behavior.
Either set expirationTime to a long duration or implement manual cache invalidation via version changes.
Install the peer dependency: npm install @react-native-async-storage/async-storage
Change import to: import AsyncStorageBackend from 'i18next-async-storage-backend2'
Add a fallback backend (e.g., i18next-xhr-backend) and configure i18next-chained-backend.
Ensure @react-native-async-storage/async-storage is installed and linked correctly (in Expo it's auto-linked).