Skip to content

Commit

Permalink
Fixed issue #17309: Date question always shows error when using AR la…
Browse files Browse the repository at this point in the history
…nguage - can't proceed at survey (#1887)

Changed numeral literals to Unicode codepoint escape syntax
Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
  • Loading branch information
gabrieljenik authored and olleharstedt committed May 20, 2021
1 parent f620df6 commit ab5365b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion application/core/QuestionTypes/Date/RenderDate.php
Expand Up @@ -398,7 +398,7 @@ public function render($sCoreClasses = '')
{
$answer = '';
$inputnames = [];
$this->aDateformatDetails = getDateFormatDataForQID($this->aQuestionAttributes, $this->oQuestion->sid);
$this->aDateformatDetails = getDateFormatDataForQID($this->aQuestionAttributes, $this->oQuestion->sid, App()->language);
$coreClass = "ls-answers answer-item date-item " . $sCoreClasses;
$this->setMinDate();
$this->setMaxDate();
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -9594,14 +9594,14 @@ public static function convertNonLatinNumerics($str, $lang)
$standard = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];

if ($lang == 'ar') {
$eastern_arabic_symbols = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"];
$eastern_arabic_symbols = ["\u{0660}","\u{0661}","\u{0662}","\u{0663}","\u{0664}","\u{0665}","\u{0666}","\u{0667}","\u{0668}","\u{0669}"];
$result = str_replace($eastern_arabic_symbols, $standard, $str);
} elseif ($lang == 'fa') {
// NOTE: NOT the same UTF-8 letters as array above (Arabic)
$extended_arabic_indic = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"];
$extended_arabic_indic = ["\u{06F0}","\u{06F1}","\u{06F2}","\u{06F3}","\u{06F4}","\u{06F5}","\u{06F6}","\u{06F7}","\u{06F8}","\u{06F9}"];
$result = str_replace($extended_arabic_indic, $standard, $str);
} elseif ($lang == 'hi') {
$hindi_symbols = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"];
$hindi_symbols = ["\u{0966}","\u{0967}","\u{0968}","\u{0969}","\u{096A}","\u{096B}","\u{096C}","\u{096D}","\u{096E}","\u{096F}"];
$result = str_replace($hindi_symbols, $standard, $str);
}

Expand Down
4 changes: 2 additions & 2 deletions application/helpers/surveytranslator_helper.php
Expand Up @@ -1084,7 +1084,7 @@ function getJSDateFromDateFormat($sDateformat)
* @returns array
*
*/
function getDateFormatDataForQID($aQidAttributes, $mThisSurvey)
function getDateFormatDataForQID($aQidAttributes, $mThisSurvey, $language = '')
{
if (isset($aQidAttributes['date_format']) && trim($aQidAttributes['date_format']) != '') {
$aDateFormatDetails = array();
Expand All @@ -1094,7 +1094,7 @@ function getDateFormatDataForQID($aQidAttributes, $mThisSurvey)
$aDateFormatDetails['jsdate_original'] = $aDateFormatDetails['dateformat']; // In dropdown, this is fed to Date in Javascript, not Bootstrap
} else {
if (!is_array($mThisSurvey)) {
$mThisSurvey = array('surveyls_dateformat' => getDateFormatForSID($mThisSurvey));
$mThisSurvey = array('surveyls_dateformat' => getDateFormatForSID($mThisSurvey, $language));
}
$aDateFormatDetails = getDateFormatData($mThisSurvey['surveyls_dateformat']);
}
Expand Down

0 comments on commit ab5365b

Please sign in to comment.