1

Creating an installation profile for a french site.

I have hit a brick wall trying to have the profile install fr language translations. I have tried adding this to my profile as this comment http://drupal.org/node/1297438#comment-6308144

// Add french language.
locale_add_language('fr', 'French', 'Français', LANGUAGE_LTR, '', '', true, true);
drupal_set_message(t('The language %language has been add and is now the default language.', array('%language' => 'french')));

Code above generates a fatal error:

[drush] Fatal error: Call to undefined function locale_add_language() in /home/stef/jmt-www/build/www/profiles/jmt_profile/jmt_profile.profile on line 19

I have the fr.po file in profile/jmt_profile/translations but have no clear way of getting the fr.po loaded. Has anyone dealt with installing secondary languages without going through ui?

3

You must include locale.inc before:

include_once DRUPAL_ROOT . '/includes/locale.inc';
locale_add_language('fr', 'French', 'Français', LANGUAGE_LTR, '', '', true, true);
  • Hey brother. Welcome to Drupal Answers, thanks for the contribution! – stefgosselin Sep 25 '13 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.