https://github.com/siposdani87/i18nature-cli
This CLI helps to initialize, upload and download your translation files on I18Nature localization cloud. Generate project_api_key to add access to the project via CLI. You can handle multiple translation files in one project.
https://github.com/siposdani87/i18nature-cli
cli i18n i18nature internationalization l10n localization translation
Last synced: 6 months ago
JSON representation
This CLI helps to initialize, upload and download your translation files on I18Nature localization cloud. Generate project_api_key to add access to the project via CLI. You can handle multiple translation files in one project.
- Host: GitHub
- URL: https://github.com/siposdani87/i18nature-cli
- Owner: siposdani87
- License: bsd-3-clause
- Created: 2021-10-20T22:50:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-19T15:26:46.000Z (almost 2 years ago)
- Last Synced: 2025-03-16T18:34:32.717Z (over 1 year ago)
- Topics: cli, i18n, i18nature, internationalization, l10n, localization, translation
- Language: TypeScript
- Homepage: https://i18nature.com
- Size: 448 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# I18Nature-CLI
[](https://www.npmjs.com/package/i18nature-cli)
[](https://www.npmjs.com/package/i18nature-cli)
[](./LICENSE)
[](https://sonarcloud.io/summary/new_code?id=siposdani87_i18nature-cli)
Command-line tool to initialize, upload and download translation files to I18Nature localization platform ([https://i18nature.com](https://i18nature.com)).
## Usage
There is a variety of ways to use/install. The quickest way is:
```bash
npm install -g i18nature-cli
i18nature --help
```
### How to install/run using `npm`
#### Using `npm`
```bash
# Via npm init
npm init i18nature-cli --help
# Via npx
npx i18nature-cli --help
# Install globally
npm install -g i18nature-cli
i18nature --help
```
## Command line arguments
```bash
Command-line tool of I18Nature localization tool.
Usage: i18nature [args]
Commands:
i18nature init [project_api_key] Create .i18naturerc.json file.
i18nature upload Upload translation files.
i18nature download Download translation files.
Options:
-h, --help Show help [boolean]
--version Show version number [boolean]
-v, --verbose Run with verbose logging [boolean]
-y, --yes Skip prompts [boolean]
--debug Debug mode [boolean]
--overwriteTranslations Overwrite translation files on upload [boolean]
for more information, find our website at https://i18nature.com
```
## Creating a config file for I18Nature project
When creating a config file, you may provide or generate a `api_key` of your project from [I18Nature](https://i18nature.com). With CLI, you can initialize `.i18naturerc.json` config file. This file contains your list of your translation files. The translation file has many properties like (`id, name, filename, extension, locales, default_locale, wrapper_key, directory`).
🔴 **IMPORTANT**: You can use `%language` and `%locale` placeholder keys in `filename, wrapper_key, directory` properties.
🔴 **SECURITY**: Add `.i18naturerc.json` to your `.gitignore` file to avoid accidentally committing your API key to version control.
```gitignore
# .gitignore
.i18naturerc.json
```
Supported locales: ['sq-AL', 'ar-DZ', 'ar-BH', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-OM', 'ar-QA', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-AE', 'ar-YE', 'be-BY', 'bn-IN', 'bn-BD', 'bg-BG', 'ca-ES', 'zh-CN', 'zh-HK', 'zh-SG', 'zh-TW', 'hr-HR', 'cs-CZ', 'da-DK', 'nl-BE', 'nl-NL', 'en-AU', 'en-CA', 'en-IN', 'en-IE', 'en-MT', 'en-NZ', 'en-PH', 'en-SG', 'en-ZA', 'en-GB', 'en-US', 'et-EE', 'fi-FI', 'fr-BE', 'fr-CA', 'fr-FR', 'fr-LU', 'fr-CH', 'de-AT', 'de-DE', 'de-LU', 'de-CH', 'el-CY', 'el-GR', 'iw-IL', 'hi-IN', 'hu-HU', 'is-IS', 'in-ID', 'ga-IE', 'it-IT', 'it-CH', 'ja-JP', 'ko-KR', 'lv-LV', 'lt-LT', 'mk-MK', 'ms-MY', 'mt-MT', 'no-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sr-BA', 'sr-ME', 'sr-CS', 'sr-RS', 'sk-SK', 'sl-SI', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-DO', 'es-EC', 'es-SV', 'es-GT', 'es-HN', 'es-MX', 'es-NI', 'es-PA', 'es-PY', 'es-PE', 'es-PR', 'es-ES', 'es-US', 'es-UY', 'es-VE', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN']
### Translation file properties
| Property | Type | Description |
| ---------------- | --------- | ---------------- |
| id ** | String | unique identifier of translation file from i18nature |
| name * | String | your translation file short description |
| filename * | String | name of the file |
| extension * | String | eg.: json, yml, yaml, toml, arb, po, xml, strings, ini, properties |
| locales * | String[] | list of locales like ['en-GB', 'hu-HU'] |
| default_locale * | String | default locale e.g.: 'en-GB' |
| wrapper_key | String | first key in content of translation file e.g.: %language or %locale |
| directory * | String | relative path to translation files |
**not required for first upload, but required for upload and download actions
*required properties
### Locale directory hierarchy
⚠️ **WARNING**: You can use `language` (en) and `locale` (en-GB) placeholder keys in directory, filename as well.
Example project structure in this repository:
```text
exammple/
i18n/
en/
common.json
hu/
common.json
locales/
base_en-GB.yml
base_hu-HU.yml
...
.i18naturerc.json
...
```
Example .i18naturerc.json for example directories
```json
{
"version": 1,
"project_api_key": "API_KEY",
"translation_files": [
{
"name": "Base",
"filename": "base_%locale",
"extension": "yml",
"wrapper_key": "%language",
"locales": ["en-GB", "hu-HU"],
"default_locale": "en-GB",
"directory": "example/locales"
},
{
"name": "Common",
"filename": "common",
"extension": "json",
"locales": ["en-GB", "hu-HU"],
"default_locale": "en-GB",
"directory": "example/i18n/%language/"
}
]
}
```
Create config file will copy the content to your project directory, and modify the `.i18naturerc.json` in the root folder.
See this [repository](https://github.com/siposdani87/i18nature-cli) for a complete example.
## License
[ISC](./LICENSE)
## Developer
[Dániel Sipos](https://siposdani87.com)
## Sponsors
This project is generously supported by [TrophyMap](https://trophymap.org), [I18Nature](https://i18nature.com), and several other amazing organizations.