google-auto-translate
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

google-auto-translate

Translate language files using google translate service. This module improves performance and decrases rate limit usage by working with file diffs only.

Note: This module is not stable yet, use with caution.

Install

npm install google-auto-translate

Usage

CLI

.\node_modules\.bin\google-auto-translate [apiKey] [inputFile] [inputLanguageIsoKey] [generatedFilesDir] [targetLanguage1,targetLanguage2,...]
.\node_modules\.bin\google-auto-translate [apiKey] ./en.json en ./ de,fr,it
  • apiKey: Your google translate api key
  • inputFile: Source language json file from which the target languages will be generated from. Must be an object like the following:
{
  "USER_HEADER": "English Header Value",
  "ADMIN_AREA": {
    "SECTION_1": {
      "USER_GREETING": "Hello user",
      "USER_DELETE_CONFIRM_TEXT": "Are you sure to delete the user?"
    }
  }
}
  • inputLanguageIsoKey: Input file language key, example: en
  • generatedFilesDir: Location of the generated files.
  • targetLanguage1,targetLanguage2,...: ISO language keys of the generated languages, examples:

Todos

  • Rate Limiting (Currently google quota has 100.000 characters every 100 seconds)
  • Unit Tests
  • Better/More unit testable code structure

Package Sidebar

Install

npm i google-auto-translate

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

18.2 kB

Total Files

9

Last publish

Collaborators

  • havsar