I've configured a mult-site setup using sub-domains for each language, one database and all shared tables. I would like the default english home page to be domain.net rather than domain.n/hoetme/node.
Is there any way to do that? In the localizer config for switch by host name, I remember being told that the hostname field cannot be left blank.
At present I have
domain.net (default english)
de.domain.net
es.domain.net
it.domain.net
tr.domain.net
I'm testing out multisite and og modules to have home pages with content for each language.
Any suggestions on how to configure localizer to show the domain.net as default home page with default language content?
Thanks in advance!
Comments
Comment #1
Mojah commentedIt appears that if I put the domain.net as the hostname for the default language, it works! Surprise ;)
Comment #2
Mojah commentedHere's where I am testing...
zenmate.com
The default english does not seem to work when I switch to the other languages and return to the home page. Content and navigation remains as the last selected language rather than switching to the english.
Comment #3
Roberto Gerola commentedIf you are using the option "Switch by hostname", you should disable all the
others switching options, except the first "Redirect the front page".
Comment #4
yelban commentedcan not detect language from browser both firefox and IE
some of $_SERVER["HTTP_ACCEPT_LANGUAGE"] is more then "2" character such like zh-tw, zh-cn
and IE usually only one ["HTTP_ACCEPT_LANGUAGE"] not array() such like "zh-tw"
and firefox HTTP_ACCEPT_LANGUAGE is "zh-tw,en-us;q=0.7,en;q=0.3"
both IE and firefox in HTTP_ACCEPT_LANGUAGE language is the first one,
so maybe use split or preg_match function can do same thing better. :)
1. use preg_match(), $lang is correctly language code, like "en", "jp", "zh-tw","zh-cn"...
----------------------------------------------------------------------------
----------------------------------------------------------------------------
2. use split(), $language[0] is the first language code
----------------------------------------------------------------------------
----------------------------------------------------------------------------
in localizer.module
--------------------------------------------------------------------
/**
* Get the language of the browser
*/
function localizer_get_browser_lang() {
$languages = localizer_available_uilocales();
$exploded_server = explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
$accept=explode(',',array_shift($exploded_server)); ;
foreach ($accept as $lang) {
$lang=substr($lang,0,2);
if (!empty($lang) && array_key_exists($lang,$languages)) {
return $lang;
}
}
return localizer_get_defaultuilocale();
}
------------------------------------------------------------------------
Comment #5
yelban commentedComment #6
Roberto Gerola commentedMany thanks.
I'll integrate your fix.
Comment #7
yelban commentedThanks Roberto Gerola too, Localizer is a very powerful drupal module,
upload zh-hant's(zh-tw) flag png file,
could be use in localizer\flags\
;)
Comment #8
Roberto Gerola commentedFixed
Comment #9
(not verified) commented