# react-native-translator

> Free translate component & hook

Latest version **2.0.0** (published 2025-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-translator
pnpm add react-native-translator
yarn add react-native-translator
bun add react-native-translator
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-08-07 |
| First published | 2022-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 99 |
| Author | KoreanThinker |
| Maintainers | coderhyun |
| Keywords | react-native-translator, react-native-translate, react-native, react native, translate, translator |

## Links

- npm: https://www.npmjs.com/package/react-native-translator
- Repository: https://github.com/koreanthinker/react-native-translator
- Homepage: https://github.com/koreanthinker/react-native-translator#readme
- Issues: https://github.com/koreanthinker/react-native-translator/issues
- npm.io page: https://npm.io/package/react-native-translator

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-08-07
- 1.2.0 — 2024-05-01
- 1.1.6 — 2023-03-19
- 1.1.5 — 2023-03-15
- 1.1.4 — 2023-03-11
- 1.1.3 — 2022-04-22
- 1.1.2 — 2022-03-25
- 1.1.1 — 2022-03-24
- 1.1.0 — 2022-03-18
- 1.1.0-rc.1 — 2022-03-18
- 1.1.0-rc.0 — 2022-03-18
- 1.0.0 — 2022-03-17
- 0.0.4 — 2022-03-17
- 0.0.3 — 2022-03-17
- 0.0.2 — 2022-03-17
- … 1 more at https://npm.io/package/react-native-translator/versions

## README

# React Native Translator

[![codecov](https://codecov.io/gh/KoreanThinker/react-native-translator/graph/badge.svg?token=9T36KDBTMQ)](https://codecov.io/gh/KoreanThinker/react-native-translator)
[![CI](https://github.com/KoreanThinker/react-native-translator/actions/workflows/ci.yaml/badge.svg)](https://github.com/KoreanThinker/react-native-translator/actions/workflows/ci.yaml)
[![Check availability](https://github.com/KoreanThinker/react-native-translator/actions/workflows/check-availability.yaml/badge.svg)](https://github.com/KoreanThinker/react-native-translator/actions/workflows/check-availability.yaml)
[![npm version](https://badge.fury.io/js/react-native-translator.svg)](https://www.npmjs.com/package/react-native-translator)
[![npm download](https://img.shields.io/npm/dt/react-native-translator)](https://www.npmjs.com/package/react-native-translator)
[![License MIT](https://img.shields.io/github/license/KoreanThinker/react-native-translator?style=plat)](LICENSE)
[![Example](https://img.shields.io/badge/example-here!-blue)](https://github.com/krtk-dev/translators)
![Stars](https://img.shields.io/github/stars/KoreanThinker/react-native-translator?style=social)

## Preview

## <img width="360" src="https://user-images.githubusercontent.com/48207131/158834248-05331dd0-d294-4041-9d7b-cb72b5e75737.gif" />

---

## Introduce

Unofficial free translate component & hook

> Never need api key, This library is Unlimited free

---

## Support translators

- [Google](https://translate.google.com/)
- [Papago](https://papago.naver.com/)
- [Kakao](https://translate.kakao.com/) _(deprecated)_

---

## Getting started

#### First, Install package

```bash
yarn add react-native-translator react-native-webview
```

#### Second, Pod intsall

```bash
cd ios && pod install
```

#### Third, Add provider

```tsx
// App.js
...
import {TranslatorProvider} from 'react-native-translator' // here

const App = () => {
  return (
    <TranslatorProvider> // here
        <.../>
    </TranslatorProvider> // here
  );
};
```

---

## API

### `Translator` ( Real-time translate )

```tsx
// Usage
import Translator from 'react-native-translator';

const App = () => {
  const [value, setValue] = useState('');
  const [result, setResult] = useState('');

  return (
    <View>
      <Translator
        from="en"
        to="fr"
        value={value}
        onTranslated={(t) => setResult(t)}
      />
      <TextInput value={value} onChangeText={(t) => setValue(t)} />
      <Text>{result}</Text>
    </View>
  );
};
```

| Props        | Type                               | Default value | Required |
| ------------ | ---------------------------------- | ------------- | -------- |
| from         | [LanguageCode](#support-languages) |               | ✅        |
| to           | [LanguageCode](#support-languages) |               | ✅        |
| value        | string                             |               | ✅        |
| type         | [TranslatorType](#translatortype)  | 'google'      |          |
| onTranslated | `(result: string) => void`         |               | ✅        |

### `useTranslator`

```tsx
// Usage
import {useTranslator} from 'react-native-translator';

const App = () => {
  const {translate} = useTranslator();

  const [value, setValue] = useState('');
  const [result, setResult] = useState('');

  const onTranslate = async () => {
    const _result = await translate('en', 'fr', value);
    setResult(_result);
  };

  return (
    <View>
      <TextInput value={value} onChangeText={(t) => setValue(t)} />
      <Text>{result}</Text>
      <Button title="translate" onPress={onTranslate} />
    </View>
  );
};
```

#### `translate`

```ts
// const {translate} = useTranslator();
type translate: <T extends TranslatorType>(/* check follow param table */) => Promise<string>;
```

| param  | Type                                                         | Default value                   | Required |
| ------ | ------------------------------------------------------------ | ------------------------------- | -------- |
| from   | [LanguageCode](#support-languages)                           |                                 | ✅        |
| to     | [LanguageCode](#support-languages)                           |                                 | ✅        |
| value  | string                                                       |                                 | ✅        |
| option | {type?: [TranslatorType](#translatortype), timeout?: number} | {type: 'google', timeout: 5000} |          |

### `languageCodeConverter`

> ❗️ If conversion is not possible, return undefined.

```ts
import {languageCodeConverter} from 'react-native-translator';
// google language code convert to kakao language code
languageCodeConverter('google', 'kakao', 'ko'); // kr
```

### `TranslatorType`

```ts
type TranslatorType = 'google' | 'kakao' | 'papago';
```

### `LanguageCode`

```ts
type LanguageCode<T extends TranslatorType> ...
// Usage
type GoogleLanguageCode = LanguageCode<'google'>;
```

### `VALUES`

```tsx
import {LANGUAGE_CODES, TRANSLATOR_TYPES} from 'react-native-translator';
// translator types
TRANSLATOR_TYPES; // ["google", "papago", "kakao", ...]
// language code
LANGUAGE_CODES['google']; // ["af", "ga", "sq", ...]
```

---

## Support languages

| Language            | Google | Papago | Kakao |
| ------------------- | ------ | ------ | ----- |
| Afrikaans           | af     |        |       |
| Irish               | ga     |        |       |
| Albanian            | sq     |        |       |
| Italian             | it     | it     | it    |
| Arabic              | ar     |        | ar    |
| Japanese            | ja     | ja     | jp    |
| Azerbaijani         | az     |        |       |
| Kannada             | kn     |        |       |
| Basque              | eu     |        |       |
| Korean              | ko     | ko     | kr    |
| Bengali             | bn     |        | bn    |
| Latin               | la     |        |       |
| Belarusian          | be     |        |       |
| Latvian             | lv     |        |       |
| Bulgarian           | bg     |        |       |
| Lithuanian          | lt     |        |       |
| Catalan             | ca     |        |       |
| Macedonian          | mk     |        |       |
| Chinese Simplified  | zh-CN  | zh-CN  | cn    |
| Malay               | ms     |        |       |
| Chinese Traditional | zh-TW  | zh-TW  | cn    |
| Maltese             | mt     |        |       |
| Croatian            | hr     |        |       |
| Norwegian           | no     |        |       |
| Czech               | cs     |        |       |
| Persian             | fa     |        |       |
| Danish              | da     |        |       |
| Polish              | pl     |        |       |
| Dutch               | nl     |        | nl    |
| Portuguese          | pt     |        | pt    |
| English             | en     | en     | en    |
| Romanian            | ro     |        |       |
| Esperanto           | eo     |        |       |
| Russian             | ru     | ru     | ru    |
| Estonian            | et     |        |       |
| Serbian             | sr     |        |       |
| Filipino            | tl     |        |       |
| Slovak              | sk     |        |       |
| Finnish             | fi     |        |       |
| Slovenian           | sl     |        |       |
| French              | fr     | fr     | fr    |
| Spanish             | es     | es     | es    |
| Galician            | gl     |        |       |
| Swahili             | sw     |        |       |
| Georgian            | ka     |        |       |
| Swedish             | sv     |        |       |
| German              | de     | de     | de    |
| Tamil               | ta     |        |       |
| Greek               | el     |        |       |
| Telugu              | te     |        |       |
| Gujarati            | gu     |        |       |
| Thai                | th     | th     | th    |
| Haitian Creole      | ht     |        |       |
| Turkish             | tr     |        | tr    |
| Hebrew              | iw     |        |       |
| Ukrainian           | uk     |        |       |
| Hindi               | hi     |        | hi    |
| Urdu                | ur     |        |       |
| Hungarian           | hu     |        |       |
| Vietnamese          | vi     | vi     | vi    |
| Icelandic           | is     |        |       |
| Welsh               | cy     |        |       |
| Indonesian          | id     | id     | id    |
| Yiddish             | yi     |        |       |

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