@@ -86,6 +86,7 @@ To be able to use Cloud features you need to do two things:
8686| [Image labeling](# image-labeling)|✅|✅
8787| [Landmark recognition](# landmark-recognition)||✅
8888| [Natural language identification](# natural-language-identification)|✅|
89+ | [Translate text](# translate-text)|✅|
8990| [Smart reply](# smart-reply)|✅|
9091| [Custom model inference](# custom-model-inference)|✅|✅
9192
@@ -449,6 +450,34 @@ firebase.mlkit.naturallanguageidentification.identifyNaturalLanguage({
449450.catch(errorMessage => console.log("ML Kit error: " + errorMessage));
450451```
451452
453+ ### Translate text (Android only for now)
454+ <img src="https://raw.githubusercontent.com/EddyVerbruggen/nativescript-plugin-firebase/master/docs/images/features/mlkit_text_translation.png" height="153px" alt="ML Kit - Translate text"/>
455+
456+ > Because of a model download bug on iOS it currently only works on Android.
457+
458+ [Firebase documentation 🌎](https://firebase.google.com/docs/ml-kit/translation)
459+
460+ #### Still image
461+ You could use MLKit to perform OCR, then identify the language, and then translate it to another language.
462+ Check [demo-ng](demo-ng) if you' re interested in such an approach.
463+
464+ ` ` ` typescript
465+ const firebase = require(" nativescript-plugin-firebase" );
466+
467+ firebase.mlkit.translation.ensureTranslationModelDownloaded({
468+ from: " nl" ,
469+ to: " en"
470+ }).then( () => {
471+ firebase.mlkit.translation.translateText({
472+ from: " nl" ,
473+ to: " en" ,
474+ text: " De kat krabt de krullen van de trap" // some Dutch text
475+ })
476+ .then(result => console.log(` Translated to English: ${result} ` ))
477+ .catch(console.error)
478+ }).catch(console.error);
479+ ` ` `
480+
452481# ## Smart reply
453482< img src=" https://raw.githubusercontent.com/EddyVerbruggen/nativescript-plugin-firebase/master/docs/images/features/mlkit_smart_reply.png" height=" 153px" alt=" ML Kit - Smart reply" />
454483
0 commit comments