• Resolved dokkaebi

    (@dokkaebi)


    I’m now trying to work on translating this plugin for one of my websites. I added a “languages” directory under the plugin directory. I pulled out translatable strings with poEdit and translated the registration form-related strings I wanted and uploaded my join-my-multisite-{languagecode}_{countrycode}.po and .mo files to the languages directory.

    In joinmymultisite.php, there seems to be a line that pulls in translations, line 59:
    load_plugin_textdomain( 'helfjmm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    But this is in the add_settings_page() function. I tried to copy this line into the init() function with no results.

    How do I load my translation for this plugin?

    =====

    I just figured it out while writing this post, the translation files need to be named helfjmm-{languagecode}_{countrycode}.po not join-my-multisite-{languagecode}_{countrycode}.po

    To summarize, the steps needed are:

    1) Create a “languages” subdirectory under the plugin directory
    2) Create translations and name them helfjmm-{languagecode}_{countrycode}.po and helfjmm-{languagecode}_{countrycode}.mo and upload them to the “languages” subdirectory
    3) add the line load_plugin_textdomain( 'helfjmm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); to the end of the init() function in joinmymultisite.php

    Cheers!

    http://wordpress.org/extend/plugins/join-my-multisite/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I just pushed version 1.2, which should actually have translatification working.

    [redacted]

    Thread Starter dokkaebi

    (@dokkaebi)

    Awesome!

    I’ve made only a partially-translated po in Korean for the text that is displayed to the user. I’m not certain it’s 100% accurate, either, so I don’t think it would be appropriate for an official release.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Everything’s a work in progress, IMO 😉 But when you feel like it’s ‘pretty good’ feel free to email it 🙂

    Thread Starter dokkaebi

    (@dokkaebi)

    I’ve upgraded to version 1.3 of the plugin and it’s working great except for some translation issues. To get translation to work, I did the following.

    1) I still had to do step 3 of above:
    add the line load_plugin_textdomain( 'helfjmm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); to the end of the init() function in joinmymultisite.php

    2) Change line 131 on signuppage.php to:
    <h2><?php printf( __( '%s is your new username', 'helfjmm' ), $user_name) ?></h2>
    Because the textdomain ‘helfjmm’ was missing.

    3) This is the big one. Since the form field validation is done by calling wpmu_validate_user_signup(), the error message strings are not translated. As a workaround, I made a sub function called rewrite_errors_for_translation() that checks for each error message string and creates a new one so that translations can be pulled out for each string. My modified signuppage.php is posted at http://pastebin.com/AAdac9KY

    (Translators: Make sure esc_attr_e is included as a Poedit keyword when you do your translation)

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I’ll put this in the plugin for ya.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    3) This is the big one. Since the form field validation is done by calling wpmu_validate_user_signup(), the error message strings are not translated.

    Okay, I’m not doing that one.

    The whole reason that I’m calling wpmu_validate_user_signup is to not have to totally reinvent the wheel.

    However I don’t understand why doing a normal translation of WP isn’t picking this up. They should get edited in the language pack for the base WP, and not have to be handled by a plugin. Realistically, item #2 should fall into that. I was using standard WP strings that already exist and should be already translated/able.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Okay, FINALLY fixed all this.

    The folder’s i18n and there’s a default MO in there for you. I suck. Sorry about that.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘translation’ is closed to new replies.