WordPress.org

Ready to get started?Download WordPress

Forums

MailChimp List Subscribe Form
PO/MO files not working between servers (16 posts)

  1. jdkoelsch
    Member
    Posted 1 year ago #

    I just want to modify the success message that's displayed by the signup form. I've tried to follow the suggestions in other threads about updating the po file and generating an mo file. I've never done this before, so I'm not sure if I'm doing something wrong, but I'm having an issue with the file. I generate the file locally on my mac using POEdit as suggested, and then commit to the git repository, which then deploys it to a development server.

    The file works great locally, but the very same file displays incorrect messages on the development server. For instance, instead of saying "That email address is invalid" it says something about interest groups.

    Is there an issue with generating the files and using files on different operating systems?

    Also, as I'm not familiar with these po/mo files, am I correct in assuming that you won't overwrite them when you do a plugin update? We have a somewhat automated update process, and I am extremely hesitant to update plugin code, for fear that I'm going to have to manually apply patches to the plugin after updates.

    Thanks!

    http://wordpress.org/extend/plugins/mailchimp/

  2. mc_tak
    Member
    Posted 1 year ago #

    Hey hey,

    Sorry for the delay in response! That definitely sounds a bit odd! To clarify, the process of generating and using the translation files shouldn't different from one operating system to another, so we'll want to look at some other possible reasons why this issue is occurring.

    Generally the translation files not working properly are due to something having gone awry in the translation file's creation or how it's being setup on the server, so we'll want to go through the proper steps to make sure that the ideal process of doing so is being done.

    Steps:
    1) Generate the PO and MO files for your translation.
    2) Move the files onto your development server (So, instead of contributing to the git repository, you'll want to manually transfer the files onto your server).
    3) Make the configurations to your wp-config file to define your WPLANG to your language.

    If you're still seeing incorrect translations, open up that PO file to ensure that the translations are set properly. You can also try regenerating your MO file to ensure that it's up-to-date.

    If after checking this you're still seeing issues, can you provide me a link to your website with the form in question and some examples of incorrect translations (as well as the expected correct ones) and I'd be happy to take another look!

    As far as your question regarding updates, updates to the MailChimp plugin will in fact delete your custom translation files, so make sure that you keep these files backed up on your end. After the plugin is updated, you can then re-add those files to your plugin's folder and those translations should fit right back in. Editing the WPLANG again will NOT be necessary, as that should not be overwritten with our plugin's updates.

    Let me know if you have any questions!

  3. Lenin
    Member
    Posted 1 year ago #

    I have translated to Arabic version using poEdit. And I am interested to submit the translation to Mailchimp's plugin git for contribution.

    But I need the step by step instructions on implementing the .mo file.

    In my site's localization ar_SA didn't work even though I have set WP_LANG as ar_SA. It works as ar.mo though.

    I have tried the same for the plugin but it didn't work.

    If the plugin sets correctly for translation I'll submit my site URL(I'm implementing it in two Bilingual(English and Arabic) Arabic sites).

  4. mc_tak
    Member
    Posted 1 year ago #

    Hey Lenin,

    Thanks for your contributions! I went ahead and tested your bn_BD.po file and it looks like it's working just fine!

    Here's the step-by-step process that I used:
    1) Download the PO file (bn_BD.po)
    2) Open the PO file using POEdit
    3) Double-check that the translations appear. (screenshot)
    4) Save the file. You should now see that a .mo has been generated in the same directory as your .po file.
    5) Move both the .mo and .po files into your MailChimp plugin's PO directory (folder structure: wp-content > plugins > mailchimp > po).
    6) Open your wp-config.php file in an editor.
    7) Change your code to read

    define('WPLANG', 'bn_BD');

    (screenshot)

    You should now see your translations working on your sign up form. Here's how it looks on my end: screenshot.

    If you have any questions, let me know!

  5. Lenin
    Member
    Posted 1 year ago #

    So there's nothing wrong with my .po? Have you also tested the Arabic one? There are four strings not submitted but I already translated them and was waiting for your response for I was not being able to see them in action.

    I tested with define('WPLANG), 'bn_BD') and define('WPLANG','ar_SA').

    Why does the 'Email Adress' come in English in your screenshots?

  6. mc_tak
    Member
    Posted 1 year ago #

    Hey Lenin,

    Just tested the file titled "ar_SA" and that's working just fine too. (Though I did notice that there were 4 translations not set).

    A few things worth pointing out:
    -When you add them to your MailChimp plugin's PO folder, use the same naming conventions as the other translation files: "mailchimp_i18n-ar_SA.po" and "mailchimp_i18n-ar_SA.mo" for example.
    -In your example code, you wrote "define('WPLANG), 'bn_BD')". The syntax here isn't quite correct, you'll want to make sure that parentheses sign is an apostrophe instead, so something like this:

    define('WPLANG', 'bn_BD')

    Also, in regards to "email address" showing up in English in my screenshot, that's actually because the error message is pulling in the merge field's name in that instance. So, because I have my "email address" field in English in my MailChimp account, that's appearing in English in the error messages too.

    Let me know if you have anymore questions!

  7. Lenin
    Member
    Posted 1 year ago #

    I have kept the file naming convention correct to my knowlege and as I have also sent GIT pull request on the mailchimp repository. You'd be able to see the files for yourself too.

    The WPLANG line I wrote here was typed so was wrong. In the file, I have checked that it is okay.

    Tried to switch for both languages. And it didn't work.

    A question, when would the language change for Ajax? I have two modes, Arabic and English.

    ps. I will submit the 4 missing arabic lines as soon as I can get all these working fine.

  8. Lenin
    Member
    Posted 1 year ago #

    I have now pushed all the strings for Arabic as well. But not being able to see the result myself.

    And for contribution, should I generate another pull request?

  9. mc_tak
    Member
    Posted 1 year ago #

    Hey Lenin,

    Sorry to hear that you're still seeing issues with the translations! To clarify, contributing to the repository is not required, so as we continue to troubleshoot this, we'll want to avoid any steps with the repository so that we can better isolate why the issue is occurring.

    First, let's try deleting the .mo file, so that we can ensure that we're generating a brand new, up-to-date version. At this point, you should only have your .po file. Open up your .po file in POedit and confirm that the translations are appearing there. Then click "save". You'll want to confirm that your new .mo has generated.

    At this point, you want to move these two files into your plugins > MailChimp > po folder. Make sure that they follow a consistent naming convention as the other .po files that are there.

    Next, change your wp-config.php so that your WPLANG is set to the appropriate language.

    If you're still seeing issues, can you confirm the following information while you performed the above steps?
    -Names of your .po and .mo files
    -The directory that your .po and .mo files were moved into
    -The line of code that your WPLANG define was set

    Also, can you email your .po and .mo files that you uploaded into your directory to examples@mailchimp.com, with the subject line: "Attention: mc_tak"?

    Thanks!

  10. Lenin
    Member
    Posted 1 year ago #

    Though I have followed these steps about 50times already, I'll again try and then inform you.

    I am using the same versions of .po I have submitted to github.

    I know contribution is not mandatory. But as I had the chance to translate two of the languages which were not there yet, I would like to contribute. Especially, I want to contribute my own language from the same spirit I have translated Facebook in my own language and I am top translator for over 4 years.

  11. Lenin
    Member
    Posted 1 year ago #

    I have found the problem. I need a little guide regarding this.

    I have placed a print_r at the mailchimp.php at line 59, which looks like:

    function mailchimpSF_plugin_init() {
    // Internationalize the plugin
    $textdomain = 'mailchimp_i18n';
    $locale = apply_filters( 'plugin_locale', get_locale(), $textdomain);
    print_r(MCSF_LANG_DIR.$textdomain.'-'.$locale.'.mo');
    load_textdomain('mailchimp_i18n', MCSF_LANG_DIR.$textdomain.'-'.$locale.'.mo');

    // Bring in our appropriate JS and CSS resources
    mailchimpSF_load_resources();
    }

    Now this shows the proper language while the site's language is changed at the head. But when I submit into the mailchimp subscription form it shows the en_US.mo as selected. what is wrong?

  12. Lenin
    Member
    Posted 1 year ago #

    Solved this by:

    if ( defined( 'WPLANG' ) )
    $locale = WPLANG;

    $textdomain = 'mailchimp_i18n';
    $locale = apply_filters( 'plugin_locale', $locale, $textdomain);

    But, this wont work for bilingual.

  13. mc_tak
    Member
    Posted 1 year ago #

    Hey Lenin,

    Thanks for keeping us up-to-date with your troubleshooting, this can definitely be helpful to other users in case a similar issue arises in the future. To confirm, are you now successfully seeing your custom translations with the changes made from your most recent reply?

    Also, what particular issues are you running into that is causing your bilingual setup to not work with the plugin? Are there any particular limitations you're running into that your bilingual setup requires, that the plugin isn't allowing for? While I'm not able to provide support regarding specific changes to the code that need to be made, I can definitely offer to take the information on what issues you're having and pass them along on my end to see if it's something we can work to accommodate in a future release.

  14. Lenin
    Member
    Posted 1 year ago #

    Yes, the trick I used works but thats for a single language as it relies upon WPLANG setting in wp-config.php.

    I have found that WP's get_locale() function fails to detect the WPLANG while the ajax call works either from the mailChimp widget or the form.

    I am using qTranslate for getting the sites bilingual. While, I used qtrans_getLanguage() inside the mailchimp.php, it also fails to tell the correct current language while the ajax calls from the form.

    I would appreciate if you provide us a known option for switching language s while supporting multilanguages.

  15. mc_tak
    Member
    Posted 1 year ago #

    Hey Lenin,

    Would you mind hopping into our live chats when you have a moment? Here's our Support link:

    http://kb.mailchimp.com/

    If you could request me, TK, I'd be happy to chat with you so we can get this all sorted out!

  16. Lenin
    Member
    Posted 1 year ago #

    I have solved the problem and posted here. Thanks for your quick response and offer for support!

    http://stackoverflow.com/questions/13923157/qtranslate-do-not-detect-properly-when-called-from-inside-a-plugin-through-ajax/13924037#13924037

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags