It is currently March 9th, 2021, 9:47 am

[Bug?] Proper %D formatting with FormatLocale for different regions

Report bugs with the Rainmeter application and suggest features.
User avatar
Rainmeter Sage
Posts: 1143
Joined: March 23rd, 2015, 5:26 pm

Re: [Bug?] Proper %D formatting with FormatLocale for different regions

Post by SilverAzide »

Wim wrote: January 18th, 2021, 8:31 pm Ingenious

I've got one thing though (and i hope you don't mind). It all comes out in English. It's easy to fix (i added FormatLocale=Local to MeasureLongDate) but it has me surprised. My computer is set to dutch yet the long date is given in English. If correct formatting is the point wouldn't language have to be a part of it?
Yes, good point, you still need to set FormatLocale=Local on any measures that return text (month names, day names). I didn't include that bit, sorry. I fixed the code snippets above. The unfortunate side effect of this setting is that it overrides certain format strings (like you won't get "AM/PM" in locales that don't use 12-hour time even if you want to force it), but I guess that is a separate issue that can be addressed easily enough.
Gadgets Wiki GitHub More Gadgets...
Posts: 69
Joined: September 22nd, 2010, 8:30 pm

Re: [Bug?] Proper %D formatting with FormatLocale for different regions

Post by Wim »

What i was thinking is that FormatLocale is not really a solution, because of the following:
I'm not entirely certain about this (and do correct me if i'm wrong), but the problem seems to be that it doesn't just do a translation, but it also forces the OS *format* on the output, and therefore overrides your code. It would defeat the very purpose of establishing the correct format this way.

In order to keep translation and punctuation/format separate you would need to use a substitute string for the translation or retrieve the correct local names directly from the registry.

You can't really mix these two, it seems.
You do not have the required permissions to view the files attached to this post.