Posts: 36
Threads: 13
Joined: Jul 2012
Steven,
The use of 'today' and 'yesterday' are clear to me, not a problem, working great.
The language of the days and months however are the issue.
The cms where I have included Commentics in, displays dates in Dutch, so I thought
it should be possible to do the same in Commentics itself.
In comments.php the variable $dated is used:
echo $dated;
results in direct output as : 2013-06-25 12:45:06
In the Comment display it is (re)formated as : Tue 25 June, 2013
Using the strftime variable in the same page (with setlocale (LC_TIME, 'nl_NL'); )
echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 6, 25, 2013));
results in output as : dinsdag 25 juni 2013 (that's what I need)
So the numeric base for the date is there in the $dated variable.
As far as my limited knowledge of php tells me, it should be possible
to format the date string into another (Dutch) language?
Posts: 2,894
Threads: 59
Joined: Jun 2010
Yes it's possible, but it's the "setlocale (LC_TIME, 'nl_NL');" part which is the problem.
In your case the locale 'nl_NL' works fine. However this may not work on another server. Another server might not have the Dutch locale installed, or it may be installed but called something other than 'nl_NL'.
For example, on the PHP doc page for the
setlocale function, the example is trying to
guess what the locale for German is because it can have so many different variants:
PHP Code:
<?php
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
Sure I could leave it up to the admin to try to determine what locales they have on their server and get them to type it in somewhere. But I'd prefer for there to be a user-friendly way. Ideally there would be a drop down menu in the Installer where you could select from a list of available locales. I know that some scripts do this so it must be possible, it's just I haven't had chance to look into it that much. I know you can get a list of locales with "system('locale -a')" but many servers have the system() function disabled.
Does your CMS have a way to choose which locale to use? How did you know that 'nl_NL' would work?
Have
you completed
the interview?