I have been developing plugins for b2evolution for a little while now and am in the process of converting those over to QP. Throughout that whole time I have always made sure that my plugins used the right code to make them translatable into other languages. However, I never went as far as to extract out the text strings to make my plugins easy to translate. As it turns out there is a specific format for doing this.
With all the plugins shipped with QP there is a folder called 'po' that contains a file called messages.pot. This file contains all the strings contained in the plugin code that you might want to translate. Here is a good definition from http://www.icanlocalize.com
POT – Portable Object Template. This is the file that you get when you extract texts from the application. Normally, you send this file to your translators.
PO – Portable Object. This is the file that you receive back from the translators. It’s a text file that includes the original texts and the translations.
So, while I have been playing around with the quicktags plugin I thought it was about time I learned how to create these files (mainly because my changes wouldn't have been accepted otherwise ).
1) Download and install Poedit for your chosen platform (I am on a Mac)
2) Go to File -> New Catalog. The following screen should appear:
3) Enter the project name and version and then click on the Paths tab:
The messages.pot file is located in a sub folder of the main plugin folder so we need to tell Poedit to look in the parent folder for our source files. We therefore need to add a new path to this screen which is the '..' path that denotes the parent directory.
4) Next, click on the Keyword tab:
This screen is asking what functions you are using in your code to perform the translations. In Quam Plures this is the code
T_('Text Goes Here') so in this screen we need to add a new keyword 'T_'. Once you have done this click on the OK button and you will be prompted for a location to save the .po file. You should select the plugin's 'po' folder. This will be the same folder as where the file 'messages.pot. is located. At this stage I don't recommend overwriting the messages.pot file as it contain header comments that we need to keep.
TS_('Text Goes Here')function and there is also one called 'NT_'. This means that in this stage you need to add the 'T_', 'TS_' and the 'NT_' keywords.
After clicking OK, Poedit will scan the parent directories for your code and extract out all the translatable strings based on the keywords we provided. Once it has done that, the following screen should appear:
Click on the OK buton and then save. You should now have a .po file in the same directory as the file 'messages.pot'. Once I was at this stage I opened both files and copied the contents of my new .po file over the contents of messages.pot while leaving the header comments and text alone. I then deleted the new .po file. This last part is not optimal so I will have to dig into the Poedit settings to see if I can get it to enter all the header info for me to enable me to just overwrite the messages.pot file.