This project is read-only.

DateTime display is set by server locale

Topics: Localization, Troubleshooting
Mar 16, 2012 at 11:18 PM
Edited Mar 17, 2012 at 10:56 AM

This discussion might be related.

As on my site (with en-US culture set in Settings) dates (from content item metadata) show up on my dev machine with Hungarian local (like márc. 15 2012 9:25 du.) but on the server with English (Mar 15 2012 9:25 PM) It seems that site settings does not affect what locale is used for DateTime display, since it is determined by server locale (my dev machine's Windows locale is hu-HU, the server is in the US, so I guess it's en-US). Is this by design? Shouldn't culture settings override that too?

Mar 17, 2012 at 12:38 PM

I believe this discussion is related as well:
In summary, it seems that CultureInfo.CurrentCulture / CultureInfo.CurrentUICulture are not in sync with the Orchard culture setting. Whether this is by design or not remains to be answered.

For now, you could probably fix it by simply setting the Thread.CurrentThread.CurrentCulture to CultureInfo.CreateSpecificCulture(_workContext.Value.CurrentCulture).

Mar 17, 2012 at 5:36 PM

Thanks! That could be a quick fix, yes. But I'm still curious whether how this is supposed to work.