Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force language on foreign environment #590

Open
Opariti opened this issue Nov 15, 2013 · 10 comments
Open

Force language on foreign environment #590

Opariti opened this issue Nov 15, 2013 · 10 comments
Assignees

Comments

@Opariti
Copy link

Opariti commented Nov 15, 2013

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

@sandeepone
Copy link
Member

Please change default language in bootstrap.php and config/site.php. I think it'll be sufficient.
'locale' => 'en_US'

@sergeyklay
Copy link
Contributor

  1. Disable in bootstrap.php autolocale
Kohana::init(array(
    'autolocale' => FALSE
));
  1. Force language in bootstrap.php
I18n::$lang = 'en';
  1. Delete cookies

@sergeyklay
Copy link
Contributor

@sandeepone Not needed to modify config file

@sandeepone
Copy link
Member

@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

@sergeyklay
Copy link
Contributor

@sandeepone Hence we have 2 methods to solve this issue :)

@sandeepone
Copy link
Member

@sergeyklay if Kohana::$autolocale is FALSE it defaults to english
https://github.com/gleez/cms/blob/master/modules/gleez/classes/gleez.php#L117

@sergeyklay
Copy link
Contributor

Yes, but I18n::$lang = '...'; should sets needed value

@Opariti
Copy link
Author

Opariti commented Nov 15, 2013

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 Opariti closed this as completed Nov 15, 2013
@sandeepone
Copy link
Member

@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 sandeepone reopened this Nov 15, 2013
@ghost ghost assigned sandeepone Nov 15, 2013
@sergeyklay
Copy link
Contributor

@sandeepone Let's quickly go to BS3 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants