1.1.4 • Published 5 years ago

i18n-json-tool v1.1.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Description

i18n-translate-tool was built out of the necessity to leverage internationalization before the copywriters are done translating your strings. It allows you to leverage either a CLI interface, or translate on the fly within your app returning you a JSON copy of whatever you give it.

Currently it supports:

  • Yandex Translation API
  • Google Translate
  • Bing Translate

Examples

CLI Usage

  Usage: translate [options] <file>

  Options:
    -s, --service <service>    google, yandex or bing
    -k, --key <key>            API key
    -i, --iso <code>           isoCode to translate to
    -r, --regexp <expression>  regular expression to filter interpolations
    -h, --help                 output usage information

example execution

translate ./example/en.json -i nl -k some_key -r "{{([^}]+?)}}"

In the above example following string will be translated:

"n2": "with {{some}} regexs in it"

to dutch

 "n2": "met {{some}} regexs in het"

As you can see the regex allows interpolations to stay intact while translating.

Web Usage

import translate from "i18n-json-tool";
const translations = {
    key1: "Hello world!"
};
translate({
    apiKey,
    isoCode: "nl",
    translations,
    service, // defaults to yandex (optional)
    regexp // defaults to nothing (optional)
}).then(results => console.log(results));

Roadmap

  • Create website example for translating through an interface

Contributing

Please feel free to open any tickets with feature requests but make sure to document:

  • Use case
  • Reasoning
1.1.4

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.2

6 years ago