https://github.com/ogty/tools-for-i18n
🌐 Useful tools for internationalization support. Can convert from yaml files and create tables. Additional languages can also be automatically translated.
https://github.com/ogty/tools-for-i18n
automatic-translation command-line-tool i18n internationalization translation
Last synced: 4 months ago
JSON representation
🌐 Useful tools for internationalization support. Can convert from yaml files and create tables. Additional languages can also be automatically translated.
- Host: GitHub
- URL: https://github.com/ogty/tools-for-i18n
- Owner: ogty
- License: mit
- Created: 2022-07-31T12:08:15.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-22T10:20:20.000Z (almost 3 years ago)
- Last Synced: 2025-06-22T00:30:54.002Z (4 months ago)
- Topics: automatic-translation, command-line-tool, i18n, internationalization, translation
- Language: Python
- Homepage:
- Size: 974 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Tools for i18n
## 🎈 Feature
- ✅ Segment translation files into their respective languages
- ✅ Restoring a segmented translation file back to its original file
- ✅ Automatic translation of additional language## ⚙️ Setup
```zsh
$ git clone https://github.com/ogty/tools-for-internationalization
$ source ./tools-for-internationalization/setup.sh # or make
```## 📖 Usage
```
$ i18n [options]
```> **Note**
> To change the output format of the table, you need to replace the commented out variables in `settings.py`.## 🤖 Commands
| Command | Description |
| --------- | ----------------------------------------------------------------------- |
| `segment` | Commands to segment translation files into their respective languages |
| `revgene` | Command to convert a segmented translation file into a yaml file |
| `table` | Command to create a table from segmented translation data |
| `help` | Commands to display usage, etc. |## 🔍 Options
| Name | Argument | Commands |
| ------------------------------ | ------------------ | ----------------------- |
| `-f, --file` | `` | segment, revgene, table |
| `-o, --output` | `` | segment, revgene, table |
| `-l, --languages` | `` | segment, table |
| `-al, --additonal_language` | `` | revgene |
| `-d, --directory` | `` | revgene |
| `-at, --automatic_translation` | - | revgene |
| `-s, --show` | - | table |## ✏️ Example
**Segment the translation file into each language**
```zsh
$ i18n segment -f ./sample/public/locales/i18n.yaml -l ja en -o ./sample/public/locales
```**Generate the original translation file (yaml) from the segmented translation file (json)**
```zsh
$ i18n revgene -d ./sample/public/locales -f translations.json -o i18n.yaml
```**Output translation files to a file as a table**
```zsh
$ i18n table -f ./sample/public/locales/i18n.yaml -l ja en -o i18n.md
```**Add new languages to the translation file and output as a table**
```zsh
$ i18n revgene -d ./sample/public/locales -f translations.json -al fr -o i18n.yaml && \
i18n table -f ./sample/public/locales/i18n.yaml -l ja en fr -o i18n.md
```## 🖨️ Output
**`./sample/index.html`**

> **Note**
> If you want to change the design of the output table, please modify the `templates/html.tpl` file