Newsletter

KB Article

GP COM
Adding web site (front-end) language

Adding web site (front-end) language

This article will describe how to add new language to your web site or add new front-end language. To be able to follow this steps you shouyld be familiar working in TYPO3 back-end. So, to add language, ou need to follow this procedure:

  1. Go to "Web>List" module, in page tree select top most element ("Template 1", for example)
    Create new record of type "Website Language". When done, you will see new record in "Website Language" section. Check ID of new recor, you would need that later.
  2. Go to "Web>Template" module, in page tree select root page of web site ("First Page", for example).
    In right frame ("Template Tools"), in selector in right part of the pag select 2nd item ("Info/Modify"). Then edit setup part (click on pencil icon to the left of setup text).
    you config part should look like:

    config {
    language = en
    htmlTag_langKey = en

    locale_all = en_GB.utf8
    metaCharset = utf-8
    renderCharset = utf-8
    notification_email_charset = utf-8
    notification_email_encoding = quoted-printable
    ...

    then add following 2 lines (makred with bold):
    config {
    language = en
    htmlTag_langKey = en
    linkVars = L
    uniqueLinkVars = 1


    locale_all = en_GB.utf8
    metaCharset = utf-8
    renderCharset = utf-8
    notification_email_charset = utf-8
    notification_email_encoding = quoted-printable
    ...

  3. (This step is optional)
    To have nice URLs, you should update your RealURL configuration. It is situated in general TYPO3 configuration file (typo3conf/localconf.php) or in separateconfiguration file (typo3conf/realurl_conf.php) depending on your T3R template version.
    In the pagepath section you should add 1 line ('languageGetVar' => 'L',), smh like this:

    'pagePath' => array(
    'type' => 'user',
    'languageGetVar' => 'L',
    'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
    'spaceCharacter' => '-',
    'expireDays' => 7,
    'disablePathCache' => 1,
    'rootpage_id' => 3,
    ),

    Also you should add following preVars section:

    'preVars' => array(
    array(
    'GETvar' => 'L',
    'valueMap' => array(
    'de' => '1',
    ),
    'noMatch' => 'bypass',
    ),
    ),


    continue needed parts of steps 1-3 to add more then 1 additional web site language.

  4. Go to "Web>Page" module, in page tree select page you need to translate. In the top of right frame select "Localization view" tab. Use "Create new page translation" function to add translation to this page.
  5. For each content element, you wold see "Create a copy for translation" function. Use it to create translation of this content element.

    Repeate step 5 for each content element needed for translation. Repeat step 4 for each page that needs translation.

  6. (optional)
    You could use following TS to generate menu for switching languages:

    lib.langmenu = TEXT
    lib.langmenu {
    value = German version
    typolink {
    parameter.data = page:uid
    additionalParams = &L=1
    addQueryString = 1
    addQueryString {
    method = GET
    exclude = cHash,L
    }
    }
    }

    [globalVar = GP:L = 1]
    lib.langmenu.value = English version
    [end]

Category: TYPO3 CMS