News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Condition to use another calendar for another language

Started by skkh84, May 13, 2022, 13:59:39 PM

Previous topic - Next topic

skkh84

Hi
In the code path
administrator \ components \ com_virtuemart \ helpers \ vmjsapi.php

// If exist exit
if ($jDate) {
return $display;
}
vmJsApi::css('ui/jquery.ui.all');
$lg = vmLanguage::getLanguage();
$lang = $lg->getTag();
$sh_lang = substr($lang, 0, 2);
$vlePath = vmJsApi::setPath('i18n/jquery.ui.datepicker-'.$lang, FALSE , '' ,$minified = NULL ,   'js', true);
if(!file_exists($vlePath) or is_dir($vlePath)){
$vlePath = vmJsApi::setPath('i18n/jquery.ui.datepicker-'.$sh_lang, FALSE , '' ,$minified = NULL ,   'js', true);
$lang = $sh_lang;
if(!file_exists($vlePath) or is_dir($vlePath)){
$lang = 'en-GB';
}
}
vmJsApi::addJScript( 'i18n/jquery.ui.datepicker-'.$lang );

$jDate = TRUE;
return $display;
}


/*
* Convert formated date;
* @$date the date to convert
* @$format Joomla DATE_FORMAT Key endding eg. 'LC2' for DATE_FORMAT_LC2
* @tz Timezone offset, defaults to false, which is the general joomla timezone
*/

static function date($date , $format ='LC2', $joomla=FALSE , $tz=false ){

if (!strcmp ($date, '0000-00-00 00:00:00')) {
return vmText::_ ('COM_VIRTUEMART_NEVER');
}
If ($joomla) {
$formatedDate = JHtml::_('date', $date, vmText::_('DATE_FORMAT_'.$format),$tz);
} else {

$J16 = "_J16";

$formatedDate = JHtml::_('date', $date, vmText::_('COM_VIRTUEMART_DATE_FORMAT_'.$format.$J16),$tz);
}
return $formatedDate;
}


I want the condition that when the English language is selected, the date is AD and when the local language is selected, the following code is replaced.

$lang = 'local-lang';
vmJsApi::addJScript( 'DatePicker-scripts/calendar');
vmJsApi::addJScript( 'DatePicker-scripts/jquery.ui.core');
vmJsApi::addJScript( 'DatePicker-scripts/jquery.ui.datepicker-cc');
vmJsApi::addJScript( 'DatePicker-scripts/jquery.ui.datepicker-cc-local-lang');


I can also use the local history format
thank