FORUMS CLOSED DUE TO SPAM. YOU STILL CAN ADD POST!

Q. Explain. How working a translation mechanism?

Feed 9 posts, 4 voices

Avatar
58 posts

Like __(‘some text’) in core plugin source code.

It is to be understood in order to translate the other plugins that do not implement such a mechanism.

For example: TB Contactform 1.0

 
Avatar
58 posts

Okay. Is just a helper function, i see now. It’s use simple? Just write __(‘text’) in the function/class (plugin to)?

 
Avatar
70 posts

UPDATE: Whoops! Frog is not using gettext. Just create a file ‘<lang>-messages.php’ in an ‘i18n’ subfolder with the content:

<?php return array("foo" => "bar"); ?>

and you are done.

Well, maybe Frog should switch to gettext. Due to wordpress it should be available at most hosters.

Regards
M

Hello Ax,

the translation mechanism is achieved by using the gettext library and a build-in extension for PHP. At code level you just use the ‘__ ()’ function for your native text messages. In a second step you extract all appearances of the ‘__ ()’ function into an external file the so called ‘.po’ files. This are simple text files you edit with any text editor you like or special translation editors. After you have finished the ‘.po’ files you compile the files into binary files with the postfix ‘.mo’. This files are loaded once the plugin is active. Given the right locale definition in your config.php and the i18n backend loads and display the strings from the ‘.mo’ file.

PoEdit is good for doing everything with one application.

Hope this helps
M

 
Avatar
13 posts

Ax, TB_Contactform 1.0 is not ready for i18n. I have a version now that does support i18n but I’m waiting on a final word on this issue before I release it.

 
Avatar
58 posts

Hello, M and Linkable
Thank you very much, for explaining me these things.
Linkable, will waiting for.

 
Avatar
651 posts

Read this: http://code.google.com/p/madebyfrogs/wiki/TranslatorNotes

And also check out the skeleton plugin which is supplied with Frog core and is intended to serve as an example of how to create a plugin.