Add English month names for splitting time terms

This commit is contained in:
Joshua Ramon Enslin 2020-12-22 12:22:14 +01:00
parent 8ac22165fc
commit 6e910cd676
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -26,6 +26,21 @@ final class NodaTimeSplitter {
"12" => ['Dezember', 'Dez.'], "12" => ['Dezember', 'Dez.'],
]; ];
const MONTH_NAMES_ENGLISH = [
"01" => ['January', 'Jan.'],
"02" => ['February', 'Feb'],
"03" => ['March', 'Mar.'],
"04" => ['April', 'Apr.'],
"05" => ['May'],
"06" => ['June', 'Jun.'],
"07" => ['July', 'Jul.'],
"08" => ['August', 'Aug.'],
"09" => ['September', 'Sep.', 'Sept.'],
"10" => ['October', 'Oct.'],
"11" => ['November', 'Nov.'],
"12" => ['December', 'Dec.'],
];
const MONTH_NAMES_HUNGARIAN = [ const MONTH_NAMES_HUNGARIAN = [
"01" => ['január', 'jan'], "01" => ['január', 'jan'],
"02" => ['február', 'feb'], "02" => ['február', 'feb'],
@ -386,6 +401,13 @@ final class NodaTimeSplitter {
if (strlen($datum) <= 9) $use_day = false; if (strlen($datum) <= 9) $use_day = false;
else $use_day = true; else $use_day = true;
foreach (self::MONTH_NAMES_ENGLISH as $monthVal => $monthValidNames) {
if (self::stri_occurs($datum, $monthValidNames)) {
if (!empty($monat)) return [];
$monat = (string)$monthVal;
}
}
foreach (self::MONTH_NAMES_GERMAN as $monthVal => $monthValidNames) { foreach (self::MONTH_NAMES_GERMAN as $monthVal => $monthValidNames) {
if (self::stri_occurs($datum, $monthValidNames)) { if (self::stri_occurs($datum, $monthValidNames)) {
if (!empty($monat)) return []; if (!empty($monat)) return [];