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.

How to create a language switch button ?

edited November 2011 in Vanilla 2.0 - 2.8
Hi everybody,
I would like to create a button to switch between french and english (two locales). The purpose is to allow all visitors to see the website in their language.
I've tried to overwrite the values of

but it doesn't seems to work correctly...
Is there a plug in to do this ?
Thanks a lot !

Best Answer


  • Options
    x00x00 MVP
    edited November 2011
            $Locale = 'Locale Name';
    setlocale(LC_ALL, $Locale);
    $Gdn_Locale = new Gdn_Locale(
    Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', NULL, Gdn::FactorySingleton, $Gdn_Locale);
    You need to hook early like the dispatcher. Save the locale using sessions or user meta.

    grep is your friend.

  • Options
    LincLinc Detroit Admin
    Funny you should mention this. I'm writing a plugin to do this for a client right now.
  • Options
    LincLinc Detroit Admin
    Answer ✓
    I'll probably release it officially next week, but you can grab it over here if you want to help test it:
  • Options
    Ok thanks ! I'm trying all this right now ! ^^
  • Options
    edited November 2011
    @Lincoln: Good job, pal ! The links works well... thanks

    some bugs (?) :
    ?locale= doesn't works ( maybe because of url rewritng)
    the method doesn't works either.
  • Options
    You saved me a lot of time... ;)
  • Options
    I'll wait for the final plug in to be live. Thanks!
  • Options
    edit of this morning : the script method, doesn't works. ^^
  • Options

    I was looking for this add-on all day and finally found .. Thank you very much for your work.

  • Options

    @Lincoln I just downloaded your "Multilingual" plugin but after installing it and enabling it, when I click on a language to switch, it doesn't work - i.e. just reload the same page in the default language.

    I'm using "Version" of Vanilla Forums.

    Concerning the locales, I downloaded them from

    Thanks in advance for a short feedback.

  • Options
    LincLinc Detroit Admin

    Multilingual may not work in I may have made alterations to core to accomodate it, so you'd need to use an "unstable" version or wait for 2.1.

  • Options
    edited January 2012

    Hey, as said above your plugin indeed does not work with, i installed it (edited the file so it would allow me to install), it successfully installed and enabled plugin and the language switcher appeared on the bottom of the page, however switching languages doesn't work. Just nothing happens. Anyway we can expect a fix soon enough or maybe i am doing something wrong?

    For all those experiencing problems, plugin works fine with this version.

  • Options

    Hi @Lincoln,

    Could you point me the specified "unstable" version that I could use and maybe improve/fix by myself please? A link to github should be enough ;-)

    I really hope to see this plugin either part of the vanilla core, or else released with backward compatibility!

    Thanks in advance for a short feedback!

Sign In or Register to comment.