Skip to content

Commit ef59f04

Browse files
refactor(scripts): move bin to scripts directory
1 parent 3c831da commit ef59f04

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

TRANSLATIONS.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,45 @@ The translation files are packaged internally within `src/edit_python_pe/locale/
66
## General Workflow
77

88
### 1. Generating or Updating `.po` files (`makemessages`)
9+
910
When you add new `_("...")` strings in the source code, run:
11+
1012
```bash
1113
uv run poe makemessages
1214
```
15+
1316
This automatically extracts all translation strings from `src/edit_python_pe/` into `messages.pot` and **updates all existing locales** (e.g. `es`, `fr`, etc.) with the new strings, keeping existing translations intact.
1417

1518
### 2. Compiling `.mo` files (`compilemessages`)
19+
1620
After you finish translating the `.po` files, you must compile them into the binary `.mo` format so the application can read them.
21+
1722
```bash
1823
uv run poe compilemessages
1924
```
25+
2026
This command compiles all languages in the `locale` directory simultaneously.
2127

2228
---
2329

2430
## Adding a New Language
2531

2632
If you want to add an entirely new language (for example, German `de`), use the `messages:init` command:
33+
2734
```bash
2835
uv run poe messages:init --lang de
2936
```
37+
3038
This extracts the strings and initializes the completely new directory `src/edit_python_pe/locale/de/LC_MESSAGES/messages.po`.
3139

3240
---
3341

3442
## Auto-Translating via Google Translate
3543

36-
The project includes an automatic translation script (`bin/translate.py`) powered by `deep-translator`. If you wish to automatically translate an existing `.po` file (e.g. for French `fr`), run:
44+
The project includes an automatic translation script (`scripts/translate.py`) powered by `deep-translator`. If you wish to automatically translate an existing `.po` file (e.g. for French `fr`), run:
45+
3746
```bash
3847
uv run poe messages:translate --lang fr
3948
```
49+
4050
*Note: This will overwrite empty `msgstr` entries in the `.po` file using Google Translate. Remember to run `poe compilemessages` after doing this to generate the updated `.mo` file!*

bin/test.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ sequence = [
102102
]
103103

104104
[tool.poe.tasks."messages:translate"]
105-
cmd = "uv run python bin/translate.py src/edit_python_pe/locale/${lang}/LC_MESSAGES/messages.po ${lang}"
105+
cmd = "uv run python scripts/translate.py src/edit_python_pe/locale/${lang}/LC_MESSAGES/messages.po ${lang}"
106106
args = [{ name = "lang", options = ["--lang"], required = true }]
107107

108108
[tool.poe.tasks.makemessages]
@@ -143,6 +143,9 @@ ignore = [
143143
"S101", # Use of assert detected (often used in tests)
144144
]
145145

146+
[tool.ruff.lint.per-file-ignores]
147+
"tests/*" = ["S105", "S108", "E501"]
148+
146149
[tool.ruff.lint.isort]
147150
known-first-party = ["edit_python_pe"]
148151
known-third-party = ["github", "pygit2", "textual", "yaml"]
File renamed without changes.

0 commit comments

Comments
 (0)