Problems, need help? Have a tip or advice? Post it here.
13 posts Page 1 of 2
Hi,

My hosts webserver doesn't have the intl.default_locale set (no value) which I guess causes my dates to show in English, instead of Dutch.

Code: Select all
<cms:date k_page_date format='j F Y' locale='dutch' />


Is there a simple way to display my dates correctly?

Thank you!
Please try the following syntax for setting locale -
language[_country][.charset]
(where information under brackets is optional).

For Dutch you could try the following
Code: Select all
<cms:date k_page_date format='j F Y' locale='nl' />

Code: Select all
<cms:date k_page_date format='j F Y' locale='nl_NL' />

Code: Select all
<cms:date k_page_date format='j F Y' locale='nl_NL.UTF-8' />

Please let me know if any of those work.
Thanks KK, but unfortunately none of them seem to work.

Is there perhaps a way to set the locale via htaccess?
I'm sorry about that, Vincent.
Perhaps you could ask the host to enable the locale for you? Have you tried doing that?
Contacted my host and they were kind enough to change the php locale settings to "nl-NL", but still the above suggestions don't seem to work.

http://poeze.com/phpinfo.php

Any ideas?
Well, that is strange.
Could you PM me the site's FTP+Couch access creds please?
Allow me to take a look at the issue.
Hi KK and Original Poster,

Was this problem ever solved? I am experiencing the same problem. Setting the locale as suggested doesn't work, date and day remain English (eg June instead of 'juni' and 'Mon' instead of 'maa'). What to do?
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
For the record and to whom it may concern:

With the help of my hoster I was able to solve it in the following way
(which is a tad "omslachtig" to say it in the Dutch locale :-) )

Code: Select all
<cms:php>
   setlocale(LC_TIME, 'nl_NL');
   echo strftime("%A %e %B %Y", mktime(0, 0, 0, "<cms:date k_page_date format='n' />", "<cms:date k_page_date format='j' />", "<cms:date k_page_date format='Y' />"));
</cms:php>

1/ Change the locale to your required locale.
2/ Insert your date time elements one by one in the "mktime" part of the code. In the example I omitted time.
3/ Set the required output in the "strftime" part of the code. The parameters that you can use are documented here: http://php.net/manual/en/function.strftime.php
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Thanks for sharing your solution, @brightwolf.

What I find strange is that the <cms:date> does *precisely* the same thing while trying to set the locale - so, if your code works, the original code should have worked too.

Could you please get me FTP+Couch access to your site? I'd like to take a look at what is happening.

Thanks.
Yes sure ! I will send you a pm with details.

I have added the following code to the index.php of our site (which is still in testing, anyway):
Code: Select all
cms date: 
<cms:date k_page_date format='l j F Y' locale='nl_NL' />
<br>
cms php:
<cms:php>
   setlocale(LC_TIME, 'nl_NL');
   echo strftime("%A %e %B %Y", mktime(0, 0, 0, "<cms:date k_page_date format='n' />", "<cms:date k_page_date format='j' />", "<cms:date k_page_date format='Y' />"));
</cms:php>

The output of this code is:

cms date: Tuesday 19 June 2018
cms php: dinsdag 19 juni 2018
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
13 posts Page 1 of 2