translate 1.0.0 copy "translate: ^1.0.0" to clipboard
translate: ^1.0.0 copied to clipboard

A simple to use Dart package, for translating text using Yandex.Translate API

translate #

A simple to use Dart package, for detecting & translating text and html pages using Yandex.Translate API

Show some ❤️, by putting ⭐

what does it do ? #

  • Fetches list of languages along with language codes, supported by Yandex.Translate API
  • Detects which language given text belongs to
  • Translates text or html page to certain language, denoted by language code

How to use ? #

First get yourself a Yandex.Translate API Key, which can be found here.

Languages('api_key')
      .fetch()
      .then(
        (data) => print(data),
        onError: (e) => print(e),
      ).then((val) => exit(0));

supported_languages

Response in case of success,

{
    ru: 'Russian',
    en: 'English',
}

Response in case of error,

{
    error: ' ... '
}

DetectIt('api_key')
      .detect('Hello World', hint: [
        'en',
        'de',
        'ru',
        'hi',
      ]) // hints are to be prioritized by platform while detecting language, if provided
      .then(
        (data) => print(data),
        onError: (e) => print(e),
      )
      .then((val) => exit(0));

detect_language

Response in case of success,

{
    lang: 'en'
}

Response in case of error,

{
    error: ' ... '
}

TranslateIt('api_key')
      .translate(
          '<!DOCTYPE html><html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>',
          'en-ru', // only `ru` will also do same job
          type: 'html') // type is `html`, cause this text is markedup
      .then(
        (data) => print(data),
        onError: (e) => print(e),
      )
      .then((val) => exit(0));
English Russian
html_page_in_english html_page_in_russian

Response in case of success,

{
    text: ' ... '
}

Response in case of error,

{
    error: ' ... '
}

Courtesy : #

Translation API is powered by Yandex.Translate, so all thanks goes to them.

If you're interested in learning more about T&C, take a look here.

You can also go for priced version.

Hoping, it was helpful 😉

11
likes
40
pub points
57%
popularity

Publisher

verified publisheritzmeanjan.in

A simple to use Dart package, for translating text using Yandex.Translate API

Repository
View/report issues

License

MIT (LICENSE)

More

Packages that depend on translate