Skip to content

Commit bec2e8b

Browse files
committed
Renamed to translate-messages ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/translate-messages]
1 parent a99d5ec commit bec2e8b

3 files changed

Lines changed: 54 additions & 5 deletions

File tree

translate-messages/docs/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
```

translate-messages/pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
[project]
22
name = "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."
55
authors = [{name = "Adam Lui", email = "adam@kudoai.com"}]
6-
include = ["LICENSE.md"]
76
dependencies = ["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"]

translate-messages/twine

Whitespace-only changes.

0 commit comments

Comments
 (0)