• I’m currently going through the steps of internationalizing my plugin. I’ve read through these two links which were of intense value to me:

    https://codex.www.ads-software.com/Writing_a_Plugin#Internationalizing_Your_Plugin
    https://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/

    I’ve created a .POT file and as a test example I’ve created an English to 1337 (1337 is leet and basically replaces letters with numbers, as I say it’s just an example) .mo file called wplinkdir-en_UK.1337.mo

    From what I can gather the plugin should adopt whichever .mo file is in the directory and use it, but this isn’t the case and my plugin currently functions as normal, displaying all text in English.

    My initiation function looks like this:

    $WPLD_Domain = 'wplinkdir';
    $WPLD_Translation_isSetup = 0;
    function wplinkdir_translation_setup(){
    	global $WPLD_Domain, $WPLD_Translation_isSetup;
    
    	if($WPLD_Translation_isSetup) {
    		return;
    	}
    	load_plugin_textdomain($WPLD_Domain, PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
    }

    Which was copied straight from the codex. As I say, the plugin fails to translate. I think I’m overlooking something but I can’t figure out where.

Viewing 1 replies (of 1 total)
  • Thread Starter Seans0n

    (@seans0n)

    Quick update: I’ve discovered that the .mo file pulled by WordPress depends on the WPLANG constant defined in wp-config.php:

    define (‘WPLANG’, ”);

    So I defined as en_UK:

    define (‘WPLANG’, ‘en_UK’);

    And to be on the safe side I made a copy of the .mo file wplinkdir-en_UK.1337.mo and called it wplinkdir-en_UK.mo

    Yet even with this the plugin refuses to adopt the .mo file. I can only imagine that the path specified in load_plugin_textdomain() isn’t correct. I’m going to play around with it a little more and see if that makes any difference.

Viewing 1 replies (of 1 total)
  • The topic ‘Quick Question About Internationalizing’ is closed to new replies.