React Native On-Device Language Identification w/ Google ML Kit
npm install @react-native-ml-kit/identify-languages --save
CLI autolink feature links the module while building the app.
react-native link @react-native-ml-kit/identify-languages
On iOS, use CocoaPods to add the native RNMLKitIdentifyLanguages to your project:
npx pod-install
import IdentifyLanguages from '@react-native-ml-kit/identify-languages';
const lang = await IdentifyLanguages.identify('Ciao'); // "it" (Italian)
const possibleLangs = await IdentifyLanguages.identifyPossible('Ciao'); // [{ "language": "it", "confidence": 0.9789841771125793 }, { "confidence": 0.012451663613319397, "language": "zh-Latn" }]