Fix problem in last-syllable-depending time suffixes in Hungarian (as

évek vs. es évek)
This commit is contained in:
Joshua Ramon Enslin 2020-09-24 11:54:01 +02:00 committed by Stefan Rohde-Enslin
parent d7e2c7f4ed
commit 36d8257ca0

View File

@ -292,6 +292,16 @@ final class NodaTimeAutotranslater {
'zh' => '%s年代-%s年代', 'zh' => '%s年代-%s年代',
]; ];
const LANGS_SYLLABLE_CLEANING = [
"hu" => [
"10-as évek" => "10-es évek",
"40-as évek" => "40-es évek",
"50-as évek" => "50-es évek",
"70-as évek" => "70-es évek",
"90-as évek" => "90-es évek",
],
];
/** @var MDMysqli */ /** @var MDMysqli */
private MDMysqli $_mysqli_noda; private MDMysqli $_mysqli_noda;
/** @var integer */ /** @var integer */
@ -517,12 +527,14 @@ final class NodaTimeAutotranslater {
if ($start_cen === $end_cen - 9) { if ($start_cen === $end_cen - 9) {
foreach (self::LANGS_DECADE_FORMAT as $tLang => $format) { foreach (self::LANGS_DECADE_FORMAT as $tLang => $format) {
$tLangValue = sprintf($format, (string)$start_cen, (string)$end_cen); $tLangValue = sprintf($format, (string)$start_cen, (string)$end_cen);
if (!empty(self::LANGS_SYLLABLE_CLEANING[$tLang])) $tLangValue = strtr($tLangValue, self::LANGS_SYLLABLE_CLEANING[$tLang]);
$output[$tLang] = self::applyBcBceFormat($tLang, $tLangValue, $suffixMode); $output[$tLang] = self::applyBcBceFormat($tLang, $tLangValue, $suffixMode);
} }
} }
else { else {
foreach (self::LANGS_DECADES_FORMAT as $tLang => $format) { foreach (self::LANGS_DECADES_FORMAT as $tLang => $format) {
$tLangValue = sprintf($format, (string)$start_cen, (string)($end_cen - 9)); $tLangValue = sprintf($format, (string)$start_cen, (string)($end_cen - 9));
if (!empty(self::LANGS_SYLLABLE_CLEANING[$tLang])) $tLangValue = strtr($tLangValue, self::LANGS_SYLLABLE_CLEANING[$tLang]);
$output[$tLang] = self::applyBcBceFormat($tLang, $tLangValue, $suffixMode); $output[$tLang] = self::applyBcBceFormat($tLang, $tLangValue, $suffixMode);
} }
} }