[wp-polyglots] Trying to translate a plugin

Pandem pandemtandem at gmail.com
Tue Feb 28 12:43:31 GMT 2006


Stefano escribió:
> Il Tue, 28 Feb 2006 12:14:28 +0100, Karl Wångstedt
> <kalle at wangstedt.net> scrive:
>
>   
>> 28 feb 2006 kl. 10.21 skrev Stefano:
>>
>>     
>>> load_plugin_textdomain('wpcf',$path =
>>> 'wp-content/plugins/wp-contact-form');
>>>       
>> That did the trick! Thanks a bunch. But how come that's not clarified  
>> in the codex? Or isn't the $path variable required all the time?
>>     
>
> Is required only if the plugin is inside a subdir of the plugins
> directory. ANd on this page it's explained:
>
> http://codex.wordpress.org/Writing_a_Plugin
>
> even if not much clear.
>
>   
You can have the plugin files in a subdirectory and the mo file under 
the main plugins directory: the pugin will get translated without having 
to add that second parameter to load_plugin_textdomain. As Karl said, it 
is sometimes the best way, because you don't have to hack the plugin 
files. The codex is very confusing on this respect, I had to learn this 
by trial and error. I found it very strange that you had to hack every 
plugin file in order to make load_plugin_textdomain point to the proper 
folder, as some of them consists of a single php file that you place 
under the main directory while some others need they own folder.

As i18n of plugins and themes is becoming quite common, it would 
probably be a good idea to have a /languages subfolder and make this 
function point to that by default. It would help both plugin developers 
and users.

Maira


More information about the wp-polyglots mailing list