I know this seems a bit "early" to ask for this, but from experience I can tell you: If you don't prepare for i18n up front it will hurt a lot to include it at a later point in time. At least considerations should be taken to prepare the code for other languages (no hard coded strings etc) and a reversed layout should be possible.
I would be willing to help with this goal.
Qt has built in translation functions (essentially boiling down to wrapping all "displayed" strings with tr() from which it'll create an index of strings that can then be translated into other languages and loaded back into the app), do you think this would be sufficient?
That would be one thing to start with, but I believe there are many more things to take into consideration. For example, what about left to right instead of right to left? The layout needs to be mirrored, basically.
Also, dialogs must allow for larger or smaller messages without looking funky as translating text will lead to a size variation in the GUI.
I've gone ahead and wrapped all displayed strings with tr(). If people wish to write translations, I very much welcome it.
I'm unsure how Qt handles left/right alignment and not being knowledgeable in languages that do so, I'll tackle that once a translation for such a language appears.
I believe dialogs already should auto-size to their contents so I believe different size/length text shouldn't be too much of an issue.
@itsmattkc, check how translation process organized for OpenOrienteering Mapper
I would like to translate olive into my mother language, Spanish, how can I do it? I haven’t found a reference file into master to clone it and create the Spanish version.
Hey that'd be awesome! The general workflow appears to be using lupdate (from Qt's dev tools) to generate a .ts file, for example:
lupdate olive.pro -ts english.ts
The resulting file contains all the displayed strings in Olive and where they're from, and can be opened with Qt Linguist to translate them (or edited manually). Then lrelease will turn them into .qm files that can be incorporated into the project (but I assume I'll do that myself).
This page has more information about this: http://doc.qt.io/qt-5/linguist-manager.html
Would like to translate Olive into my mother language german. I would say just like in Adobe software (ex. Lightroom) I would not overkill the application with translations. For a first starting point I would recommend to translate Olive just into the most known foreign languages (German, French, Spanish, Italian etc.).
@itsmattkc In my workflow I directly integrate translation files into my .pro file. You can also add directories.
TRANSLATIONS += ts/olive_de.ts
This would give you the overall administration of that. You could then run lupdate and everyone who fetches the repo can open up the files in ts/ and just edit them with Linguist (so non-devs could also contribute).
This actually does look like a good way to do it, I've gone ahead and added files for German, French, Italian, and Spanish (for now) ready to be translated with Qt Linguist in 998a6dfd3e882a7507abc9861b66fe794c95ceca (in the ts folder).
@itsmattkc Thanks! Looking into it later, PR incoming! :-)
Much better this way!
I have also started the Spanish translation =)
BTW, a dropdown menu for choosing language will be needed on Preferences, doesn't it?
@pgilfernandez Indeed, I'll write in a menu in Preferences somewhere down the line.
I don't know how much of a problem this is, but all TS files, when opened on Qt Linguist, say they're for German. French, Spanish, Italian, all ask for Deutsch (Deutschland) translation.
@oc1024 It does appear they have all defaulted to German for some reason - I didn't (knowingly) set that. This can be changed in Edit > Translation File Settings.
@itsmattkc Fixed that issue so there should be no incoming merge issues (behind etc.).
Translation switching has been implemented as of 4478a386af988d715920abd6548b9a5b67d2430a, it's now mostly a matter of correctly deploying translations with packages as they're completed.
Is it possible also add option to load translation from local TS-file?
@Symbian9 I'm inclined to make this a CLI command if anything
@itsmattkc Well...
1) You don't have to make any new CLI commands:
$ ./olive-editor --help
Usage: ./olive-editor [options] [filename]
[filename] is the file to open on startup.
Options:
--translation <file> Set an external language file to use
It's how I tested my translation :)
2) Qt applications do not use TS files, they use QM — their binary versions compiled either by lrelease or made directly from Linguist.
Anyway, I already submitted my translation before I saw this. Sorry, atsym :)
@prokoudine Heh indeed I wrote that in last night ;) (fea6b191a8738c92adf644c399d020f420527312)
But yes you're correct, the files will need to be in .qm to be used in Olive/Qt, anyone writing a translation will need to know that.
Thanks for the Russian translation btw!
Since Olive now has a translation infrastructure and a few complete translations, I'll consider this issue addressed.
Most helpful comment
Much better this way!
I have also started the Spanish translation =)
BTW, a dropdown menu for choosing language will be needed on Preferences, doesn't it?