File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # > translate.py
2+
3+ Translate ` en/messages.json ` to other locales automatically.
4+
5+ ## Installation
6+
7+ ``` bash
8+ pip install translate.py
9+ ```
10+
11+ ## Usage
12+
13+ Run the CLI:
14+ ``` bash
15+ translate-msgs
16+ ```
17+
18+ If no options are provided, the CLI will:
19+ 1 . Prompt for ` en/messages.json ` keys to ignore
20+ 2 . Search for closest ` _locales ` directory
21+ 3 . Translate ` en/messages.json ` to target languages
22+
23+ ## Options
24+
25+ Options can be set using command-line arguments:
26+
27+ | Option | Description |
28+ | ----------------- | ---------------------------------------------------------------- |
29+ | ` --include-langs ` | Comma-separated list of languages to include (e.g. `en,es,fr") |
30+ | ` --exclude-langs ` | Comma-separated list of languages to exclude (e.g. ` en,es ` ) |
31+ | ` --ignore-keys ` | Comma-separated list of keys to ignore (e.g. ` appName,author ` ) |
32+ | ` --locales-dir ` | Name of the folder containing locale files (default: ` _locales ` ) |
33+ | ` --provider ` | Translation provider to use |
34+ | ` --init ` | Create a .config.json file to store your defaults |
35+ | ` --no-wizard ` | Skip interactive prompts during start-up |
36+
37+ ## Config file
38+
39+ - Use ` --init ` to create ` translate.py.config.json ` in your project root to set default options
40+ - CLI arguments always override config file
41+
42+ ## Example
43+
44+ ``` bash
45+ translate-msgs --include-langs=fr,es --ignore-keys=appName,author
46+ ```
Original file line number Diff line number Diff line change 11[project ]
22name = " translate-messages"
3- version = " 0 .0.2 "
4- description = " Translate en/messages.json to other locales. Type translate-messages --help to view options."
3+ version = " 1 .0.0 "
4+ description = " Translate en/messages.json to other locales. Type translate-msgs --help to view options."
55authors = [{name = " Adam Lui" , email = " adam@kudoai.com" }]
6- include = [" LICENSE.md" ]
76dependencies = [" requests>=2.32.0,<3.0.0" , " translate>=3.8.0,<4.0.0" ]
87
98[project .scripts ]
10- translate-messages = " translate_messages.__main__:main"
9+ translate-msgs = " translate.__main__:main"
10+ translate-messages = " translate.__main__:main"
11+
12+ [tool .setuptools .packages .find ]
13+ where = [" ." ]
1114
1215[tool .setuptools .package-data ]
13- translate_messages = [" package-data.json " ]
16+ "*" = [" *.md " ]
You can’t perform that action at this time.
0 commit comments