Translation Guide
Thank you for your interest in translating Paperback! This page walks you through how to start a brand new translation, how to keep it updated when new strings land, and how to submit your work.
Prerequisites: Install the gettext tools (xgettext, msgmerge, msgfmt) and ensure they are available on your PATH.
All translation files live in the po directory. The template file is paperback.pot, and each language is stored as po/<lang>.po using the standard language code (for example: es, pt_BR, de).
Starting a New Translation
- Generate the
.pottemplate (normally not necessary, but it keeps everything in sync):
cmake --build build --target update-pot
- Create your language file:
cp paperback.pot your-lang-code.po
- Edit the header in your
.pofile with the correct language name, your name, and email. - Translate the strings using your editor of choice. Keep placeholders and shortcut markers intact (see Notes below).
- Verify the file compiles cleanly:
msgfmt --check --verbose es.po
- Test your translation by recompiling Paperback and selecting it from the options dialog.
Updating an Existing Translation
When new strings are added to Paperback:
- Update the template (if not already done):
cmake --build build --target update-pot
- Merge new strings into your translation:
msgmerge -U es.po paperback.pot
- Translate the new or fuzzy strings. Anything marked with
fuzzyneeds a review, and any empty strings are brand new. - Remove fuzzy markers once done reviewing.
- Compile and test (same as step 6 above).
Submitting Your Translation
- Fork the repository and create a branch.
- Commit your updated
po/<lang>.pofile (andpaperback.potonly if you regenerated it). - Open a pull request here: Create a pull request.
If you prefer not to use Git, you can also attach your .po file to an issue and we'll merge it for you.
Notes
- Keyboard shortcuts: Keep the
\tand key name together. - Format strings: Keep the
%s,%d, and similar placeholders. - Ampersands (&): Used for keyboard shortcuts. Choose different letters if the same key is used twice in a menu.
- Punctuation and spacing: Match the source string for ellipses, colons, and spacing so UI alignment stays consistent.
- Encoding: Files should stay UTF-8 without a BOM.