mirror of
https://github.com/SillyTavern/SillyTavern-i18n.git
synced 2026-10-15 18:11:54 +00:00
Tools for working with frontend localization files.
- Python 100%
|
|
||
|---|---|---|
| generate.py | ||
| LICENSE | ||
| README.md | ||
| requirements.txt | ||
| update-i18n(zh-cn,tw).py | ||
SillyTavern-i18n
Tools for working with frontend localization files.
Features
- Automatically add new keys from HTML
data-i18nattributes. - Extract keys from scripts (
ttemplate tag andtranslate(...)). - Prune missing keys from localization files.
- Use automatic Google translation to auto-populate missing values.
- Sort JSON files by project tree order (source path + first appearance in file).
Usage
usage: generate.py [-h] [-d DIRECTORY] [--auto-add] [--auto-translate] [--auto-remove] [--sort-keys]
json
Update or Generate i18n JSON files
positional arguments:
json JSON file path
options:
-h, --help show this help message and exit
-d DIRECTORY, --directory DIRECTORY
Directory path
--auto-add Auto add missing keys
--auto-translate Auto translate missing keys when they are added
--auto-remove Auto remove extra keys
--sort-keys Sort keys by project tree order (source path + first appearance in file)
Dependencies: Python 3.10 and up.
- Install the requirements.
pip install -r ./requirements.txt
- Run
generate.pywhile in the SillyTavern directory.
Example (update for zh-cn file, sort keys):
cd ~/SillyTavern
python ~/SillyTavern-i18n/generate.py zh-cn --sort-keys
- Commit and PR changes to the SillyTavern repository.
License and credits
AGPLv3
- Original idea and implementation by Zhongyi-Lu
- Improvements by steve02081504