react-native-mlkit-translate-text
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

MLKitTranslator

A MachineLearning Language Translator

Build Powerful React Native With Greate Language Identifier And Translator Amazing ⚡️

MIT License

MLKitTranslator
⚡️ Identify Language Immediately over 50 languages supported (full list)
😎 Lazy loaded. download models when needed
🔄 Offline-first. no network required for using
📱 Multiplatform. iOS, Android
Fast. About TO Migrating to RN New Arch(JSI)
🔗 Relational. Built on MLKit Translation foundation
⚠️ Static typing Full-Support TypeScript

Why MLKitTranslator?

Key capabilities

  • Broad language support Translate between more than 50 different languages. See the complete list.
  • Proven translation models Powered by the same models used by the Google Translate app's offline mode.
  • Dynamic model management Keep on-device storage requirements low by dynamically downloading and managing language packs.
  • Runs on the device Translations are performed quickly, and don't require you to send users' text to a remote server.

Installation

yarn add react-native-mlkit-entity-extraction

or

npm i --save react-native-mlkit-entity-extraction

Usage

Quick example: identify language type

import MLKitTranslator, { LANG_TAGS } from './MLKitTranslator';

const Lang = "Bonjour, c’est en français";

MLKitTranslator.identifyLanguage(text)
.then((result:string) => {
	setLanguageType(getHumanLang(result));
})

Translate text example: identify 、download model and translate

etc: you'd like to translate french to english

1️⃣ download model firstly

import MLKitTranslator, { LANG_TAGS } from './MLKitTranslator';
//better do this in async function
await MLKitTranslator.downloadModel(LANG_TAGS.FRENCH);
await MLKitTranslator.downloadModel(LANG_TAGS.ENGLISH);

Remember !✨ Always check model firstly ; Do not translate text if the model is not downloaded

use NativeMLKitTranslateText.isModelDownloaded to check

2️⃣ translate text

await MLKitTranslator.translateText(text,LANG_TAGS.FRENCH, LANG_TAGS.ENGLISH);

// 🎉 got it, dude

Author and license

WatermelonDB was created by @yaaliuzhipeng

react-native-mlkit-translate-text is available under the MIT license. See the LICENSE file for more info.

Package Sidebar

Install

npm i react-native-mlkit-translate-text

Weekly Downloads

4

Version

1.0.3

License

MIT

Unpacked Size

36.3 kB

Total Files

13

Last publish

Collaborators

  • yaaliuzhipeng