Query_String Language switch button for Bootstrap website

edited September 2014 in Modules
Hi,

Sorry that I'm new in fuelcms and I would like to get some idea of the language switch button.

I've create a website which used Bootstrap and query_string for language_mode.

In my header block, below is the switch button code:

EN
DE

I just want to change the "http://www.mydomain.com/aboutus?&lang=en" lang value to switch the language, any suggestion? Or any other method for the language switch just like the inline editing language switcher?

Many thanks.

Azid

Comments

  • edited 4:12PM
    i think http://docs.getfuelcms.com/general/localization did explain the query string method...

    However i doubt your en lang works, as default it is "english"
  • edited 4:12PM
    Thanks onegun.

    Yes I change the lang value (de / en) at URL by hand working very well.

    Just wonder any simple method to switch the language by a button.
  • @azid, would you be able to tell me how you used bootstrap with the menu class? I am having issues implementing it. Thanks,
  • edited 4:12PM
    Sorry archienorman11, I just start up my learning of fuelcms in layer, block and page.
    Menu class will be the next step after I solve the language button.
  • edited 4:12PM
    The way to switch the language is through the URL. The site_url() function has been augmented in FUEL to have a 3rd parameter which will attach a language value to the URL (2nd parameter is for https).
    echo site_url('my_url', FALSE, 'de');
  • edited 4:12PM
    Many thanks! Finally, I use:
    echo current(False, 'de');

    But, when I click the English button, the URL doesn't show the query_strings value and it stay at Deutsch page. After I manually add ?&lang=en on the URL it can show correctly.

    Any idea why it happened? And could I fix all URL show the query_string value even Default English pages?

    Thanks a lot.
  • edited 4:12PM
    In the current version of FUEL, if no segment or query string value is set it will check the cookie value. If you add something like the following in your fuel/application/views/_variables/global.php, it will deactivate the cookie:
    $CI->fuel->languages->use_cookies = FALSE;

    Also, I just pushed a change to the develop branch which includes a new FUEL configuration parameter called "language_force_default_to_site_url" which if set to TRUE will automatically append it to the default language URLs:
    https://github.com/daylightstudio/FUEL-CMS/commit/09ebe43fe214adee6ceb153f1f09824fcc4e8969
  • edited 4:12PM
    Great! It works.

    Many thanks~!!!
Sign In or Register to comment.