Skip to content

get_global('windows_zone_mapping') is lossy #464

@ecederstrand

Description

@ecederstrand

According to http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml, there is a one-to-many relationship from Windows timezone to 'standard' timezone name. But the importer (see https://github.com/python-babel/babel/blob/master/scripts/import_cldr.py#L234) blindly selects only the first timezone name for the map value:

>>> get_global('windows_zone_mapping')['Romance Standard Time']
'Europe/Paris'

I think get_global('windows_zone_mapping') should either return tuples with all the related timezone names:

>>> get_global('windows_zone_mapping')['Romance Standard Time']
('Europe/Paris', 'Europe/Brussels', 'Europe/Copenhagen', 'Europe/Madrid Africa/Ceuta')

or be turned around so it maps timezone name -> Windows timezone:

>>> get_global('windows_zone_mapping')['Europe/Copenhagen']
'Romance Standard Time'

I think the latter is preferable since it's a more simple data structure, and if you need the reverse mapping, it's a one-liner:

reverse_zone_map = {v: k for k, v in get_global('windows_zone_mapping').items()}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions