To begin with, these are the tools I use:
- A PO file generator - I use the one here. I zip my entire theme directory and upload it to this site (where it asks me to load the PHP file). It automatically generates the PO (Portable Object) file for me. I copy out the PO file, then store it as "suffusion.po". This is the generic file that is used. Since all my content is in English I simply copy this file out to en_US.po. Note that a block of code in the default PO file looks like this:
The lines suffusion/comments.php:35 and suffusion/functions/actions.php:817 indicate the lines in the files comments.php and actions.php where the translatable string "% Responses" occurs.
Code: Select all
#. Text in function #: suffusion/comments.php:35 #: suffusion/functions/actions.php:817 msgid "% Responses" msgstr ""
- POEdit - As the name suggests, this is the PO file editor. I can copy the generated PO file from the previous step to say fr_FR.po, which will have the French translation. Once I have a this PO file created I open it in POEdit, then for each string that shows up in the PO file I put in the French translation. Once my file is ready, I save it. If you open the file in a text editor after the save, you will see lines like this:
Note that in your text editor Réponses may show up as RÃ©ponses. Saving automatically generates the MO (Machine Object) file. For each PO file I will have a corresponding MO file.
Code: Select all
#. Text in function #: suffusion/comments.php:35 #: suffusion/functions/actions.php:817 msgid "% Responses" msgstr "% Réponses"
- WinMerge - This is the tool I use to keep my files in sync. Since this is a live theme with live translations, at the time of each release I first generate the suffusion.po file, then compare it line by line with the individual language PO files. In case there is a discrepancy in the line information I update the language file with the new line. E.g. if "% Responses" appears in line 37 of comments.php in the new suffusion.po file, WinMerge lets me update this line in fr_FR.po. Once all the PO files have their line information synced up I open each of the PO files and save them all to generate the MO files.