@react-native-ml-kit/translate-text
v0.4.1
Published
React Native On-Device Text Translation w/ Google ML Kit
Downloads
19
Readme
@react-native-ml-kit/translate-text
React Native On-Device Text Translation w/ Google ML Kit
⚠ WARNING: Don't use this in production.
This package is still in alpha release, so it's not recommended to use it in production until it's fully stable, however using it for testing purposes is helpful.
Getting started
npm install @react-native-ml-kit/translate-text --save
Linking
React Native > 0.59
CLI autolink feature links the module while building the app.
React Native <= 0.59
react-native link @react-native-ml-kit/translate-text
Installing Pods
On iOS, use CocoaPods to add the native RNMLKitTranslateText to your project:
npx pod-install
Usage
import TranslateText, {
TranslateLanguage,
} from '@react-native-ml-kit/translate-text';
const translatedText = await TranslateText.translate({
text: 'مرحبا بالعالم',
sourceLanguage: TranslateLanguage.ARABIC,
targetLanguage: TranslateLanguage.ENGLISH,
downloadModelIfNeeded: true,
});