Time-zones are unavailable on l.d.o. for translating

Created on 9 September 2020, about 5 years ago
Updated 3 June 2025, 5 months ago

Problem/Motivation

// @see \Drupal\user\AccountForm::form
    $form['timezone']['timezone'] = [
      '#type' => 'select',
      '#title' => t('Time zone'),
      '#default_value' => $account->getTimezone() ?: $system_date_config->get('timezone.default'),
      '#options' => system_time_zones($account->id() != $user->id(), TRUE),
      '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
    ];
// @See core/modules/system/sysmtem.module
function system_time_zones($blank = NULL, $grouped = FALSE) {
  $zonelist = timezone_identifiers_list();
  $zones = $blank ? ['' => t('- None selected -')] : [];
  foreach ($zonelist as $zone) {
    // Because many time zones exist in PHP only for backward compatibility
    // reasons and should not be used, the list is filtered by a regular
    // expression.
    if (preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone)) {
      $zones[$zone] = t('@zone', ['@zone' => t(str_replace('_', ' ', $zone))]);
    }
  }
// Extracted from exported .po file from localize.drupal.org.
#: core/modules/system/system.module:1270
msgid "@zone"
msgstr "@zone"

Only @zone is available for translating, and which does not help. So that every site has to translate time-zones on its installation, -- yes, timezones are available for translating on Drupal instances, just not available on localize.drupal.org.

Steps to reproduce

Proposed resolution

Replace timezone_identifiers_list() with plain text time-zones in system_time_zones()

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

user interface text

Created by

πŸ‡¨πŸ‡³China jungle Chongqing, China

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024