How to translate FOG
For internationalization support FOG relies on gettext. In this tutorial we will show you how to do translations of FOG on Ubuntu using a tool called poedit.
- Open a terminal windows via Applications -> Accessories -> Terminal
- Type: sudo apt-get update; sudo apt-get install poedit
Getting the Translation Template
- Create a working directory with mkdir -p ~/Desktop/fog-translation
- Type: cd ~/Desktop/fog-translation
- Type: wget http://freeghost.svn.sourceforge.net/viewvc/freeghost/trunk/packages/web/management/languages/messages.pot
Creating the translation PO file
The .pot file is the template file. Now we are going to create a translation based on this file.
- Open POEdit (Applications -> Programming -> Poedit)
- If this is the first run, you will need to enter your name and an email address
- File -> New Catalog from pot file...
- open ~/Desktop/fog-translation/messages.pot
- In the Project Info tab, select a Language and Country, then select OK
- Then save you po file in the ~/Desktop/fog-translation/ directory as messages.po
After that you are ready to translate, on the English strings will appear on the left hand size and the translation then goes on the right hand side. When your translation is complete, click Save and send the FOG Project team your messages.po and message.mo file so they can be added to the project. You can send this information to us via the patches section of SF at:
Updating a PO File with an updated POT
As FOG progresses, we will keep adding to strings to the POT file, so every so often you will want to update your translation file. To do this, follow these steps to get the latest template:
- Open POEdit and open your po file.
- Then select Catalog -> Update from POT File
- Select your new POT file.
Advanced Translation Tools
PO Edit can actually look at other translated files and see if any string are in common and if so, automatically add them to your translation file.
To do this you need to have a catalog open in POEdit, then
- Go to Edit -> Preferences
- Select the Translation Memory tab.
- Click the Add button, and select your translation language.
- Click Generate database
- When the wizard pops up, remove your home directory and click the next button (This may take a while, as it generates a database of all translations on your system).
- Click Finish
- In the configuration section set both Max. # of missing words: and Max. difference in sentence length: to 0. You will get less strings translated, but they will be more accurate.
- Click OK to exit the preferences window.
- select Catalog -> Automatically translate using TM