[wp-polyglots] searching a tutorial on translating a WP theme
Stefano
steagl at people.it
Thu Sep 21 09:14:53 GMT 2006
On Thu, 21 Sep 2006 10:52:32 +0200, "Lukáš Kucharczyk"
<kucharczyk.lukas at gmail.com> wrote:
>Thanks a lot for explanation. One last question: What's that with the
>'textdomain_if_apply' thing?
If you use the sintax of your example for theme and plugin gettext
will search translation in the ,mo file of WP, if you specify at the
start of your theme/plugin
load_plugin_textdomain('plugin/theme_name_domain',[$path =
'path_to_plugin/theme_dir'])
and you will use the text_domain in the __ and _e fuctions the
translation will be searched in the specified textdomain file
Example
You have a plugin named FancyPlugin, that's in a subfolder in the
plugin directory (named fancyplugin) you will have a line:
load_plugin_textdomain('FancyPlugin',$path =
'wp-content/plugins/fancyplugin')
all the __() and _e() function will have the format:
__('text to translate', 'FancyPlugin')
This way the gettext will search the translation in
FancyPlugin-xx_XX.mo files where xx_XX is the language code (ex: it_IT
for italian)
Sarch on the codex for info and example about translating plugins and
theme
--
Stefano Aglietti - StallonIt on IRCnet - ICQ#: 2078431
Email: steve at 40annibuttati.it steagl at people.it
Sites: http://www.40annibuttati.it (personal blog)
http://www.wordpress-it.it (WordPress Italia)
More information about the wp-polyglots
mailing list