[TYPO3-dev] How to set locale for backend?

bernd wilke t3ng at bernd-wilke.net
Mon Oct 27 08:58:21 CET 2014


send to early :(
Am 27.10.14 08:48, schrieb bernd wilke:
> Am 26.10.14 16:29, schrieb Charles Brunet:
>> Hello,
>>
>> I wrote a backend module using extbase (TYPO3 6.2). I want to display
>> localized date. If my fliud template, I have:
>>
>> <f:format.date format="%e %B %Y">{feuillet.date}</f:format.date>
>>
>> However, the date always is written in English, whatever the backend
>> language is.
>>
>> I temporary solved the problem putting
>>
>> setlocale(LC_TIME, 'fr_CA.utf8');
>>
>> in the initializeAction function of my controller, but this is more a
>> hack
>> than a real solution.
>>
>>
>> What is the proper way to set the locale for the backend?
>>
>
> have a look at the wiki[1]:
> | Be aware: as the php function date() is not capable of localisation
> | you have no chance to get local named times (weekday, month)
> |
> | Since Feb 2013 the functionality of this viewhelper is extended: you
> | can use strftime-format-strings (recognized by the usage of '%' in
> | the format-string) and use localisation for weekdays and month.

All language specific output which depends on useruserinput must be 
handled inside your programm.
The server has only one setting, which can (and should) be set with 
setlocale as you do. so this should be done globaly than in the 
controller. therefore TYPO3 has the setting
	config.locale_all
there you need to set a string, which is recognized by your server!
maybe your server does not know 'fr_CA', then you must use 'fr_CA.utf8'

you can get a list of available configuration on the command line with:
	locale -a

> [1] http://wiki.typo3.org/Fluid#f:format.date

bernd
-- 
http://www.pi-phi.de/cheatsheet.html



More information about the TYPO3-dev mailing list