Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In Drupal 6 the default language is an object stored in a variable. So if you want to have different default languages for each domain/subdomain, you need:
1. Different settings.php files, one for each domain, see the handbook about multisite set ups, http://drupal.org/getting-started/6/install/multi-site
2. To properly set up the language default variable in settings.php. For English as the default language it would be:
$conf['language_default'] = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '');
English is the default language if no other is specified. For the subsite using the actual site's default language you can skip this configuration.
Comments
If you are using Domain
If you are using Domain Access for multisite solution, Domain Locale will allow to define default language and enabled languages per domain.
I have created a multisite
I have created a multisite multilingual drupal install, and have been strugling for ages with the translation lookup features.
I have got the main site in English, with all of the possible languages associated with it (and content to match).
I have created site two which is in English and uses some content from the main site and has blocks that are specific to this theme.
I then created site three which is in French and uses different content from the main site, but has the same blocks and same theme as site two.
This is all very easy to setup and select the appropriate settings (like you say you can choose the language on a per site basis using Domain Locale) however, this does not seem to all for the translated blocks to appear in the required language.
I know they work, because if I allow French in my site two, and go to sitetwo.com/fr the blocks appear in French. Similarly if I make the default language of site three English, then I can few the site in English and when I select sitethree.com/fr the blocks change to French.
This leads me to the conclusion that the blocks are not truly recognizing what language they are supposed to be in, if the sub-domain default language is different to English. Is this the case? Would the above article actually correct this bug?
I can provide more of a description if this is not accurate enough, or explained well enough.
Cheers,
J
What if English is not the
What if English is not the default language?
What do I do with this?
Replace it with your default
Replace it with your default language object - the values for at minimum for language, name, native will be different. The easiest way to look up these values is to look in languages table after you have enabled the language. For example for Hebrew it would be language=he, name = Hebrew, native=עברית, direction = 1, plurals = 2, formula = ($n!=1)
works well!
The only issue I can see is that this seems to do more than just set the default language, it also apparently prevents you from switching out of that language while one is at the same 'site'. Am I doing something wrong?
For Drupal 8
You can add something like this to your
settings.php
orsettings.local.php
to override what's set in the database: