How to setup Mailchimp in a multilingual D7

In this brief tutorial I will show you how to setup and configure Mailchimp for a multilingual Drupal 7 website and succeed in translating the Signup form field labels.

Sometimes, I find that working with Drupal requires a strict recipe-like approach in order to reach the desired outcome - and perhaps avoid going insane. In other words, the order in which you perform each step is important.

When you set out to make banana bread, it is not sufficient to know that you need 2 cups of flour, 2 eggs, 1/4 cup of butter, 1 cup of milk and, of course, 2 blackened bananas. If you mix the ingredients in the current order, your likely to run into trouble. Knowing a thing or two about basic cooking will help you come up with the appropriate workflow that will have your friends and colleagues raving about your banana bread.

The following recipe is the result of many hours of issue queue scavenging and community help, mixed in with trial and errors - required skills for any Drupal chef. The workflow that works for me may or may not be completely appropriate for your use case. But it should definitely give you a head start.

Installation procedure

I'm not going to delve into how to install Mailchimp - no recipe book gives you directions on how or where to buy flour & eggs, right? Everything you need to know for this procedure is available on Mailchimp's project page or in the Community Docs. I'll give but one advice: install the appropriate Mailchimp library first i.e. before you enable the Mailchimp module.

Prerequisites

  1. Install the latest dev dated 2015-Sep-16 (7.x-3.6+2-dev) or better. As far as I know, the following workflow will not work if you use older versions of the 7.x-3.x branch.
  2. Drupal's default language (admin/config/regional/language) must match with your Mailchimp account's Signup form Field labels.
    • if Drupal's default language is English then make sure that Mailchimp's Signup form labels are also in English i.e. Email Address, First Name and Last Name.
    • if Drupal's default language is French then make sure that Mailchimp's Signup form labels are also in French i.e. Courriel, Prénom and Nom.

Workflow

  1. make sure the Mailchimp Lists module is enabled (I'm assuming your MailChimp API Key is saved at admin/config/services/mailchimp.
  2. go to admin/​config/​services/​mailchimp/​lists and click on Refresh lists from MailChimp.
  3. Flush all caches.
  4. go to admin/​config/​services/​mailchimp/​signup to edit your signup form; you should now see your field labels under Merge Field Display as they appear in your Mailchimp account's Signup form Field labels.
  5. Save the form.
  6. finally, go to admin/​config/​regional/​translate/​translate and search for the strings you need to translate.
    • if Drupal's default language is English, search for e.g. Email Address and translate to the other language(s).
    • if Drupal's default language is French, search for e.g. Courriel and translate to the other language(s).

That should do it, for Mailchimp I mean.

Bonus

As for the banana bread, well here's the full recipe. Sorry, there's no module for that.

Ingredients

Mix until homogenous (remember, order matters):

  • 1/4 cup of sugar
  • 1/4 cup of melted butter
  • 2 eggs
  • 2  blackened bananas (mashed of course)

Set oven temperature to 350F (180C). In a measuring cup, add:

  • 2 cups of flour
  • 2 teaspoons of Magic Baking Powder
  • 1 teaspoon of Baking soda
  • 1/2 teaspoon of salt

Mix gently until homogenous in 3 to 4 steps along with 1 cup of milk.

  • add 1/4 cup of chocolate chips (more if you've been waiting for Drupal 8 for more than a year).
  • pour mixture in a lightly buttered pyrex dish (8"x8"x2"). Add chopped nuts on top of the mixture if you want.
  • bake for about 60 minutes.

Bon appétit!

Submitted by Daniela Contreras (not verified) on Sat, 05/28/2016 - 08:06

Permalink

I followed your steps but D7 still showing "Email Address" on the signup form, and I have this label "Correo" on mailchimp.

Submitted by ren.admin on Sat, 05/28/2016 - 10:22

Permalink

Hi Daniela, i do recall running into such an issue in a recent project with MailChimp 7.x-3.6+2-dev (2015-Sep-16) and had to patch mailchimp_signup.module to fix it. Have you tried the latest dev for 7.x-3.x (2016-Mar-30) ?

Submitted by Daniela Contreras (not verified) on Mon, 05/30/2016 - 02:56

Permalink

Hi Ren, thanks to answer me, I'm using Mailchimp 7.x-4.4 (2016-May-14). Should I use the latest dev for 7.x-3.x (2016-Mar-30) ?.

Submitted by Daniela Contreras (not verified) on Mon, 05/30/2016 - 04:30

Permalink

Hi again Ren, finally I decided to use the version you mentioned (7.x-3.x (2016-Mar-30)) and it seem to be ok.

Thank you!