Skip to content

React Native Library for text translation over 50 languages using ML

License

Notifications You must be signed in to change notification settings

Nikunj-bisht/react-native-language-translations

Repository files navigation

react-native-language-translation

This library help you to translate easy in 50 languages and its easy to use

Installation

npm install react-native-language-translations

Make sure to build project again after installing the dependency

DEMO

Screenrecorder-2023-03-05-13-21

Usage

This package first downloads the modal which you want to use for that you have to call a method createLanguageTranslator giving parameters as languages codes.

import {
  createLanguageTranslator,
  translate,
  getAllLanguages,
} from 'react-native-language-translations';
 // english to chinese
 const t = (text: string) => {
    createLanguageTranslator('en', 'zh', () => {
      translate(text, (result: string) => {
        setResult(result);
      });
    });
  };

   getAllLanguages((val: String) => {
      console.log(val);
      let langVal = [];
     
      Object.keys(val).forEach((i) => langVal.push(i));
    });

// ...
Parameter Type Description iOS Android
createLanguageTranslator Function Downloads the trasnlator modal just pass to and from language code X
translate Function used too translate text X

| getAllLanguages | Function | returns all the supported languages | X | ✔ |

Contributing

License

MIT


About

React Native Library for text translation over 50 languages using ML

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published