I am currently trying to localize the Windows Time Time application for several countries. I use Noda Time because it was very easy for a beginner. The problem I encounter is that all Timezone identifiers are in standard English, and I am looking for a way to get these identifiers converted to local language strings.
One way is to make localized strings for each identifier in each language. But it seems to be very inefficient, as there are 500 time zones. Please suggest me a way to immediately get the TimeZone identifier converted to a local language in a less time-consuming way.
My code is:
var now = Instant.FromDateTimeUtc(DateTime.UtcNow);
var tzdb = DateTimeZoneProviders.Tzdb;
var list = from id in tzdb.Ids
where id.Contains("/") && !id.StartsWith("etc", StringComparison.OrdinalIgnoreCase)
let tz = tzdb[id]
let offset = tz.GetUtcOffset(now)
orderby offset, id
select new
{
DisplayValue = string.Format("(UTC{0}) {1} {2} ", offset.ToString("+HH:mm", null), now.WithOffset(offset).TimeOfDay.ToString("hh:mm tt",null),id)
};