We are currently planning to migrate to a different platform for the forum. We will announce this fact both here and on Twitter, once we have settled on a solution.

How to add translatable strings to Zettlr during development

How do I add translatable strings during development?

This is what I tried: add my strings to source/common/lang/en-US.json. I then test Zettlr, but Zettlr downloads fresh language files from https://translate.zettlr.com and caches the download at %AppData%/Zettlr. The fresh files don't have my added strings.

Comments

  • A long time ago I decided to make the translations very low-level since while there are a lot of people speaking foreign languages, the amount of coders is just as small as it is with, e.g., French or German speakers. Thus I decided to make it so easy that anyone could contribute.

    That means, translating stuff works like this:

    1. First you develop something, using English, untranslated, verbatim strings in the source code
    2. Once the feature works as it should, and you know precisely "Okay, I need X strings to translate", then you can start to replace the English verbatim strings with calls to trans()
    3. These trans()-calls expect a language identifier, e.g. system.ok (In the actual language file that means there is an object "system" that has the key "ok" which contains the translation). You need to find unique identifiers for your strings that make sense (e.g., if your English verbatim message was "Edit image with your default editor", then something might be "menu.img_edit_external" (menu, because it's a context menu entry)
    4. You can look up existing strings either in the language files or directly on Zettlr Translate
    5. When you open the PR, provide me a list of those identifiers and their English translations, so that I can add them to the system and users can start translating them while the PR is getting merged

    All applications will then incrementally download those language files that then contain the translated string

  • Hi @hendrik, thank you very much for explaining how translations work.

Sign In or Register to comment.