Handle Ukrainian year names (2022 p > 2022)

This commit is contained in:
Joshua Ramon Enslin 2024-03-24 00:59:30 +01:00
parent 3c43a3f2d3
commit 81a7d64e27
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 43 additions and 0 deletions

View File

@ -65,8 +65,13 @@ final class NodaTimeSplitter {
"nach Chr." => "",
"n. Chr." => "",
"n.Chr." => "",
" pp" => "",
" p" => "",
" р" => "", // Cyrillic
// To clean
"v.Chr." => "v. Chr.",
"v.C." => "v. Chr.",
"v. C." => "v. Chr.",
"v. Chr" => "v. Chr.",
"BCE" => "v. Chr.",
"CE" => "",

View File

@ -342,6 +342,19 @@ final class NodaTimeSplitterTest extends TestCase {
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "40000-25000 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500);
// 5-Digit timespans BCE
$output = NodaTimeSplitter::attempt_splitting("40000-25000 v.C.");
self::assertEquals($output, [
0 => "-40000",
1 => "-25000",
2 => "00",
3 => "00",
4 => "-",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "40000-25000 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500);
$output = NodaTimeSplitter::attempt_splitting("20. Jahrhundert v. Chr.");
self::assertEquals($output, [
0 => "-2000",
@ -806,6 +819,31 @@ final class NodaTimeSplitterTest extends TestCase {
}
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
* @small
*
* @return void
*/
public function testSplitSimpleDatesUkrainian():void {
$output = NodaTimeSplitter::attempt_splitting("2020 p");
self::assertEquals($output, [
0 => "2020",
1 => "2020",
2 => "00",
3 => "00",
4 => "+",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
}
/**
* Test to check special cases can be parsed.
*