Disallow translating as decade before 1000 CE
This commit is contained in:
parent
8eda7d4c7f
commit
b405855fc2
|
@ -338,7 +338,7 @@ final class NodaTimeAutotranslater {
|
||||||
return self::TRANSLATABLE_CENTURY;
|
return self::TRANSLATABLE_CENTURY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((intval($zeit_ende) + 1) % 10 === 0 and intval($zeit_beginn) % 10 === 0) {
|
if ((intval($zeit_ende) + 1) % 10 === 0 and intval($zeit_beginn) % 10 === 0 and intval($zeit_beginn) > 1000) {
|
||||||
return self::TRANSLATABLE_DECADE;
|
return self::TRANSLATABLE_DECADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,28 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test to check whether the HTML page is correctly generated.
|
||||||
|
*
|
||||||
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||||
|
* @group ValidOutput
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCanTranslateDecade():void {
|
||||||
|
|
||||||
|
$timeInfo = [
|
||||||
|
"zeit_beginn" => "1920",
|
||||||
|
"zeit_ende" => "1929",
|
||||||
|
"zeit_zaehlzeit_jahr" => "1925",
|
||||||
|
"zeit_zaehlzeit_monat" => "00",
|
||||||
|
"zeit_zaehlzeit_tag" => "00",
|
||||||
|
];
|
||||||
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
||||||
|
self::assertEquals($output["de"], "1920er Jahre");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test to check whether the HTML page is correctly generated.
|
* Test to check whether the HTML page is correctly generated.
|
||||||
*
|
*
|
||||||
|
@ -123,6 +145,28 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test to check whether the HTML page is correctly generated.
|
||||||
|
*
|
||||||
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||||
|
* @group ValidOutput
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testTranslateDecadeBeforeCommonEraAsTimespan():void {
|
||||||
|
|
||||||
|
$timeInfo = [
|
||||||
|
"zeit_beginn" => "-10",
|
||||||
|
"zeit_ende" => "-1",
|
||||||
|
"zeit_zaehlzeit_jahr" => "0005",
|
||||||
|
"zeit_zaehlzeit_monat" => "00",
|
||||||
|
"zeit_zaehlzeit_tag" => "00",
|
||||||
|
];
|
||||||
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
||||||
|
self::assertEquals($output["de"], "10-1 v. Chr.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test to check whether the HTML page is correctly generated.
|
* Test to check whether the HTML page is correctly generated.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user