Skip to content

Translate Manuskript

Olivier edited this page Oct 29, 2017 · 7 revisions

This will help you to translate Manuskript:

  • in a new language
  • or updating existing translation

A. Translate manuskript to a new language

You can see the list of available languages:

Right now, manuskript is written in English, and translated in French, Spanish and German.

Ways to add a new language

1. Request it

Simply request it by creating a new issue. We will then generate the empty language file and send it to you. You can translate it following instructions below.

2. Add it yourself

  1. Clone manuskript repo, making sure you're in the develop branch. (See Install Source Code in the wiki)

  2. Edit i18n/manuskript.pro and add TRANSLATIONS += manuskript_XX.ts at the very end, replacing XX with your language.

  3. Run pylupdate5 -noobsolete i18n/manuskript.pro

    This will generate a .ts file in i18n folder, that you can translate using Qt Linguist, see below. pylupdate5 is part of PyQt5's tools.

B. Update existing translation

If you want to update an existing translation (for example because new features have been added that need translation, or because you want to correct mistakes), then:

  • Run pylupdate5 -noobsolete i18n/manuskript.pro

    It will update the .ts file in i18n folder.

  • Translate it (see below)

C. Translate

Once you have a .ts file, you can start the translation work with Qt Linguist.

  • Open your .ts file with Qt Linguist

  • If it's an empty translation, a Dialog will ask you to set the source and destination language

    image

    Set the Source language to English, and set the Target language to your language.

  • Start translating strings. For that, be extra careful to:

    • Respect punctuation: if a string ends with no punctuation, yours should have none. If it has, it should be the same. Now of course for some languages this will be open to your interpretation.

    • Respect markup: if a string contains HTML markup (for example <p> or <br>) then include it exactly the same way, translating only what is non-markup.

    • Keep {}: if you see this {} within a string, it means some text or value will be inserted there. It must be present, or manuskript could crash. Also, if there is some text inside, for example {HelpText}, then do not translate text within — it's an identifier. But translate the text around.

  • Once you're done, save your work in Qt Linguist and test it (see below), or send it back to manuskript's main repo (see below)

D. Test your translation (optional but recommended)

If you want to test your translation, you can:

  • run make i18n from manuskript's root directory.
  • or run lrelease i18n/manuskript_XX.ts (replacing XX with your language)

This will generate a i18n/manuskript_XX.qm binary that manuskript can read.

  • Open manuskript/settingsWindow.py and after line 64 (or around there, search for tr["Deutsch"] = "manuskript_de.qm") add: tr["NAME-OF-YOUR-LANGUAGE"] = "manuskript_XX.qm". Be careful to respect code indentation (the number of spaces before tr[...), or manuskript will crash.

    This will tell manuskript to look for your translation file. (In the future, this could/should be automatic)

  • Run manuskript, and in the settings window (F8), chose your language.

  • Restart manuskript

  • Go through every place you can think of to check whether your translation makes sense or not

E. Publish your work

Once you've translated the .ts file and you're satisfied with it, you need to make it available to all.

Ways to publish your translation

1. Send it back to us

Create a new issue and post your .ts file. Be sure to tell us the name of your language in your language (for example "French" is "Français").

We will check it, compile it, add it to the settings window in manuskript and if everything looks good it will be included in the next release of manuskript.

2. Create a pull request

Your pull request must include at least the .ts file (of course), but you can also include the .qm file, and/or the modification in manuskript/settingsWindow.py (if you don't to the last one, please tell us the name of your language in your language — for example "French" is "Français").

F. Be glad you made the world a better place

Clone this wiki locally