Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Date months in locale


Reply


4 Posts   636 Views

Avatar
Webdoc

Community Member, 334 Posts

4 May 2012 at 7:07am

How to get the month names in current locale
SS 2.4.7

Avatar
Willr

Forum Moderator, 5513 Posts

4 May 2012 at 6:37pm

Well $Now.Month returns the month name. It will return whatever locale you have set at the PHP level (setlocale()) I don't believe SS will set this automatically for you.

Avatar
Webdoc

Community Member, 334 Posts

4 May 2012 at 10:25pm

i use in mysite/_config.pgp lines:
i18n::set_locale('et_EE');
setlocale(LC_TIME, i18n::get_locale() . '.utf8');

But in blog module the months are still in english.
Blog module uses in posts:
$Date.Long
And in widget it also in english

Avatar
Webdoc

Community Member, 334 Posts

5 May 2012 at 5:53am

got it working with code $Date.FormatDate(%d %b %Y)
But still needed the code do make ArchiveWidget to show the title in right language