browser_lang tag

   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.