Skip to content

Translations as gettext PO files for all languages - #170

Merged
Pyrdacor merged 2 commits into
ccr-2fc89da9-nuligbfrom
ccr-2fc89da9-nuligb-po
Nov 22, 2026
Merged

Pyrdacor merged 2 commits into
ccr-2fc89da9-nuligbfrom
ccr-2fc89da9-nuligb-po

Conversation

@Pyrdacor

@Pyrdacor Pyrdacor commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

All translations of Ambermoon become gettext PO files, the same approach as Amberstar.net. Translators can use Poedit, Weblate, Crowdin and similar tools instead of thousands of text files. When an English text changes, the translation is marked fuzzy automatically. This PR also fixes obvious errors in the existing translations.

Stacked on #169 (Spanish translation). Merge #169 first, then this PR is retargeted to master.

Translations/PO

File Content
ambermoon.pot template with all 3741 texts (English)
de.po, fr.po, cs.po, pl.po, es.po one file per language
  • Entry format:
    • msgctxt is the file of the text (AllTexts/NPC_texts.amb/001/001, IntroTexts/…, ExtroTexts/…) or the section and line of the remake texts (Remake/Tutorial texts/003).
    • msgid is the English text, msgstr the translation.
    • The comments say what the text is, the usual length of that kind of text, what the placeholders mean, and give the German original.
  • Markup: the game's markup (^, $, ~LEAD~, {0}) stays as it is.
  • Empty msgstr: means not translated. No file is written for it, and the game keeps the German base text.

Translations/po.py (Python 3, no dependencies)

  • extract: writes the template.
  • export <lang>: creates a PO file from the text folders. This was used once for the migration.
  • import <lang>|--all: writes Disks/Bugfixing/<Language>/… from the PO file. Existing files keep their BOM and line end.
  • update <lang>|--all: merges with a new template. Changed English texts become fuzzy, and removed ones become obsolete.
  • check <lang>|--all: reports changed placeholders and line breaks, unusual lengths, missing intro/extro glyphs and fuzzy entries, and shows statistics.
  • verify: checks that the template and all text folders are up to date with the PO files.

Migration

  • German, French, Czech, Polish: importing the PO files gave the existing files byte for byte before the fixes below.
    • Texts that exist only in one language, such as Polish extra extro lines, are kept as entries marked Only in this translation.
  • Spanish: the texts now live only in es.po. Translations/Spanish/{AllTexts,IntroTexts,ExtroTexts,RemakeTranslatableTexts.txt} and the old helper scripts are removed.
    • Disks/Bugfixing/Spanish is written by import es. The game texts keep their accents (the release creator removes them with -u); only ¿ ¡ are removed.

Fixed in the existing translations (second commit)

  • Quotation marks: 77 texts had a missing, doubled or extra " compared with the English text. Typical cases:
    • a speech ends without its closing quote;
    • a stray quote before ^ where the speech continues in the next paragraph;
    • "" or "." at the end;
    • an extra opening quote after ^ on signs.
    • French, Czech and Polish are affected, plus 2 texts of the German original (2Map_texts 288/005, 3Map_texts 344/002). Each automatic fix changes exactly one character; 7 cases were fixed by hand.
  • Junk after a NUL byte: 33 texts had leftover bytes at the end of the text (\0 STOP., \0 \x1a, \0 4, and \0\0\0\0\x05 in a French automap label). Affected: Czech, German, French.
  • Czech:
    • broken placeholder ~SEX2 popel → ~SEX2~ popel (Messages/255);
    • ~INK 17~ → ~INK17~ in the remake outro, as in the English;
    • 3 strings in RemakeTranslatableTexts.txt without closing quote, and a stray quote inside a tutorial string. These broke the C# syntax.
  • Polish:
    • typo podšża → podąża in the intro (š has no glyph in the font);
    • a ^ that had become ." before ~INK 31~ (NPC_texts 065/001).
  • French: 4 texts still contained untranslated English sentences (2Map_texts 293/004, 416/016, 423/001, 437/002). They are translated in the style of the French translation.
  • Czech and Polish intro/extro fonts: they now have a glyph for ", made of two apostrophes. The extro uses " in 8 Czech and 6 Polish lines, which were shown without quotes before.

Not changed, because they are a matter of translation and not obvious errors:

  • different line breaks, mostly in Polish;
  • ~SEX1~/~SEX2~ used differently because of grammar;
  • names longer than the English ones;
  • a few placeholders the translators left out on purpose.

check still lists them as warnings.

CI

  • release.yml: runs po.py import --all before the release creator.
  • New translations.yml: runs po.py verify for pull requests and pushes that touch Translations/** or Disks/Bugfixing/**, and prints check --all as information.

Tests

  • python3 Translations/po.py verify: template and all 5 languages up to date.
  • python3 Translations/po.py check --all: 0 errors in all languages; only warnings remain.
  • All PO files are parsed without errors by polib.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QGvkG5Uoa8unp8Sx5tBxho

Translations/PO holds the template (ambermoon.pot, the English texts) and one
PO file per language (de, fr, cs, pl, es). msgctxt is the file of the text,
msgid the English text; the comments give the kind of text, the usual length,
the meaning of the placeholders and the German original.

Translations/po.py writes the template (extract), creates PO files from the
text folders (export), writes the text folders of the release from the PO
files (import; existing files keep their BOM and line end), merges a PO file
with a new template (update: changed texts become fuzzy), checks a
translation (check: placeholders, line breaks, lengths, intro/extro glyphs)
and checks that everything is up to date (verify).

Importing the PO files gives the existing texts of German, French, Czech and
Polish byte for byte. The Spanish texts now live only in es.po; the game texts
in Disks/Bugfixing/Spanish keep their accents (the release creator removes
them), only ¿ ¡ are removed. The Spanish intro/extro font gets the glyph ".

The release workflow imports the PO files before it builds the releases, and
the new workflow translations runs verify for pull requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGvkG5Uoa8unp8Sx5tBxho
- quotes: 77 texts with a missing, doubled or extra quotation mark compared
  with the English text (French, Czech, Polish; 2 in the German original)
- junk after a NUL byte at the end of 33 texts (\0 STOP., \0 \x1a, ...)
- Czech: broken placeholder ~SEX2 (Messages/255), ~INK 17~ -> ~INK17~ in the
  remake outro, 3 remake strings without closing quote, a stray quote in a
  remake string (broke the C# syntax)
- Polish: typo podšża -> podąża (intro), missing line break before ~INK 31~
- French: untranslated English sentences in 4 texts translated
- Czech and Polish intro/extro fonts: glyph for " (used by the extro, was
  missing)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGvkG5Uoa8unp8Sx5tBxho
@Pyrdacor
Pyrdacor merged commit aae86b6 into ccr-2fc89da9-nuligb Nov 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants