Author Topic: VM always chooses en-GB as datepicker language, even if...  (Read 777 times)

arcturus

  • Jr. Member
  • **
  • Posts: 111
  • VirtueMart Version: 3.6.10 10211
VM always chooses en-GB as datepicker language, even if...
« 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:
Code: [Select]
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.)
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.15 and VM 3.6.10 10211 on PHP 7.3.9