21302 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 945 Views |
-
Language fallback mechanism

24 August 2010 at 7:10pm
Hi, I'm using SS 2.4.1 with multilingual site (Translatable extension).
I would like to know if there's any client language recognition? If so, how is it working?
I've set default language to different one than is my locale, and I've received page in default language (so it's not working, but I might set something wrong).
What I'm looking for is a mechanism that would try to set language to client locale language and if there isn't such translation it should fallback to default one.
Also what do you think about setting lang to $_SERVER["HTTP_ACCEPT_LANGUAGE"]. Is it safe?Regards
-
Re: Language fallback mechanism

27 August 2010 at 10:22pm
Hey,
I placed this code in page_controller init function.
if (substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)!='de') {
Translatable::set_current_locale('en_US');
i18n::set_locale('en_US');
} else {
...
}
However, it did it's job only partial. I got navigation from appropriate translation, but haome page and error pages came from default locale.Than I moved this code to _config.php. And it solved all my problems.
However it seems like an ugly hack. Anyone has a better idea?Note: I know it's a really simple condition, but I have a bilingual site and I'm not looking for anything sophisticated.
| 945 Views | ||
|
Page:
1
|
Go to Top |

