Multiple language domains made easy

By:

on

December 13, 2013

With two back to back Drupal 7 multilingual projects involving unique domains for each language we kept running into the same frustration. Syncing the databases back and forth from local, testing, staging, and live environments in a way that does not require manually going into the database to chage the language domain settings seemed impossible, or at least as elusive as a fox.

All I personally wanted was a simple way to override the language domains depending on the environment I was working on. The easiest way I could imagine would be to set variables in the $conf array within the settings.php or a settings.local.php file. Sadly no such variables exist for the language domain settings as they are stored directly in the database via the core locale module.

Pouf!

The Language Domains module has been born

This little module will save you some serious minutes of frustration if you ever run into this situation. By storing the language specific domains within the settings.php or settings.local.php file on your non-live environments you can easily sync your databases and not have to worry about changing the configuration within the UI; never ever! You actually just keep your live domains configured in the database and let the module do the overriding. Its as simple as enabling the module and then updating settings.php to include code like the following for each of your language specific domains. (you should also clear the menu cache after all is set up.)

$conf['language_domains_en'] = 'inenglish.local'; 
$conf['language_domains_fr'] = 'enfrancais.local';

There you go world, a solution to another one of your infinite frustrations. :)

The module can be found on drupal.org at https://drupal.org/project/language_domains

 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.