stmllr.net

Fixing locale problems for dates in TYPO3

by on stmllr.net

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]

Tags

Comments

  1. Wim Spijker

    Thank you very much. It helped me a lot.
    In ubuntu
    sudo locale-gen
    sudo locale-gen nl_NL.utf8
    sudo locale-gen de_DE.utf8
    Now it is working fine.

  2. Monis

    Hi Steffen,
    I tried as per your finding and guidance but it didn't work for me, what you think this could be because of? Is it some thing do do with htaccess or any other configuration, dutch version is not showing the dates in localized format in my case.