[wp-hackers] Re: Couple of quick questions: restrict access to plugin file and loading of l10n

Andrew Ozz admin at laptoptips.ca
Fri Oct 19 19:44:36 GMT 2007


Thanks Jennifer for your quick reply. Your page on how to 
internationalize plugins is very helpful and informative.

 > a) Never call load_plugin_textdomain in the main text of your plugin
 > file (i.e. outside of a WP filter/action). It might get loaded before
 > a multilingual plugin has properly decided which language to use (the
 > load command loads a particular language).

I'm sorry I didn't explain very well what I'm trying to do. The 
load_plugin_textdomain is called at the beginning of the function that 
outputs the admin page, that is called by options_general.php long after 
the "init" and "plugins_loaded" hooks (as fas as I can tell) and only if 
the user clicks on the menu for it.

That way the translation is only loaded when needed, but I was afraid 
that it may be too late for the .mo file to load properly if the server 
is slow, etc.


More information about the wp-hackers mailing list