WordPress.org

Forums

Join My Multisite
[resolved] translation (8 posts)

  1. dokkaebi
    Member
    Posted 2 years ago #

    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/

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

    If you want to email me your .po file (ipstenu @ halfelf.org) I'll add it in the official release :)

  3. dokkaebi
    Member
    Posted 2 years ago #

    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.

  4. Everything's a work in progress, IMO ;) But when you feel like it's 'pretty good' feel free to email it :)

  5. dokkaebi
    Member
    Posted 2 years ago #

    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)

  6. I'll put this in the plugin for ya.

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

  8. Okay, FINALLY fixed all this.

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Join My Multisite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic