Blog: Democracy In Action
Integrating Drupal, Democracy in Action, and i18n
Making It Possible To Collect User Information in Five Languages
Making It Possible To Collect User Information in Five Languages
The United Nations Millennium Campaign gathered millions of people around the world this week to stand up against poverty and in support of the UN’s Millennium Development Goals. We were heavily involved in developing the Stand Up Speak Out campaign's Drupal website, StandAgainstPoverty.org, and had a great time adding some interesting and important features to the site.
A very important part of that development work revolved around the need to make the site viewable in five languages (English, French, Portuguese, Spanish and German, for those keeping score). The real trick was that the campaign wanted to collect information from the people visiting their website using their CRM system - Democracy In Action's (DiA) Salsa toolset - but the toolset only handled information in English. I'll explain in this blog post how we used Drupal to get DiA's CRM to also handle information in the site's other four languages.
We used a number of i18n-related modules to make translation easy and integrated several forms created using DiA in a way that made the forms i18n-friendly for fast translation. The approach described below is not ideal, but it was executable in the short timeframe in which we were operating. Ideally, we'd make better use of DiA's API so that form-creation is accomplished in DiA's Salsa interface, and Drupal could query the details of the various form pages and build Drupal forms on the fly with that data.
Given our time constraints, we built the forms manually. For anyone who needs to quickly build forms in Drupal, I can't recommend the Forms API Quickstart Guide on Drupal.org highly enough - it helped shake out the cobwebs.
Building the two forms was straightforward enough. I began by adding a menu callback to my module, then added the page building function, and then built my form out.
// Menu callback
$items[] = array(
'path' => 'path/to/my/form',
'title' => 'DiA Signup Form',
'callback' => 'dia_signup_page',
'access' => TRUE,
);
[...]
// Page building function
function dia_signup_page() {
return drupal_get_form('dia_form');
}
There are several things to keep in mind here. First, in order to make these forms available to the l10n_client for easy translation, you will need to wrap your field titles in Drupal's t() function.
// Sample form field
$form['dia']['First_Name'] = array(
'#type' => 'textfield',
// Make translation easy--always use the t() function!
'#title' => t('First Name'),
'#size' => 30,
'#maxlength' => 64,
);
In Drupal, you can save your hidden form fields and add them in your form submission function, thereby eliminating another place where unexpected client input may cause headaches (or worse). DiA forms make heavy use of hidden fields when custom data is collected or when user submitted records are added to DIA groups.
Stand Up Against Poverty
Speaking Up to End Poverty Using a Drupal Website
Speaking Up to End Poverty Using a Drupal Website
Today is your day to speak up and do something to help end poverty. The United Nations Millennium Campaign is gathering people around the world today to stand up against poverty and in support of the UN’s Millennium Development Goals. The campaign – called Stand up Speak Out – takes place over just 24 hours, and last year 23 million people stood up against poverty, setting the world record for the most people standing up for a cause. The event is more than halfway over now and looks like it is well on its way to beating its own record.
For the last two months we’ve been working with Jason Wojciechowski and his team at the UN Millennium Campaign on the Stand Up Speak Out website. StandAgainstPoverty.org is a Drupal site that Jason built last year on 4.7 and that we helped him redesign and improve for this year's event (it now runs 5.2). We had a blast coming up with ways to make it easier for people to participate in the campaign online and for the UN Millennium Campaign to really show off the huge numbers of people that are standing up against poverty.
For months now organizers around the world have been mobilizing to set up events where people could join together in person to stand up, and for the past month they’ve been registering these events at StandAgainstPoverty.org. Organizers are now returning to the site to log the number of people that participated in local events and upload their photos. So far 2,018 photos have been uploaded to Flickr showing people from around the world – from school children in India to office workers in Portland – standing up against poverty. We had a lot of fun working on the site’s Flickr implementation – users submit the photos on their event page on the Drupal site, and then the images are tagged with the event title and uploaded into the campaign's Flickr account. It makes for a great Flickr feed and should save the UN Millennium Campaign a ton of time.
For the first time this year users who can't attend a physical event can “stand up” online and join in the attempt to break the world record. This is a great option to offer users, especially considering the increasing number of people the UN Millennium Campaign has been able to engage online in recent months. They're working with Change.org to facilitate online actions for English-speaking users. They also built a Facebook app.
Since Change.org doesn't yet have multilingual support and Stand Up Speak Out is collecting information in five languages, they chose to collect information for other languages by using the combined toolsets of Drupal and Democracy in Action, a powerful CRM tool for non-profits. Drupal's robust internationalization support and ease of use for translators (the Stand Up Speak Out campaign helped fund recent UI work on the l10n_client module) made it simple for users to stand up in any language, and Democracy in Action's great API allowed us to pass all the information into that system for easy reporting later on.
With less than 4 hours remaining in the campaign, everything seems to be running very smoothly. We're excited to see what happens with it! A big congrats to Jason and everyone else involved in organizing this for a successful event and a great Drupal site.
If you haven't yet, join in the activity and be part of a world record! Stand up online against poverty now at http://www.standagainstpoverty.org. You can only participate until 5 pm EDT, so please take action soon. We did this morning : )




