linguist

Translate strings or whole JSON files

#linguist Translate strings or JSON (e.g. internationalisation resource files) from Node.js or the command line.

##Command line ###Install

$ npm install -g linguist

###Usage

$ translate [--from <string>] [--to <string>] <text> <text> ...
$ translate [--from <string>] [--to <string>] --input <filename> --output <filename>
 
-f, --from        The language to translate from (default: 'en')
-t, --to          The language to translate to (default: 'en')
-i, --input       A valid JSON file to translate
-o, --output      The output JSON file with input JSON values (but not keys) translated
-h, --help        Print usage instructions

####translate text at the command line

$ translate --from en --to it "hello, how are you" "this is a nice cat"
ciao, come stai
questo è un bel gatto
$ translate "I would like the rabbit please" -t cs
Já bych králíka prosím

####translate the values in a json file An input file like this:

{
    "content": {
        "Terms": "Terms and Conditions",
        "More": {
            "Account": "Some Account",
            "Products": {
                "One": "Some Product"
            }
        }
    }
}

...and this command:

$ translate --input input.json --output output.json --from en --to it

...would produce this output file:

{
    "content": {
        "Terms": "Termini e Condizioni",
        "More": {
            "Account": "Alcuni Account",
            "Products": {
                "One": "Alcune Prodotto"
            }
        }
    }
}

##Library ###Install

$ npm install linguist --save

###Usage

var linguist = require("linguist");
 
linguist.translate("hello, how are you", "en", "it", function(translation){
    console.log(translation);
});

##Supported Languages

LanguageDirections
ar (Arabic)
az (Azerbaijani)
be (Belarusian)
bg (Bulgarian)
ca (Catalan)
cs (Czech)
da (Danish)
de (German)
el (Greek)
en (English)
es (Spanish)
et (Estonian)
fi (Finnish)
fr (French)
he (Hebrew)
hr (Croatian)
hu (Hungarian)
hy (Armenian)
it (Italian)
ka (Georgian)
lt (Lithuanian)
lv (Latvian)
mk (Macedonian)
nl (Dutch)
no (Norwegian)
pl (Polish)
pt (Portuguese)
ro (Romanian)
ru (Russian)
sk (Slovak)
sl (Slovenian)
sq (Albanian)
sr (Serbian)
sv (Swedish)
tr (Turkish)
uk (Ukrainian)
az-ru
be-bg
be-cs
be-de
be-en
be-es
be-fr
be-it
be-pl
be-ro
be-ru
be-sr
be-tr
bg-be
bg-ru
bg-uk
ca-en
ca-ru
cs-be
cs-en
cs-ru
cs-uk
da-en
da-ru
de-be
de-en
de-es
de-fr
de-it
de-ru
de-tr
de-uk
el-en
el-ru
en-be
en-ca
en-cs
en-da
en-de
en-el
en-es
en-et
en-fi
en-fr
en-hu
en-it
en-lt
en-lv
en-mk
en-nl
en-no
en-pt
en-ru
en-sk
en-sl
en-sq
en-sv
en-tr
en-uk
es-be
es-de
es-en
es-ru
es-uk
et-en
et-ru
fi-en
fi-ru
fr-be
fr-de
fr-en
fr-ru
fr-uk
hr-ru
hu-en
hu-ru
hy-ru
it-be
it-de
it-en
it-ru
it-uk
lt-en
lt-ru
lv-en
lv-ru
mk-en
mk-ru
nl-en
nl-ru
no-en
no-ru
pl-be
pl-ru
pl-uk
pt-en
pt-ru
ro-be
ro-ru
ro-uk
ru-az
ru-be
ru-bg
ru-ca
ru-cs
ru-da
ru-de
ru-el
ru-en
ru-es
ru-et
ru-fi
ru-fr
ru-hr
ru-hu
ru-hy
ru-it
ru-lt
ru-lv
ru-mk
ru-nl
ru-no
ru-pl
ru-pt
ru-ro
ru-sk
ru-sl
ru-sq
ru-sr
ru-sv
ru-tr
ru-uk
sk-en
sk-ru
sl-en
sl-ru
sq-en
sq-ru
sr-be
sr-ru
sr-uk
sv-en
sv-ru
tr-be
tr-de
tr-en
tr-ru
tr-uk
uk-bg
uk-cs
uk-de
uk-en
uk-es
uk-fr
uk-it
uk-pl
uk-ro
uk-ru
uk-sr
uk-tr

Yandex terms of use