phrase/i18next-phrase-backend
@phrase/i18next-backend is a backend plugin for i18next that fetches translations from Phrase OTA at runtime. It works with any JavaScript framework that uses i18next — React, Vue, Angular, Node.js, React Native, and others. The plugin caches translations locally and re-fetches when the cache expires, minimizing requests to the Phrase CDN.
This guide applies to v2+ of the SDK.
Installation
Setup
distribution and environment are available in the Phrase Strings dashboard after creating a distribution, or via the Distributions API.
Configuration options
React Native
The backend has no built-in storage on React Native, so pass anAsyncStorage-compatible implementation via the storage option. Any storage exposing getItem, setItem, and clear (returning Promises) works.
react-native-web, passing AsyncStorage works on both — its web build is backed by localStorage. Alternatively, omit storage and the package auto-detects localStorage on web.