Menu


How to set up a multilanguage site configuration from Typoscript

If you need to set up a multilanguage site

Step 1

First add the languages in to the root of your site:

  • Click the Add button and choose Website Language
  • Add the languages you want
  • remember the unique id assigned to each language, you can see it after you added the language by moving the mouse over the icon of the language (a hand that holds a globe), it will display something like "id=1"

Step 2

After you completed the first step, you need to write some special Typoscript configuration into the root typoscript template of your site.

Here is the code:


config.linkVars = L , type
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN

[globalVar = GP:L =0]
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN
[global]

[globalVar = GP:L =1]
config.sys_language_uid = 1
config.language = de
config.locale_all = de_DE
[global]

[globalVar = GP:L =2]
config.sys_language_uid = 2
config.language = fr
config.locale_all = fr_FR
[global]


Please change the L and the sys_language_uid values to the ids you learned at step 1

Example:

So if you have id=3 for dutch for example then you have to make the following changes in the code above:

  • add a new condition:
    [globalVar = GP:L =3]
  • specify sys_language_uid:
    config.sys_language_uid = 3
  • add language code
    config.language = nl
  • add locale
    config.locale_all = nl_NL
  • end condition
    [global]

The code above makes all the magic. So now when you access the page using an additional L parameter, this parameter will give the language of your site.

www.example.com or www.example.com?L=0 this will be default language, english here (en)
www.example.com?L=1 this will be german language (de)
www.example.com?L=2 this will be french (fr)
if you added dutch then www.example.com?L=3 this will be dutch (nl)






Google Search

 
wiki.lacisoft.com
WWW
2009-2011 (c) Lacisoft.com