Skip to content

[Form] Translate timezones in TimezoneType #13662

Closed
@Tobion

Description

@Tobion

Just as LanguageType etc provide translated options, the TimezoneType should as well. It could do so using http://php.net/manual/en/intltimezone.getdisplayname.php (PHP >= 5.5).

IntlTimeZone::getDisplayName returns the same name for each UTC offset. So we probably would not display it for each timezone but instead allow grouping over different things. I'd suggest to add some form of grouping option that can be region|country|name|offset.

  • region (default): stays as currently done, e.g. Europe
  • country: group by DateTimeZone::getLocation()['country_code'] and translate with Locale::getDisplayRegion
  • name: group by IntlTimeZone::getDisplayName, e.g. Central European Standard Time (CET)
  • offset: group by IntlTimeZone::getRawOffset as UTC+x

With #12148 it would be easy to implement by just setting a default group_by closure that - based on the above option - calls the appropriate methods.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions