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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Setting i18n Locale


Go to End


4 Posts   1186 Views

Avatar
craig-opticblaze

Community Member, 10 Posts

13 October 2016 at 7:50pm

Edited: 13/10/2016 10:58pm

I see there are a few threads about this but I am having a bit of trouble setting the locale for my region. I am using the SilverStripe blog and events modules and the dates are displaying in English. I need them to display in Afrikaans for South Africa.

I have tried both of these in my _config.php file but they don't seem to work:

i18n::set_locale('af_ZA');
setlocale(LC_TIME, 'af_ZA', 'af_ZA.UTF8', 'Afrikaans');

EDIT:
Just narrowed it down to working on localhost but not working on live server. Is this server dependant? I have done a dev/build and a flush.

Avatar
Guy Van Bael

Community Member, 61 Posts

14 October 2016 at 9:53pm

Hi Craig,

I mostly use this module for things like that.
http://addons.silverstripe.org/add-ons/richardsjoqvist/silverstripe-localdate

Hope it helps

Avatar
tony-air

Community Member, 4 Posts

19 October 2016 at 7:42pm

Edited: 19/10/2016 7:42pm

You need to check that your server has this locale installed. I had the same issue before.
Debian way to fix it:
sudo locale-gen "af_ZA.UTF8"
sudo dpkg-reconfigure locales

Avatar
craig-opticblaze

Community Member, 10 Posts

19 October 2016 at 7:54pm

Can confirm, it was the server. It worked on my localhost but not on my testing environment. Went live and it is working there so all good.