Socket
Socket
Sign inDemoInstall

i18n-json-tool

Package Overview
Dependencies
9
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    i18n-json-tool

Convert JSON i18n files via the yandex api for quick internationalization testing


Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Install size
2.11 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 20 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc