Add automatic translation of month names for main time names in splitter
This commit is contained in:
@ -12,6 +12,9 @@ require_once __DIR__ . '/inc/datesByCountry.php';
|
||||
*/
|
||||
class NodaTimeAutotranslater {
|
||||
|
||||
const USECASE_MONTH = 1;
|
||||
const USECASE_DAY = 2;
|
||||
|
||||
const LANGS_TO_LOCALES = [
|
||||
'ar' => 'ar_SY.utf8',
|
||||
'de' => 'de_DE.utf8',
|
||||
@ -77,11 +80,11 @@ class NodaTimeAutotranslater {
|
||||
|
||||
if (trim($timeInfo['zeit_zaehlzeit_tag'], ", .0") === "") {
|
||||
$dateStr = "{$timeInfo['zeit_zaehlzeit_jahr']}-{$timeInfo['zeit_zaehlzeit_monat']}-05 00:00:01";
|
||||
$usecase = "month";
|
||||
$usecase = self::USECASE_MONTH;
|
||||
}
|
||||
else {
|
||||
$dateStr = "{$timeInfo['zeit_zaehlzeit_jahr']}-{$timeInfo['zeit_zaehlzeit_monat']}-{$timeInfo['zeit_zaehlzeit_tag']} 00:00:01";
|
||||
$usecase = "day";
|
||||
$usecase = self::USECASE_DAY;
|
||||
}
|
||||
|
||||
$dateGeneral = strtotime($dateStr);
|
||||
@ -90,8 +93,8 @@ class NodaTimeAutotranslater {
|
||||
|
||||
setlocale(LC_TIME, $locale);
|
||||
if ($locale !== setlocale(LC_TIME, "0")) continue;
|
||||
if ($usecase === "month") $tLangValue = strftime(getMonthFormatByLang($tLang), $dateGeneral ?: 0);
|
||||
else if ($usecase === "day") $tLangValue = strftime(getDateFormatByLang($tLang), $dateGeneral ?: 0);
|
||||
if ($usecase === self::USECASE_MONTH) $tLangValue = strftime(getMonthFormatByLang($tLang), $dateGeneral ?: 0);
|
||||
else if ($usecase === self::USECASE_DAY) $tLangValue = strftime(getDateFormatByLang($tLang), $dateGeneral ?: 0);
|
||||
$this->_insertStmt->bind_param("iss", $this->_znum, $tLang, $tLangValue);
|
||||
$this->_insertStmt->execute();
|
||||
|
||||
|
Reference in New Issue
Block a user