Fixing locale problems for dates in TYPO3
By Steffen Müller. Licensed under the Creative Commons License
Sometimes, localization of dates in TYPO3 seems not to work as expected. Of course it does, but finding the right configuration can be puzzling and time consuming. One reason can be the confusing variety of locale declarations.
Localization problems mostly emerge when moving a website from one server to another or when working with different environments at the same time.
Today, I did some tests on moving from outdated SuSE to Debian Etch. Cloning the database and the files was easy and went fine, but then I stumbled over wrong date localization of tt_news. The website comes with german as default language and english and french as secondary. Nevertheless, the fresh clone on the Debian server ignored all language settings, using english formats for all pages.
The reason was the config.locale_all setting in the TypoScript template. My configuration was:
config.locale_all = de_DE
[globalVar = GP:L = 1]
config.locale_all = en_EN
[global]
[globalVar = GP:L = 2]
config.locale_all = fr_FR
[global]
and this worked fine on SuSE. However, Debian does not come with any of these locales and TYPO3 switched to default (english). I found out, that the locales on Debian use a different naming scheme than SuSE does. Switching to the command line,
locale -a
revealed the names of all installed locales. That was de_DE.utf-8, en_US.utf-8 and fr_FR.utf-8. I changed my configuration accordingly and everything worked fine:
config.locale_all = de_DE.utf-8
[globalVar = GP:L = 1]
config.locale_all = en_US.utf-8
[global]
[globalVar = GP:L = 2]
config.locale_all = fr_FR.utf-8
[global]
License
This article is licensed under the Creative Commons License CC BY-SA 3.0. You are free to share (copy, distribute and transmit) and to remix (to adapt) the work under the following conditions:
- You must attribute the work by mentioning the name of the author (Steffen Müller) and setting a link back to the original article using its URL.
- If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
