Photivo uses Qt’s built-in translation capabilities. That makes it easy and convenient to translate but needs a bit of setting up at first. In this article we walk you through all the installation steps. If you run into problems or have any questions, contact Brother John.
It’s probably a good idea to get in touch anyway to avoid multiple people doing the same language in parallel.
Setup the Translation Environment
From Qt you need Qt Linguist to do the actual translation and the lupdate tool to create and update the translation file for your language. Also you need the Mercurial version control software to get the Photivo source code.
- First create a folder where you want all the translation tools and Photivo itself to be located. We’ll assume
C:\ptTranslatein this article but you can use any folder you like.
- Qt Linguist and lupdate are included in the Qt SDK that you can get from the official Qt download site. However, that is a huge download (over 300 MB) and most of it is unnecessary. That’s why we provide a stripped down version (from the Qt 4.7.0 SDK installer) with only the necessary stuff: grab it from Google Code and unpack it to your
- Open a console window (also known as command prompt or DOS window) in your
(Probably works the same or very similar for Mac.)
- Create a directory for all the translation stuff. We’ll assume
~/ptTranslatefor this article
- Install Qt Linguist and lupdate via your package manager. If you cannot find them individually, look for the Qt 4 SDK.
- Also install Mercurial, if you do not already have it. A graphical tool like ToroiseHg will work as well.
- Open a terminal window in your
Prepare the new translation
Now you are ready to get your translation started. First you get a copy of Photivo’s source code, then you tell Photivo about the new language and generate the translation file.
- From the opened console window first get a clone of the Photivo source code repository. Execute these lines (works for both Windows and Linux):
hg clone https://photivo.googlecode.com/hg/ photivo cd photivo hg update default
Leave the window open.
- Open the file
photivoProjectsubfolder with a text editor and at the very end of the file add a new translation line for your language (just below the other translation lines).
TRANSLATIONS += ../Translations/photivo_LANGNAME.ts
Replace the LANGNAME with the English name of your language, e.g. “German” or “Italian”. Photivo uses the LANGNAME part of the file name to display the available translations on the Settings tab.
- In the console window run
- There should now be a new
photivo_LANGNAME.tsfile in Photivo’s
lupdatewill produce some errors or warnings. As long as the
.tsfile is created you don’t need to worry about them.
- Open your
photivo_LANGNAME.tswith Qt Linguist and start translating.
- When you open the translation file for the first time Qt Linguist displays the language selection dialog. Adjust the Destination language as needed but keep the Source language unchanged, even if it looks weird.
- The Qt documentation includes a tutorial for Qt Linguist.
Test and Release
You can test your translation with your normal Photivo installation.
- Compile the translation file (
File › Releasein Qt Linguist). That produces
photivo_LANGNAME.qmin the same folder as your
- Copy the
- Win Vista/7:
C:\Users\username\AppData\Roaming\Photivo\Translations(the path might appear translated into your Windows’s language in Explorer)
- Win XP:
C:\Documents and Settings\username\Application Data\Photivo\Translations(the path is translated into your Windows’s language).
- Start Photivo, go to the Settings tab and choose your language from the Translation combobox.
To get your translation officially into Photivo we only need the completed
.ts file – but if you can provide a final
.qm as well, we won’t complain. The translation needs to be licensed under the GNU GPL version 3 like the rest of Photivo. Also tell us how you’d like to be credited. Full name? Nickname only? E-mail address? The person to get in touch with is again Brother John.
Update the translation
Of course with time text in Photivo’s GUI will change and new text will appear. That’s no immediate problem, because if Photivo cannot find a translation for a certain item it will just use the default English text.
Updating the translation is easy:
- Like above open a console window in your Photivo source code folder (where
- Update to the latest source code revision:
hg pull hg update default
lupdateto add the new strings to your
- In Qt Linguist the new strings are marked as unfinished so you can find them easily.