0 purchases
translate
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));
copied to clipboard
Response in case of success,
{
ru: 'Russian',
en: 'English',
}
copied to clipboard
Response in case of error,
{
error: ' ... '
}
copied to clipboard
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));
copied to clipboard
Response in case of success,
{
lang: 'en'
}
copied to clipboard
Response in case of error,
{
error: ' ... '
}
copied to clipboard
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));
copied to clipboard
English
Russian
Response in case of success,
{
text: ' ... '
}
copied to clipboard
Response in case of error,
{
error: ' ... '
}
copied to clipboard
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 😉
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.