poliglota

Translates a given text

poliglota

Translates a given text.

Install it

$ npm install -g poliglota

and use it in your shell:

$ poliglota --text="The book is on the table" --to="pt"   # will use language recognition (auto) 
# O livro está sobre a mesa 
 
$ poliglota --text="O livro está sobre a mesa" --to="en" --from="pt"
# The book is on the table 
 
echo "O livro está sobre a mesa" | ./bin/poliglota --to=en
# The book is on the table 

with NodeJS:

var poliglota = require('poliglota');
var text = 'The book is on the table';
 
poliglota.translate(text, 'en').then(function(d) {
  console.log(d);
});
 
// O livro está sobre a mesa 

or in the Browser:

//TODO 

Here is the keycode (to be used when passing to --to & --from args) mapping table. The same table is also exposed via CLI by doing $ poliglota -m.

namekey
Afrikaansaf
Albaniansq
Arabicar
Azerbaijaniaz
Basqueeu
Bengalibn
Belarusianbe
Bulgarianbg
Catalanca
Chinese Simplifiedzh-CN
Chinese Traditionalzh-TW
Croatianhr
Czechcs
Danishda
Dutchnl
Englishen
Esperantoeo
Estonianet
Filipinotl
Finnishfi
Frenchfr
Galiciangl
Georgianka
Germande
Greekel
Gujaratigu
Haitian Creoleht
Hebrewiw
Hindihi
Hungarianhu
Icelandicis
Indonesianid
Irishga
Italianit
Japaneseja
Kannadakn
Koreanko
Latinla
Latvianlv
Lithuanianlt
Macedonianmk
Malayms
Maltesemt
Norwegianno
Persianfa
Polishpl
Portuguesept
Romanianro
Russianru
Serbiansr
Slovaksk
Sloveniansl
Spanishes
Swahilisw
Swedishsv
Tamilta
Telugute
Thaith
Turkishtr
Ukrainianuk
Urduur
Vietnamesevi
Welshcy
Yiddishyi

not all of them verified.

The MIT License (MIT)

Copyright (c) <2014>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.