Support » Plugin: WordPress MU Domain Mapping » [Plugin: WordPress MU Domain Mapping] Where to put the translation

  • The plugin uses:
    load_plugin_textdomain( 'wordpress-mu-domain-mapping', basename( dirname( __FILE__ ) ) . 'languages', basename( dirname( __FILE__ ) ) . '/languages' );

    The file is located in /wp-content/mu-plugins but I can’t seem make it work.
    I made a wordpress-mu-domain-mapping-da_DK.mo (da_DK is danish).
    Tried putting it in /wp-content/languages and /wp-content/mu-plugins/languages

    What am I missing here?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Is it so simple you don’t bother to answer or could it be that no one knows the answer? Hasn’t anybody made a translation before?

    Hi thomasdk81,

    I had the same problem yesterday and today I’ve found the solution: as you are using a “mu-plugin”, you shoud not use load_plugin_textdomain but load_muplugin_textdomain

    From wp-includes/I18n.php :

    /**
     * Load the translated strings for a plugin residing in the mu-plugins dir.
     *
     * @since 3.0.0
     *
     * @param string $domain Unique identifier for retrieving translated strings
     * @param strings $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which
     * the MO file resides. Defaults is empty string.
     */
    function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
    	$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
    	$path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );
    	load_textdomain( $domain, trailingslashit( $path ) . "$domain-$locale.mo" );
    }

    so:

    load_muplugin_textdomain( 'wordpress-mu-domain-mapping', 'languages');

    should work.

    Thanks 🙂
    When you put it like that, its pretty obvious 😀
    And if I understand it right, a bug that needs to be fixed in the plugin?

    Just to make perfectly clear.

    I changed:

    load_plugin_textdomain( 'wordpress-mu-domain-mapping', basename( dirname( __FILE__ ) )  . 'languages', basename( dirname( __FILE__ ) ) . '/languages' );

    to
    load_muplugin_textdomain( 'wordpress-mu-domain-mapping', 'languages');

    Created a folder in muplugins called languages and placed the .mo there.
    It works for me now.

    It works for me!

    Hello, i have had the same problem with language files. I run a webshop with Cart66 plugin. It is standard in English, but have with the latest updates made available with spanish and italian language files. I took one of them and changed into swedish and named them cart66-sv_SV (both .mo and .po files). Now to my problem. It doesnt say anywere how to change the language. at cart66 it says it doesnt support other languages but there have to be a way for this to work if they made it available with spanish and italian (it doesnt say how to set up those languages either btw).

    This is the Code that i think have to do with the language:

    */
    $cart66 = new Cart66();
    load_plugin_textdomain( ‘cart66’, false, ‘/’ . basename(dirname(__FILE__)) . ‘/languages/’ );

    Ive tried to change everything but I can´t make it work. does anyone have an Idea, anything, of what to do?
    Thanks!
    -David

    Plugin Author Ron Rennick

    (@wpmuguru)

    MultiSite Guru

    @mr.dave – you’re having an issue with Cart66 and you posted on a thread for the WordPress Mu Domain Mapping plugin.

    If you want help on Cart66, create a new thread and tag appropriately. The issue the people had above is related to implementing plugins designed to be installed in the mu-plugins folder.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WordPress MU Domain Mapping] Where to put the translation’ is closed to new replies.