Translate Manuskript - olivierkes/manuskript GitHub Wiki
This will help you to translate Manuskript:
- in a new language
- or updating existing translation
NOTE: Web Translation
As of today (December 2017), it's possible to translate manuskript using Weblate. See here for more information.
As of November 2022, it's the expected way to provide translation strings, as otherwise git conflicts can be easily introduced. Thank you in advance for your contributions!
Create a new issue if you have questions about this method.
Note
The methodology below does not use web translation and is still valid, refer to that if you don't want web translation.
A. Translate Manuskript to a new language
You can see the list of available languages:
- in manuscript's settings dialog
- or at the end of the file: https://github.com/olivierkes/manuskript/blob/develop/i18n/manuskript.pro
Right now, manuskript is written in English, and translated in French, Spanish and German.
Ways to add a new language
1. Add it yourself
-
Clone manuskript repo, making sure you're in the
develop
branch. (See Install Source Code in the wiki) -
Edit
i18n/manuskript.pro
and addTRANSLATIONS += manuskript_XX.ts
at the very end, replacingXX
with your language. (xx_XX
in case of language specification, likept_BR
) -
Run
pylupdate5 -noobsolete i18n/manuskript.pro
This will generate a
.ts
file ini18n
folder, that you can translate using Qt Linguist, see below.pylupdate5
is part of PyQt5's tools.
2. Or 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.
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 ini18n
folder. -
Translate it (see item C)
B2. Update Source Translation String
In the event you're attempting to change the original in-code string name, you'll need to use QT Linguist's lrelease
to update all of the source translation (.ts) files in the i18n folder. If you don't, they'll fail to translate and default to the source English string across the board.
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
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
(replacingXX
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 fortr["Deutsch"] = "manuskript_de.qm"
) add:tr["NAME-OF-YOUR-LANGUAGE"] = "manuskript_XX.qm"
. Be careful to respect code indentation (the number of spaces beforetr[...
), 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
G. Additional Comments for Windows Users (08/01/2018)
-
Make the translation through: https://hosted.weblate.org/projects/manuskript/translations/
-
If the translation for your language is already available then review it.
-
Once you have finished and reviewed your translation, download QTlinguist on your device at https://github.com/thurask/Qt-Linguist/releases.
Download the .zip file, we have available at the moment: linguist_5.11.1.zip (https://github.com/thurask/Qt-Linguist/releases/download/20180620/linguist_5.11.1.zip)
-
After downloading, unzip the linguist_5.11.1.zip.
-
Go back to the translation site, item 1 above, and download the .ts files of your translation. On the page, please click on "File" and then click "Download Original Translation File (Linguist QT Translation File)"
So by downloading the file with the name of your language type to "manuskript-translations-en_BR.ts" (manuskript-translations-your_language.ts)
-
Move the downloaded file ("manuskript-translations-en_BR.ts") to the inside of the folder unpacked in item 4, (linguist_5.11.1).
-
Then to convert the .ts file to the .qm format, we will use the "lconvert.exe" executable that is inside the "linguist_5.11.1" folder, via "shell" or "cmd".
-
Hold shift and right click and select open powershell (cmd) here. This will open a new window, the powershell or cmd.
-
In the window type:
lconvert.exe -i "infile" -o "outputfile"
In my case the command will be:
lconvert.exe -i. \ manuskript-translations-en_US.ts -o. \ manuskript-translations-en BR.qm
- Do not forget to rename the file properly:
Original Files: manuskript-translations-en.BR manuskript-translations-en_BR.ts
Renamed File: manuskript_en.qm manuskript_en.br
-
Copy these renamed files into the "manuskript \ i18n" folder
-
Follow the steps "D. Test your translation (optional but recommended)" in: https://github.com/olivierkes/manuskript/wiki/Translate-Manuskript
Here they are:
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.
In portuguese language:
Comentários Adicionais para usuários do Windows (01/08/2018)
-
Faça a tradução através do: https://hosted.weblate.org/projects/manuskript/translations/
-
Se a tradução para a sua linguem já estiver disponível faça uma revisão então.
3 ) Depois de terminada e revisda a sua tradução, baixe no seu equipamento o QTlinguist em https://github.com/thurask/Qt-Linguist/releases.
Baixe o arquivo .zip, neste momento temos disponível: linguist_5.11.1.zip (https://github.com/thurask/Qt-Linguist/releases/download/20180620/linguist_5.11.1.zip)
-
Após baixar, descompacte o linguist_5.11.1.zip.
-
Volte ao site da tradução,item 1 acima, e baixe o arquivos .ts da sua tradução. Na pagina, clique em "Arquivo" e depois clique em "Baixar Arquivo de Tradução Original(Arquivo de tradução QT Linguist)"
Assim baixando o arquivo com o nome de sua lingua tipo a "manuskript-translations-pt_BR.ts"( manuskript-translations-your_language.ts)
-
Mova o arquivo baixado ("manuskript-translations-pt_BR.ts") para a dentro da pasta descompactada no item 4, ( linguist_5.11.1).
-
Então para convertter o arquivo .ts para o formato .qm, iremos usar o executável "lconvert.exe" que esta dentro da pasta " linguist_5.11.1", via "shell" ou "cmd".
-
Segure shift e clique com o botão direito do mouse e selecione abrir o powershell(cmd) aqui. Assim abrirá uma nova janela, o powershell ou cmd.
-
Na janela digite:
lconvert.exe -i "infile" -o "outputfile"
No meu caso ficará assim o comando:
lconvert.exe -i .\manuskript-translations-pt_BR.ts -o .\manuskript-translations-pt_ BR.qm
- Nao esqueça de renomear o arquivo adequadamente:
Arquivos Originais: manuskript-translations-pt_BR.qm manuskript-translations-pt_BR.ts
Arquivo Renomeado: manuskript_pt_BR.qm manuskript_pt_BR.ts
-
Copie estes arquivos renomeados para dentro da pasta "manuskript\i18n"
-
Sigua os passos "D. Test your translation (optional but recommended)" em : https://github.com/olivierkes/manuskript/wiki/Translate-Manuskript
Aqui estão eles:
Abra o arquivo "manuskript/settingsWindow.py" e depois da linha 64 ( ou próximo daqui, procure por tr["Deutsch"] = "manuskript_de.qm") adicione: tr["NAME-OF-YOUR-LANGUAGE"] = "manuskript_XX.qm". Tenha cuidada, respeite o a identação do código, (os números de espaços antes de "tr[..."), ou o manuskript vai travar.
Assim diga ao manuskript para abrir o seu arquivo de tradução. (No futuro isto pode/será automático)
Execute o manuskript, e em configurações (F8), escolha a sua linguagem.