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