[wp-hackers] Plugin Language Translation

Sabin Iacob iacobs at m0n5t3r.info
Sun Mar 25 16:44:13 GMT 2007


Andy Staines wrote:
> Sorry Alex, can I double-check what I have done here because I'm still 
> not getting anything. In fact, in the admin side I'm not even getting 
> the 'cancels', 'edits' etc., any more!
>
> (Renamed and rebuilt the mo by the way - shorter name, less bytes).
>
> (1) My config.php is set to: 'WPLANG', 'fr_FR' - and I am getting WP 
> in French.
>
> (2) I have put the load textdomain into an 'init' action as you advised:
>
>    add_action('init', 'sf_localisation');
>
>    function sf_localisation()
>    {
>        load_plugin_textdomain('sforum',
>    
> ABSPATH.'wp-content/plugins/simple-forum/languages/sforum-'.get_locale().'.mo'); 
>
>    //    load_plugin_textdomain('sforum',
>    ABSPATH.'/wp-content/plugins/simple-forum/languages/');

after looking at the source, it looks like the correct thing to call is

load_plugin_textdomain('sforum', 
'wp-content/plugins/simple-forum/languages')

(wp-includes/l10n.php)

> (3) I have changed the __( and _e( calls to the format __("Locked", 
> "sforum")

the source of your confusion seems to be the definition of __(): 
__($text, $domain="default") :)

> (4) My newly compiled .mo file is now named 'sforum-fr_FR.mo'

this appears to be the correct name, not FR_fr  ;-)




More information about the wp-hackers mailing list