• I have made my very first WP plugin and tries to localize it with WP 3.5.1

    The Codestyling Localization was very good because it found some of my errors. Now my .po and .mo files are ok and looks nice in CL userinterface.

    My .mo file are located in myPluginName/languages. I only have one set of language-files in the directory; myPluginName-nb_NO.mo and myPluginName-nb_NO.po

    This small test alway gives me wrong language when I create a page and write [shortcode_test]:

    function myplugin_setup() {
        load_plugin_textdomain('myPluginName', false, dirname(plugin_basename(__FILE__)) . '/languages/');
    }
    add_action('plugins_loaded', 'myplugin_setup');
    
           //[shortcode_test]
    	function test_shortcode( $atts ){
    
    		$msg = __('This is a test', 'myPluginName');
                    $msg .=  '  ('. get_locale().')';	
    
    	return $msg ;
    	}
    	add_shortcode( 'shortcode_test', 'test_shortcode' );

    With get_locale() I also knows that WPLANG is set to right language.

    http://ww.wp.xz.cn/extend/plugins/codestyling-localization/

The topic ‘Wrong language in my first plugin’ is closed to new replies.