1.1.4 • Published 4 months ago

@steadycursor/i18n-gpt-translate v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

i18n-gpt-translate

A CLI tool for translating internationalization (i18n) json files using Open AI.

Run with script with command i18n-gpt-translate.

preview

Features

  • Automatically translates missing keys and and also it translate values, where value is empty ("").
  • Translate as many json files for as many languages as you wish.
  • You do not need to specify what languages do you have, script will automatically detect it.

Options

  • --localesPath (required) - path to folder, where your locales folders (en, fr, it, etc.) exists.
  • --defaultLanguage (required) - default language, that will be used as source for translation. This has to be one of the folders of --localesPath.
  • --token (required) - ChatGPT token, that you can generate here.

Installation

npm install @steadycursor/i18n-gpt-translate

Example Usage

i18n-gpt-translate run --localesPath=./tests/working/locales --defaultLanguage=en --token=YOUR_TOKEN_HERE

Demo

Before running script

# /locales/en/common.json
{
  "AccountsCommandPalette": {
    "inputPlaceholder": "Account name...",
    "noResults": {
      "title": "No results found"
    }
  },
  "AccountSetting": {
    "enableDeviceSosImporter": {
      "card": {
        "description": "This setting affects whether devices available on platform will be automatically registered in this CMS.",
        "title": "Setting up automatic device importing"
      }
    }
  }
}
# /locales/cs/common.json
{
  "AccountsCommandPalette": {
    // 👉 missing key inputPlaceholder with translation
    "noResults": {
      "title": "Nebyly nalezeny žádné výsledky"
    }
  },
  "AccountSetting": {
    "enableDeviceSosImporter": {
      "card": {
        "description": "", // 👈 translation is missing, value is empty
        "title": "Nastavení automatického importu zařízení"
      }
    }
  }
}

After running script

# /locales/cs/common.json
{
  "AccountsCommandPalette": {
    "inputPlaceholder": "Název účtu...", 👈
    "noResults": {
      "title": "Nebyly nalezeny žádné výsledky"
    }
  },
  "AccountSetting": {
    "enableDeviceSosImporter": {
      "card": {
        "description": "Toto nastavení ovlivňuje, zda zařízení dostupná na platformě budou automaticky registrována v tomto CMS.", 👈
        "title": "Nastavení automatického importu zařízení"
      }
    }
  }
}
1.1.4

4 months ago

1.1.3

12 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago