browser_lang tag

We need your assistance to make the documentation accurate, user friendly and understandable. Therefore we welcome any tips or suggestions regarding documentation. Thank you in advance for your contribution.

However, we will not respond to technical support questions submitted using this form. If you are having difficulty with CMSMS and cannot find the solution on this website, please submit your question appropriately on our support forum at: http://forum.cmsmadesimple.org. Please remember to follow the forum rules when posting.

CMS Made Simple™ Partner



   Purpose

This plugin detects and outputs the language that the users browser accepts, and cross references it with a list of allowed languages to determine a language value for the session.

   How to use?

Insert the tag early into your page template (it can go above the <head> section if you want) and provide it the name of the default language, and the accepted languages (only two character language names are accepted), then do something with the result. i.e:

{browser_lang accepted="de,fr,en,es" default=en assign=tmp}{session_put var=lang val=$tmp}

{session_put} is a plugin provided by the CGSimpleSmarty module

   Available parameters

  • accepted (required) - A comma separated list of two character language names that are accepted.
  • default - A default language to output if no accepted language was supported by the browser. en is used if no other value is specified.
  • assign - The name of the smarty variable to assign the results to. If not specified the results of this function are returned.