1
votes

From my previous questions about gettext, one of the biggest benefits of using PHP's gettext extension instead of other methods of language translation was that it is super easy to have other people make translation files with a program called Poedit.

Now I have gettext working in my app but I have not made any translation files yet, I found a demo file on the net and tested with it to conform my app works with gettext though.

Now I played around with poedit a little bit and I might be wrong, hopefully someone can clarify some issues.

  1. As far as I can tell poedit reads through your php code and finds all availabale spots to do a translation, is this correct?

  2. If the above is correct, then how do you have a human translator translate with poedit without having access to your app?

Or in simple terms is it possible to make a translation file with poedit without it having access to your php code?

3

3 Answers

2
votes

Note that I have never used poedit myself, so this might not be totally accurate...

An interesting article that you might first read, for some informations : Localizing a WordPress Plugin Using poEdit
It's wordpress, which means PHP -- so the basic ideas should be OK for your application.

Basically, if I understand well :

  • you first extract all the strings from the PHP source code
    • by telling poedit how your translation function is called
    • this should answer your 1)
  • then, you do translation
    • working with/on the .po file
    • And I'm guessing you can distribute this .po file to your translators, who can then translate the strings it contains
  • and, finally, you use the .po file to generate the .mo file that will be used in your application.


This other article, about wordpress too, seems to indicate that I'm guessing right : User:Skippy/Creating POT Files -- especially, this sentence :

Make the .po file available for download (or optionally include it in the plugin archive). Translators will use this file to construct a .mo file, which will be used by the load_plugin_textdomain() function.

(Obviously, the function name you'll be using in your application will not be the same as the one in wordpress -- still, the idea is there)


Hope this helps :-)
Have fun !

2
votes

No, poEdit doesn't read all your sources. You use the gettext utility "xgettext" to do that.

Basically, xgettext will produce a .po file.

Your translators will use POEdit to work on that .po file.

When the translater is done, you'll compile the .po into an .mo, which you app will use to look up translations.

If you have gettext installed on some unixy system, try "info gettext" in bash.

0
votes

PoEdit actually uses xgettext, which you can set up on the Settings/Parsers tab correctly.

You should distribute a .pot file by the way, which is a .po template. So translators can translate it, set the language, the translator team, etc.

Unfortunately, I cannot see an option to create .pot file from source, but poedit can read then (of course, it's the same as .po).

After creating their own .po, you can have the .mo!