DateTime display is set by server locale

Topics: Localization, Troubleshooting
Developer
Mar 16, 2012 at 10:18 PM
Edited Mar 17, 2012 at 9: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?

Developer
Mar 17, 2012 at 11:38 AM

I believe this discussion is related as well: http://orchard.codeplex.com/discussions/346873
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).

Developer
Mar 17, 2012 at 4:36 PM

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