add-string: check the arguments before translating anything

The command splits $1/$2/$3 off the invocation positionally and then states them
as fact, so calling it with a sentence rather than `/add-string <Section> "<Key>"`
yields three arbitrary words - and nothing downstream notices. Ask for them to be
checked against en_US.ini first, and to re-derive the real section and key from
the request if they don't hold up.

Also spell out, in both the command and docs/translations.md, that the en_US line
in the scratch file overwrites en_US.ini like any other language, so for an
existing key it has to match the current English text exactly - otherwise it
quietly rewords the string every other language was translated from.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GgACRqkQNpfJQ4fjwyoEup
This commit is contained in:
Henrik RydgårdandClaude Opus 5 committed 2026-09-07 09:04:26 -06:00
1 parent 2b16e107b9
commit 3af6080075
2 files changed
+17 -2

No files matched your search

+13 -2
View File
@@ -10,6 +10,14 @@ Add and/or translate a PPSSPP UI string.
- English string: `$3` - if this is empty, the key already exists in `assets/lang/en_US.ini` and
you're only filling in the languages where it's still untranslated.
Those three are split off the invocation positionally, so they're only right if it was called as
`/add-string <Section> "<Key>" ["<English string>"]`. Called with a sentence instead, they'll be
three arbitrary words - so **check them before you touch anything**: `$1` has to be a real `[Section]`
in `assets/lang/en_US.ini`, and `$2` a key that exists under it (or, for a new string, one that
doesn't exist anywhere yet and that you can find in the C++). If they don't hold up, work out the
real section and key from what was actually asked for, say which values you settled on, and carry on
from there - don't translate whatever the positional split happened to produce.
Follow the workflow in docs/translations.md. Run langtool from
`Tools/langtool`:
@@ -36,8 +44,11 @@ Follow the workflow in docs/translations.md. Run langtool from
One line per language, named after the ini file minus the extension (`lt-LT`, `he_IL_invert`,
`zh_TW`, ...), plus an `en_US` line carrying the English string itself if you were given one -
that's what creates the key in `en_US.ini`. No trailing `# comments` on those lines, they'd end
up inside the translation. Placeholders like `%1` and `%d` have to appear verbatim in the
that's what creates the key in `en_US.ini`. For a key that already exists, that line has to be
the existing English text character for character: it overwrites `en_US.ini` like any other
language, so a stray reword there silently changes the source string every other language was
translated from. Diff `en_US.ini` afterwards to confirm it didn't move.
No trailing `# comments` on those lines, they'd end up inside the translation. Placeholders like `%1` and `%d` have to appear verbatim in the
translation, in whatever position the target language needs them.
**If you don't know a language well enough to be confident, leave it out.** A key that's missing
+4
View File
@@ -21,6 +21,10 @@ from `Tools/langtool`:
sv_SE = Teststräng
lt-LT = Testeilutė
```
For a key that already exists, the `en_US` line has to be the current English text character for
character - it overwrites `en_US.ini` like any other language, so a stray reword there quietly
changes the string all the others were just translated from. Diff `en_US.ini` afterwards to check
it didn't move.
No trailing `# comments` on those lines, they'd end up inside the translation. Placeholders have to
survive verbatim. If you don't know a language well enough, leave it out - a key that's missing from
a language file falls back to the English string at runtime, which is much better than a confident