Manual contents

Translating TriPad

TriPad's interface is written in English. A translation is a gettext .po file named after its language: de.po for German, pt-BR.po for Brazilian Portuguese, and so on. TriPad.pot is the template, with every text in the interface and the place in the source where it appears.

Making a translation#

  1. Copy TriPad.pot to <language>.po, or open it in a .po editor such as Poedit and choose Create new translation.

  2. Put the language code in the header ("Language: de\n"), then fill in each msgstr. A text left empty stays in English.

  3. Keep the placeholders:

    • %d, %s and the other % codes must stay in the same order.
    • {0}, {1} and so on may move around but must all stay.

    TriPad ignores a translation that changes them and shows the English instead. Poedit warns you about them.

  4. An & marks the letter that is underlined in a menu or button and used with Alt. Put one in each translated text that has one, on a letter that suits the translation. Write && for an ampersand. Some texts end in a tab and a shortcut (&Copy\tCtrl+C); keep the tab, and translate the key names as Windows does in your language (&Kopieren\tStrg+C).

Using it#

Put the file in a lang folder, either next to TriPad.exe or in TriPad's data folder (%APPDATA%\TriPad\lang, or next to the exe in portable mode). Then choose the language in Preferences > General > Language and restart TriPad. Same as Windows picks the translation for your Windows display language when there is one. Files in the lang folder of this repository are installed with TriPad.

Checking a translation#

German and Finnish texts are often a third longer than the English, so check that nothing is cut off. The pseudo-translation shows the same thing without knowing a language. It accents every letter and makes every text about 40% longer:

python -I tools\strings.py --pseudo build\Release\lang\qps-ploc.po

Then set Language=qps-ploc in the [General] section of TriPad.ini and start that TriPad. Anything still in plain English isn't marked for translation yet, and anything without its closing ] is cut off. tests\ui\i18n.ps1 does this automatically.

When TriPad changes#

python -I tools\strings.py rebuilds TriPad.pot from the source. To bring a translation up to date, use Catalog > Update from POT file in Poedit, or msgmerge -U de.po TriPad.pot.

In the code#

Mark interface text with T(L"..."). For tables filled before the language loads, use N_(L"...") and pass the value through T() where it is shown. src\Translate.h has the details.