Skip to content

Build a better time zone selector (and engineer out continents-cities.php) #50

@stuwest

Description

@stuwest

WordPress core currently includes a hack around time zones, a php file called continents-cities.php. This isn't used by any code but includes a list of ~500 geographic names in English wrapped in __() so they get into GlotPress. Language packs include localized versions of this file. Core's time zone selector then gets a list of time zone IDs from PHP's timezone_identifiers_list(), does some parsing, generates a drop down list, and uses those localized strings for display names.

A couple issues here:

  • continents-cities.php creates ~500 strings of unnecessary busy work for our translators. These country/region names have all been translated widely before and we don't get to take advantage of all that work (and as a result have inconsistencies and gaps across our locales).
  • The IANA's list of cities isn't a great centerpiece for a UI. Those choices were driven by geography and time zone boundaries, an approach which makes sense in a standards-body kind of way but isn't how most users think (11 examples for Antarctica? Eight for the U.S. state of Indiana?). Also, that list can be brittle due to variations in PHP versions of the time zone db.
  • The design approach -- a drop-down menu of 500 items (😱) -- could use some love.

CLDR data could offer a better way.

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