This page is still a beta!

1.2. Configuration

One-Tree vs. Multiple-Trees concept

While creating multi-lingual websites with TYPO3 generally you have two ways to do that:

  1. either create one page tree which contains a single page for each language, i.e. using TYPO3's language overlay concept

  2. or create multiple page trees, one for each language. In this case you want the visitor to start at different pages depending on the preferred language.

Installation

Installing this extension is fairly easy. Just download it via the extension manager (EM) and click on the install button.

Using the One-Tree concept with TYPO3

There's (almost) no configuration necessary! The only things you'll have to take into account are the titles of your supported languages. Let's see how it works:

You create your website's languages just as normal, but instead of choosing a descriptive title like "english" or "german" you'll have to use the two-letter country codes defined in ISO 3166 (see Appendix A for a full list).

You only have to define the addtitional languages, your default language (L=0) will be used whenever no other language seems to fit. So if your website provides german, english and spanish, your website languages list might look as follows:

Using the One-Tree concept with TYPO3 version 3.6.0 or later

If you have the table static_languages installed (which you should if you're running TYPO3 3.6.0 or later), it's even one step easier: You don't have to care about the language's title, just choose the right ISO code instead (as you can see in the next screenshot):

Defining the default language

You should define which language is your default language, ie. the ISO code of the language which will be shown with the parameter L set to zero. See the TypoScript Reference below how to set the default language.

Doing it with multiple page trees

So you need different structures for each language? Then you will likely choose the multiple page tree method (this method is explained on this page at typo3.org).

In order to enable it, you'll have to add some TypoScript to the setup field of your root template. Just have a look at the example:

plugin.tx_rlmplanguagedetection_pi1 {
   useOneTreeMethod = 0
   multipleTreesRootPages  {
      de = 216
      en = 120
      es = 482
   }

}

First you disable the One-Tree-Method by setting useOneTreeMethod = 0. Then you define the unique ids of those pages being the root page for each language.

In our example visitors who prefer spanish will automatically guided to the page with the id 482 if they enter the website.

TypoScript Reference

Property:

Data type:

Description:

Default:

useOneTreeMethod

boolean

If true, the One-Tree-Method will be used, otherwise the Multiple-Trees concept is chosen.

See the manual for more information about these two concepts.

1

multipleTreesRootPages

array of isocodes

When using the Multiple-Trees-Method, you have to define the different languages which are available throughout your website. You do that by using isocodes for the languages and pointing them to the appropriate page id.

Example:

...

multipleTreesRootPages  {
   de = 216
   en = 120
   es = 482

}

defaultLang

string

Set this to the ISO code of your default language (L=0)

plugin.tx_rlmplanguagedetection_pi1 {
   defaultLang = de

}

dontAddSchemeToURL

boolean

When the URI is built for redirecting to a different page, the URL is parsed through a function which adds the correct scheme. I.e. 246.0.html?L=1 will be transformed to http://yourhost.com/246.0.html?L=1.

This behavior makes sense of course, but you might have a certain enviroment (some testing setup) where you want to disable this feature. In that case, set dontAddSchemeToURL to 1.

For most people it's safe to leave setting as is.

0

Setting the preferred language in a web browser

To set the default language in your browser you have to set a variable that gets passed to the web server. How this is done depends on the browser you are using.

Mozilla  / Netscape 4.x  and later versions

         Edit -> Preferences -> Navigator -> Languages

Note: with Netscape 4.x you need to make sure you select the language from the available choices. A number of people reported problems because they typed in the language by hand.

Mozilla Firefox

    Version 0.9 and newer:

    Linux:

         Edit -> Preferences -> General -> Languages

    Windows:

         Tools -> Options -> General -> Languages

    Version 1.5 and newer:

    Linux:

         Edit -> Preferences -> Advanced -> General -> Edit Languages

    Windows:

         Tools -> Options -> Advanced -> General -> Edit Languages

    In older versions you have to go to about:config and change the value of intl.accept_languages.

Internet Explorer

    Windows:

         Tools or View or Extras -> Internet Options -> (General) Languages

    MacOS:

         Edit -> Preferences -> Web Browser -> Language/Fonts

Pocket Internet Explorer

         Create the string registry key AcceptLanguage in

         HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\

         with value fr; q=1.0, en; q=0.5 (without quotes).

Opera

    Most versions:

         File -> Preferences -> Languages

    Linux/*BSD versions 5.x and 6.x:

         File -> Preferences -> Document -> Languages

 Nokia 770 Web Browser: Edit the file /home/user/.opera/opera.ini and add the following line in the section [Adv User Prefs]:

         HTTP Accept Language=fr;q=1.0,en;q=0.5

Galeon

        Settings -> Preferences -> Rendering -> Languages

Epiphany

         Edit -> Preferences -> Language -> Languages

 

Konqueror

    If you want to set only one language, it should be quite easy as soon as bug #358459 is fixed, just select it in the KDE Control Center and restart your KDE session in order to apply the changes.

    If you want to have multiple languages set or need a workaround for the mentioned bug, you currently have to edit your ~/.kde/share/config/kio_httprc file to include a line like the following:

         Languages=fr;q=1.0, en;q=0.5

lynx

    You can either edit the preferred_language variable in your .lynxrc or set it using the 'O' command while in lynx.

    For example, use the following line in your .lynxrc

      preferred_language=fr; q=1.0, en; q=0.5

W3 (emacs based web browser)

    (setq url-mime-language-string  "preferred_language=fr; q=1.0, en; q=0.5")

    or using the custom package (assuming URL version p4.0pre.14):

    Hypermedia -> URL -> Mime -> Mime Language String...

iCab

         Edit -> Preferences -> Browser -> Fonts,Languages

W3M

         Options (o) -> Other Behavior -> Accept-Language

Safari

    Safari uses the MacOS X system preferences to determine your preferred language:

        System preferences -> International -> Language

     

ELinks

    You can set up the default interface language at:

        Setup -> Language

    This will also change the requested language from web sites. You can change this behaviour and fine-tune the accepted languages HTTP variable at:

        Setup -> Options manager -> Protocols -> HTTP

Netscape 3.x

    Add        *httpAcceptLanguage: [preferred_language string]

    to the Netscape app-defaults file or ~/.Xresources

IBrowse

    Go into Preferences, then Settings, then Network. Under "Accept language" it will probably show a "*" by default. If you click on the "Locale" button it should add your preferred language. If not, you can enter it manually. After that, click "OK".

Voyager

    Go to Settings then Languages. You can either enter it manually or click on "Get from locale". Click "OK" when done.

FAQ

How can I make sure that the language detection works fine?

Just change your browser's  language settings: You can choose different languages as well as a priority for each of them. If you hit a page of your website without any L parameter in the URL, the extension should apply the correct language.