How to change the default language

This article is a post by Nico Deblauwe . Thanks to him.

1/ Inform the backend how it should deal with the default language settings when content is created

Open /typo3conf/ext/demotemplate/Configuration/TsConfig/Page/config.ts and look for the following sections.

Change this to your default language. Good options would be gb/English, fr/français or nl/Nederlands… you get the picture.

Then you’ll notice a section where quite some renaming of components (to German) happens, and configuration of the RTE. Skip that (for now, later on you can always update this) and move on to the place where the default language is set. Change this to your new default language as wel.

2/ Configure your TYPO3 installation

Open typo3conf/ext/demotemplate/Configuration/TypoScript/Static/constants.txt and go to the languages section.

First you specify how many languages your site will use, below the setting for 2 languages. If you will have a monolingual site, you can remove the ‘,1’ and stay with ‘0’.

Next it defines which number is used for the standard and which numbers for the additional languages. Don’t touch.

Then you need to define what will be the languages you connect to those numbers. It is standard configures for German (de) as standard language and English (en) as first foreign language. Change here to make it fit with your choice.

Besides the language, there is also the ‘locale’ setting. Also make sure to make the changes here as well, and put locales in the same order as your languages.

And one more thing, the html that is generated also needs to know what language corresponds with the number. Again same change to be made as above.

3/ How should the URLs look like?

Last but not least: in /typo3conf/realurlconf.php, you configure how the extension realurl deals with the site languages that you have defined. t3bootstrap comes with the setting that German is mapped from “L=0” to “/de/”, English is mapped from “L=1” to “/en/” etc in the url. Make sure that you change this to the correct same order as defined in your typoscript configuration. Also don’t forget to change the ‘valueDefault’ option to the code you want/need (typically your default (L=0) language. If your site only has one language, you can remove what is not needed, but it doesn’t hinder nor slows down neither if you leave it there.

Clear your cache and check the site again. In the backend you will notice that all the demo content is still in German (of course it was written like that and saved to the default language code=0), but now it no longer has a German flag (as you changed the settings to your own preferred language. You can start altering content now. Also notice that the second language – which was English for the t3bootstrap package – has changed as well if you chose to do so.

In the front-end you will see the same changes in the url and also for those pages that have multiple languages, the language menu in the upper right contains the changes. If you dive in the HMTL-code, you will notice that also there your changes had effect (see below for Dutch (nl) content).

Sven Wappler

Webentwickler, Programmierer, TYPO3 Experte

Das könnte dich auch interessieren …

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.