Improve autotranslating of times before 1.1.1000

This commit is contained in:
Joshua Ramon Enslin 2020-09-26 16:10:26 +02:00 committed by Stefan Rohde-Enslin
parent c9d8d4bdbd
commit 830b37f547
2 changed files with 4 additions and 2 deletions

View File

@ -669,6 +669,8 @@ final class NodaTimeAutotranslater {
return self::translateYearsWithSuffix($timeInfo);
}
$suffixMode = self::getSuffixModeForYearsWSuffix((intval($timeInfo['zeit_beginn']) - 1), intval($timeInfo['zeit_ende']));
if (trim((string)$timeInfo['zeit_zaehlzeit_tag'], ", .0") === "") {
$dateStr = "{$timeInfo['zeit_zaehlzeit_jahr']}-{$timeInfo['zeit_zaehlzeit_monat']}-05 00:00:01";
$usecase = self::USECASE_MONTH;
@ -690,7 +692,7 @@ final class NodaTimeAutotranslater {
$tLangValue = strftime(getDateFormatByLang($tLang), $dateGeneral ?: 0);
}
$output[$tLang] = $tLangValue;
$output[$tLang] = self::applyBcBceFormat($tLang, $tLangValue, $suffixMode);
}

View File

@ -53,7 +53,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
"zeit_zaehlzeit_tag" => "01",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "01.05.20");
self::assertEquals($output["de"], "01.05.20 n. Chr.");
}