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

@@ -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) {