[tz] Timezone selectors (was RES: Timezone for Brazil)

Guy Harris gharris at sonic.net
Wed Oct 11 00:11:54 UTC 2023


On Oct 10, 2023, at 4:48 PM, Doug Ewell <doug at ewellic.org> wrote:

> This is what we get from a known, reliable source that offers human-readable names in English (or, importantly, 140 other languages) corresponding to tzids. Some of the names are probably not perfect for a picker. We already know that “(other)” and “(most locations)” are not always perfect either, especially when presented out of context: Other than what? What does “most” include?

Perhaps it's time for somebody to run some UI experiments to determine what works best for what groups of users.  (Complaints that you live in city X but the selector only offers city Y count against "works best".)

> We’re using a standard .NET Core call that queries ICU in a Linux container, and makes a Windows call when running on Windows. There are no options to select names for standard, daylight, or generic, and I don’t know why it chooses standard by default. The ICU folks might know.

I'm guessing it's easier for .NET languages to use ICU4C than ICU4J; the icu::TimeZone Class Reference:

	https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1TimeZone.html#a07cc5464421c1ae84f55ada930cf03df

appears to offer several flavors of the getDisplayName method, with:

	UnicodeString &getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString &result) const

and

	UnicodeString &getDisplayName(UBool inDaylight, EDisplayType style, const Locale &locale, UnicodeString &result) const

having the style argument, which is an EDisplayType:

	https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1TimeZone.html#a07cc5464421c1ae84f55ada930cf03df

I'm guessing that SHORT and LONG use the inDaylight value to determine whether to provide the short or long standard time or the short or long daylight time name, and SHORT_GENERIC and LONG_GENERIC provide the short or long generic name.

At least from what I see on Microsoft Learn, the .NET 7.0 TimeZone class:

	https://learn.microsoft.com/en-us/dotnet/api/system.timezone?view=net-7.0

only has the standard and daylight names as properties

However, the .NET 7.0 TimeZoneInfo class:

	https://learn.microsoft.com/en-us/dotnet/api/system.timezoneinfo?view=net-7.0

also has the DisplayName property, which "Gets the general display name that represents the time zone", and might provide the generic name when it's using ICU.





More information about the tz mailing list