Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Is there a way to toggle locales on the frontend?

edited February 2011 in Vanilla 2.0 - 2.8
In Canada we have some pretty strict rules that require EN and FR interfaces to web apps and content. I'm working on an internal company forum, and would like to be able to toggle the Locale between English and French. We do not want to run 2 separate forums.

I've tried setting $Configuration['Garden']['Locale'] = 'fr-FR'; but it seems to be cached, or saved somewhere else, because even when the config has changed, it seems that something else is needed before I see the changes. Is there a function or method I need to trigger to get it to toggle over?

Thanks.

Comments

  • You can look at files in cache folder.
    May be it is stored to libraries.
    Such function could be useful not to Canada only.
  • The code is there, I'm just having a hard time digging it out. I need to be able to run the same functions that run when you toggle the locale on the back-end.

    I'll have people browsing the forum in both languages simultaneously, is this going to be an issue IF I get it working? Does the caching take the language into consideration?
  • edited February 2011
    Look at bootstrap.php
    for code:
    Gdn::FactoryInstall('Dummy', 'Gdn_Dummy', PATH_LIBRARY_CORE.DS.'class.dummy.php', Gdn::FactorySingleton);

    I think this is place where locale is set.
    But it looks like it uses your setting in config.
    May be you could use some parameter like "?lang=fra" and look for it here and switch to 'Garden.LocaleAlt' setting in this case.
    Inform me if you'll find how to do this, ok?
  • Would be a neat feature, when Vanilla turns multilingual for users :) Something, that probably could go into it as a standard feature (Browser language detection would be creme-de-la-creme)
Sign In or Register to comment.