WordPress MU Domain Mapping
Where to put the translation (8 posts)

  1. thomasdk81
    Posted 4 years ago #

    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?

  2. thomasdk81
    Posted 4 years ago #

    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?

  3. nicsco
    Posted 4 years ago #

    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" );


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

    should work.

  4. thomasdk81
    Posted 4 years ago #

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

  5. thomasdk81
    Posted 4 years ago #

    Just to make perfectly clear.

    I changed:

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

    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.

  6. Eduardo Santos
    Posted 4 years ago #

    It works for me!

  7. mr.dave
    Posted 3 years ago #

    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?

  8. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 3 years ago #

    @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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress MU Domain Mapping
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic