cms
cms copied to clipboard
Force language on foreign environment
I have a site in French, just by creating the application/i18n/fr.php translation file. The whole site, loaded on a hosted server, shows-up in French as soon as I'm using OS/keyboard in French. If I access the site from a en_US OS (Windows 7, Chrome)/keyboard, the translation is not performed. How can I force the use of French from the en_US (or any non-French) computer? Thx
Please change default language in bootstrap.php and config/site.php. I think it'll be sufficient.
'locale' => 'en_US'
- Disable in
bootstrap.php
autolocale
Kohana::init(array(
'autolocale' => FALSE
));
- Force language in
bootstrap.php
I18n::$lang = 'en';
- Delete cookies
@sandeepone Not needed to modify config file
@sergeyklay Perhaps we're not using this methods i just noticed. I prefer simple syntax & lightweight: https://github.com/gleez/cms/blob/master/modules/gleez/classes/i18n.php#L44
@sandeepone Hence we have 2 methods to solve this issue :)
@sergeyklay if Kohana::$autolocale
is FALSE it defaults to english
https://github.com/gleez/cms/blob/master/modules/gleez/classes/gleez.php#L117
Yes, but I18n::$lang = '...';
should sets needed value
Sergey is right. This should be added in bootstrap.php; example for French:
/**
- Impose fr_FR whatever the client configuration */ Kohana::init(array( 'autolocale' => FALSE )); I18n::$lang = 'fr';
Thank you guys, I have all your answers stored in my email box, but, again, I think that all these should be referenced somewhere in the wiki or FAQ so that others can better use your nice work.
@Opariti Thank you. We're working on bootstrap 3.x version, once we're done, we'll be adding all this info in wiki. It would be more helpful if you could share your french locale, we can add with rest of the locales.
@sergeyklay i know i18n::$lan= '...'
sets, but we still need to make it more mature.
https://github.com/gleez/cms/blob/master/modules/gleez/classes/i18n.php#L76
If i get some time over this weekend, i'll psuh commits
I'll keep this issue open until we cleanup the code and make it more mature.
@sandeepone Let's quickly go to BS3 :)