mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
add-string: read the invocation instead of splitting it
The command took $1/$2/$3 off the front of whatever was typed, so it only got the right section and key when called in exactly the documented shape. Called with a sentence - which is the natural way to ask for this - it silently produced three arbitrary words, and a paragraph warning about that is a poor substitute for not doing it. It now gets $ARGUMENTS whole and works the three values out, which is the part that needed a model anyway. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
32017202bf
commit
f6655d8b62
1 file changed
+20
-16
@@ -5,18 +5,22 @@ argument-hint: <Section> "<Key>" ["<English string>"]
|
|||||||
|
|
||||||
Add and/or translate a PPSSPP UI string.
|
Add and/or translate a PPSSPP UI string.
|
||||||
|
|
||||||
- Section: `$1`
|
What was asked for: `$ARGUMENTS`
|
||||||
- Key: `$2`
|
|
||||||
- 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
|
Work out three things from that, and **say which values you settled on before you touch anything**:
|
||||||
`/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]`
|
- **Section** - a `[Section]` that exists in `assets/lang/en_US.ini`. Check that it does.
|
||||||
in `assets/lang/en_US.ini`, and `$2` a key that exists under it (or, for a new string, one that
|
- **Key** - for a new string this is the English text itself, which is how keys are written here; for
|
||||||
doesn't exist anywhere yet and that you can find in the C++). If they don't hold up, work out the
|
an existing one it is the key as `en_US.ini` spells it, character for character.
|
||||||
real section and key from what was actually asked for, say which values you settled on, and carry on
|
- **English string** - only for a new key. If the key is already in `en_US.ini` there is no English
|
||||||
from there - don't translate whatever the positional split happened to produce.
|
string to pass, and the job is filling in the languages where it is still untranslated.
|
||||||
|
|
||||||
|
The invocation may be `<Section> "<Key>" ["<English string>"]`, or an ordinary sentence naming the
|
||||||
|
section and the string, or just the string. Read it, don't split it on whitespace and hope: three
|
||||||
|
words off the front of a sentence are three arbitrary words, and translating those quietly writes
|
||||||
|
rubbish into 47 files. When the section or key isn't stated outright, find them - grep the C++ for
|
||||||
|
the string to see which `GetI18NCategory` it belongs to, and `en_US.ini` for whether the key is
|
||||||
|
already there. Ask only if that leaves it genuinely ambiguous.
|
||||||
|
|
||||||
Follow the workflow in docs/translations.md. Run langtool from
|
Follow the workflow in docs/translations.md. Run langtool from
|
||||||
`Tools/langtool`:
|
`Tools/langtool`:
|
||||||
@@ -60,15 +64,15 @@ Follow the workflow in docs/translations.md. Run langtool from
|
|||||||
with a `# same as English` comment, which is what stops langtool from trying to translate it
|
with a `# same as English` comment, which is what stops langtool from trying to translate it
|
||||||
again on every later run.
|
again on every later run.
|
||||||
|
|
||||||
3. `cargo run -- import-single <scratch-file> "$1" "$2"`
|
3. `cargo run -- import-single <scratch-file> "<Section>" "<Key>"`
|
||||||
|
|
||||||
Note this overwrites any existing value for that key, so if the key already had human
|
Note this overwrites any existing value for that key, so if the key already had human
|
||||||
translations, check what you're about to replace first. The section has to exist already.
|
translations, check what you're about to replace first. The section has to exist already.
|
||||||
|
|
||||||
4. `cargo run -- add-new-key "$1" "$2"` - **always, every language file ends up with the key.** This
|
4. `cargo run -- add-new-key "<Section>" "<Key>"` - **always, every language file ends up with the
|
||||||
writes `Key = Key` (plain English, no `# same as English` marker, so it still reads as
|
key.** This writes `Key = Key` (plain English, no `# same as English` marker, so it still reads
|
||||||
outstanding work) into every language you skipped, and leaves the ones you translated alone. A
|
as outstanding work) into every language you skipped, and leaves the ones you translated alone.
|
||||||
missing key would fall back to the English string at runtime anyway, but then it looks exactly
|
A missing key would fall back to the English string at runtime anyway, but then it looks exactly
|
||||||
like a translated one in the files, and translators can't see what's left to do.
|
like a translated one in the files, and translators can't see what's left to do.
|
||||||
|
|
||||||
Don't reach for `copy-missing-lines` to do this - it fills in placeholders repo-wide, and drags
|
Don't reach for `copy-missing-lines` to do this - it fills in placeholders repo-wide, and drags
|
||||||
|
|||||||
Reference in new issue
Block a user