Could someone point me to an up-to-date summary of the steps required to get international dates out of News or other modules plse? I have found several references using search and I've tried nearly all combinations and still get english month names. I'm missing something somwhere.
I've temporarily got around the problem by using numeric only date formats but I really need month names (day names would also be useful sometimes)
Plse help
Thanks
John
setlocale and news etc
-
pinthenet
Re: setlocale and news etc -story so far
Just to summarise, I've tried
Should I use $entry->postdate or $entry-formatpostdate in the News template?
I would be really, really grateful if soemone could clear this up for me and perhaps even record it somewhere centrally so it's easy to find (when I forget again in 6 months) - I thought I'd solved this in Spring but I've had a few months break form cmsms and now I'm on 0.11beta5
John
- setting locale="de_DE" in config.php
- creating a tag {setlocale(LC_ALL, "de_DE") and inserting it in the content, before {cms_module module="news"....
- adding support for an additional 'locale' parameter in the News module
Should I use $entry->postdate or $entry-formatpostdate in the News template?
I would be really, really grateful if soemone could clear this up for me and perhaps even record it somewhere centrally so it's easy to find (when I forget again in 6 months) - I thought I'd solved this in Spring but I've had a few months break form cmsms and now I'm on 0.11beta5
John
Re: setlocale and news etc
postdate is still there so that it doesn't break old sites. However, formatpostdate is what you should use on your templates now.
In beta5, formatpostdate will use what you send in the dateformat param of your News tag ({cms_module module='news' dateformat='%Y %b %d'}). However, I think I'm going to go one step further and have that look for locale settings if dateformat isn't given (which is dateformat='%x').
In beta5, formatpostdate will use what you send in the dateformat param of your News tag ({cms_module module='news' dateformat='%Y %b %d'}). However, I think I'm going to go one step further and have that look for locale settings if dateformat isn't given (which is dateformat='%x').
-
pinthenet
Re: setlocale and news etc
Just tried again, defining the dateformat in the content as in your example, but I still get english month abbreviations. I just tried the %x format and I still get 'en_US' (mm/dd/yy). I have locale='de_DE' in config.php. Where else can I control the locale?
-
pinthenet
Re: setlocale and news etc
I finally found what I was looking for (?) here http://forum.cmsmadesimple.org/index.ph ... 550.0.html
I added the more complex statement
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de-DE', 'de', 'ge', 'de_DE.ISO_8859-1', 'German');
right at the start of the news module and I got German months.....
It seems that just 'de_DE' isn't enough
I noticed that the format was then correct for (eg) Events, even though I don't have a setlocale there - I presume it's persisting.
As a test I transferred the setlocale to the start of config.php and that works too and I assume it's more global?
John
I added the more complex statement
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de-DE', 'de', 'ge', 'de_DE.ISO_8859-1', 'German');
right at the start of the news module and I got German months.....
It seems that just 'de_DE' isn't enough
I noticed that the format was then correct for (eg) Events, even though I don't have a setlocale there - I presume it's persisting.
As a test I transferred the setlocale to the start of config.php and that works too and I assume it's more global?
John
Re: setlocale and news etc
Yeah, I believe that setlocale works for the duration of the request. Interesting that it took that amount of stuff to get it to work properly. I'm not sure what the proper way of handling that is...

