VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: man.of.earth on October 11, 2019, 15:49:20 PM

Title: VM always chooses en-GB as datepicker language, even if...
Post by: man.of.earth on October 11, 2019, 15:49:20 PM
Hello,
I noticed that VM always chooses en-GB as the datepicker language, even if the shop is multilingual and the backend is set on other language than en-GB (even if the files for the other language exist in
/components/com_virtuemart/assets/js/i18n, as
jquery.ui.datepicker-ro-RO.js, for instance.

The code is in vmjsapi.php, lines 795-807:
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 );


($lang is ro-RO, $sh_lang is ro, and the two files, jquery.ui.datepicker-ro-RO.js and jquery.ui.datepicker-ro.js are present in the /components/com_virtuemart/assets/js/i18n directory.)