[tz] Timezone in Brazil

Random832 random832 at fastmail.com
Sat Oct 10 04:22:18 UTC 2015


Matt Johnson <mj1856 at hotmail.com> writes:

> TZDB doesn't track display names. This is the realm of CLDR.

Since no-one ever bothers to explain *how* the CLDR does it, this is
what I've been able to figure out.

The user having selected Brazil from a list of countries, you need to
get, somehow, a list of all metazones that apply to Brazil. I don't know
how or even if this can be automatically extracted from CLDR. Handwaving
this step, they are: Acre, Amazon, Brasilia, Noronha.

Get the generic long names from these metazones from the main CLDR
data. In main/pt.xml, you can find these:

<generic>Horário do Acre</generic>
<generic>Horário do Amazonas</generic>
<generic>Horário de Brasília</generic>
<generic>Horário de Fernando de Noronha</generic>

If you actually care about making the distinctions based on what region
didn't observe daylight savings or switched timezones a decade ago... I
can't help you. These don't appear to be described (beyond a city name)
in the CLDR, and their descriptions in zone1970.tab are terrible.

Get the primary zones for these metazones from metaZones.xml :
<mapZone other="Acre" territory="001" type="America/Rio_Branco"/>
<mapZone other="Amazon" territory="001" type="America/Manaus"/>
<mapZone other="Brasilia" territory="001" type="America/Sao_Paulo"/>
<mapZone other="Noronha" territory="001" type="America/Noronha"/>

territory 001 is used for the default zone for a metazone, the country
code is used if it depends on the country, for example: <mapZone
other="America_Eastern" territory="001" type="America/New_York"/>
<mapZone other="America_Eastern" territory="CA" type="America/Toronto"/>

Again, if you care about dealing with the dozen or so other TZDB zones,
you're left high and dry. Maybe add an "advanced" checkbox and let them
select from a list of cities.

I'm sure there are tools that come with the CLDR or ICU that make these
tasks easier than manually sifting through XML files, but I don't know
them and we're at the limit of what I care to find out about.



More information about the tz mailing list