# react-native-phrase-sdk

> Phrase over-the-air translations library for React Native

Latest version **1.1.5** (published 2026-03-11) · SEE LICENSE IN LICENSE.txt license · 0 weekly downloads

## Install

```sh
npm install react-native-phrase-sdk
pnpm add react-native-phrase-sdk
yarn add react-native-phrase-sdk
bun add react-native-phrase-sdk
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2026-03-11 |
| First published | 2021-09-16 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE.txt |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 34.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Phrase GmbH |
| Maintainers | phraseapp |
| Keywords | react-native, phrase, translation, localization, i18next |

## Links

- npm: https://www.npmjs.com/package/react-native-phrase-sdk
- npm.io page: https://npm.io/package/react-native-phrase-sdk

## Dependencies (2)

- [react-native-url-polyfill](https://npm.io/package/react-native-url-polyfill.md) ^1.3.0
- [@react-native-async-storage/async-storage](https://npm.io/package/@react-native-async-storage/async-storage.md) ^3.0.1

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2026-03-11
- 1.1.4 — 2025-06-11
- 1.2.0-rc1 — 2024-03-08
- 1.1.3 — 2024-01-16
- 1.1.2 — 2023-05-02
- 1.1.1 — 2023-01-13
- 1.1.0 — 2023-01-11
- 1.0.0 — 2021-09-16

## README

# Phrase OTA for React Native

Library for Phrase over-the-air translations.
Currently works only in tandem with [react-i18next](https://react.i18next.com/) library.

## Installation
`$ npm install react-native-phrase-sdk --save`

## Usage with i18next

In order to add Phrase OTA support to your project you need to make some changes in your `i18next.js` file:
1. Initialize Phrase
```javascript
import Phrase from "react-native-phrase-sdk";

let phrase = new Phrase(
    "YOUR_DISTRIBUTION_ID",
    "YOUR_ENVIRONMENT_ID",
    "YOUR_APP_VERSION",
    "i18next"
);
```

2. Create i18next backend based on Phrase instance
```javascript
import resourcesToBackend from "i18next-resources-to-backend";

const backendPhrase = resourcesToBackend((language, namespace, callback) => {
    phrase.requestTranslation(language)
        .then((remoteResources) => {
            callback(null, remoteResources);
        })
        .catch((error) => {
            callback(error, null);
        });
});

const backendFallback = resourcesToBackend(localResources)
```

3. Initialize `i18n` with Phrase backend
```javascript
i18n
  .use(ChainedBackend)
  .use(initReactI18next)
  .init({
    backend: {
        backends: [backendPhrase, backendFallback]
    }
    //...
  });
```

<details>
  <summary><b>Example of `i18next.js` file</b></summary>

```javascript
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import ChainedBackend from "i18next-chained-backend";
import resourcesToBackend from "i18next-resources-to-backend";
import translationEN from "./locales/en/translation.json";
import translationRU from "./locales/ru/translation.json";
import Phrase from "react-native-phrase-sdk";

const localResources = {
  en: {
    translation: translationEN,
  },
  ru: {
    translation: translationRU,
  },
};

let phrase = new Phrase(
    "YOUR_DISTRIBUTION_ID",
    "YOUR_ENVIRONMENT_ID",
    require('./package.json').version,
    "i18next"
);

const backendPhrase = resourcesToBackend((language, namespace, callback) => {
    phrase.requestTranslation(language)
        .then((remoteResources) => {
            callback(null, remoteResources);
        })
        .catch((error) => {
            callback(error, null);
        });
});

const backendFallback = resourcesToBackend(localResources)

i18n
  .use(ChainedBackend)
  .use(initReactI18next)
  .init({
    backend: {
        backends: [backendPhrase, backendFallback]
    },
    debug: true,
    lng: "en",
    fallbackLng: "en",
    interpolation: {
      escapeValue: false, // not needed for react as it escapes by default
    }
  });


```
</details>

## AsyncStorage note

This library stores its internal data (e.g. translations, unique ID) in AsyncStorage of your app. This means that you should be careful when manipulating the storage in your app: if you completely clear the AsyncStorage (for example on user logout), the app will have to download the translations again and regenerate the unique ID, so your account will show inflated number of unique users.

## Contribution

To publish a new version:

* `npm login`
* `npm publish`

---
_Source: https://npm.io/package/react-native-phrase-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
