fix locale definitions starting with AM/PM (#4408)

* adapt locale script to fix locales starting with AM/PM
* fix korean locales that start with AM / PM
* added missing uk and zh_Hant locales
This commit is contained in:
Kevin Papst
2023-11-07 12:27:11 +01:00
committed by GitHub
parent a1d9874c13
commit 2a9bdb7982
2 changed files with 25 additions and 5 deletions

View File

@@ -199,7 +199,7 @@
],
'en_CH' =>
[
'date' => 'dd/MM/y',
'date' => 'dd.MM.y',
'time' => 'HH:mm',
'rtl' => false,
],
@@ -457,7 +457,7 @@
],
'en_MV' =>
[
'date' => 'M/d/yy',
'date' => 'd-M-yy',
'time' => 'HH:mm',
'rtl' => false,
],
@@ -1316,19 +1316,19 @@
'ko' =>
[
'date' => 'yy. M. d.',
'time' => 'a h:mm',
'time' => 'h:mm a',
'rtl' => false,
],
'ko_KP' =>
[
'date' => 'yy. M. d.',
'time' => 'a h:mm',
'time' => 'h:mm a',
'rtl' => false,
],
'ko_KR' =>
[
'date' => 'yy. M. d.',
'time' => 'a h:mm',
'time' => 'h:mm a',
'rtl' => false,
],
'nb_NO' =>
@@ -1589,6 +1589,12 @@
'time' => 'HH:mm',
'rtl' => false,
],
'uk' =>
[
'date' => 'dd.MM.yy',
'time' => 'HH:mm',
'rtl' => false,
],
'vi' =>
[
'date' => 'dd/MM/y',
@@ -1607,4 +1613,10 @@
'time' => 'HH:mm',
'rtl' => false,
],
'zh_Hant' =>
[
'date' => 'y/M/d',
'time' => 'Bh:mm',
'rtl' => false,
],
];

View File

@@ -101,6 +101,14 @@ final class RegenerateLocalesCommand extends Command
$settings['date'] = $shortDate->getPattern();
$settings['time'] = $shortTime->getPattern();
// see https://github.com/kimai/kimai/issues/4402 - Korean time format failed parsing
// special case when time pattern starts with A / a => this will lead to an error
// \DateTimeImmutable::getLastErrors() => Meridian can only come after an hour has been found
if (str_contains($settings['time'], 'a ')) {
$settings['time'] = str_replace('a ', '', $settings['time']) . ' a';
}
$settings['time'] = str_replace("\u{202f}", ' ', $settings['time']);
// make sure that sub-locales of a RTL language are also flagged as RTL
$rtlLocale = $locale;
if (substr_count($rtlLocale, '_') === 1) {