News:

Support the VirtueMart project and become a member

Main Menu

Coding flaw preventing easy js translation

Started by gergely, December 28, 2012, 23:23:36 PM

Previous topic - Next topic

gergely

Hi!
I wanted to translate the jquery.validationEngine-en.js file to my language, no problem, i did it easly.
BUT

These lines are not allowing the usage of the translated file, because my language is not listed below:

$existingLang = array("cz", "da", "de", "en", "es", "fr", "it", "ja", "nl", "pl", "pt", "ro", "ru", "tr");
if (!in_array ($lang, $existingLang)) {
$lang = "en";
}

Found in: administrator/com_virtuemart/helpers/config.php, Starting from line 1144.

Hardcoding these shortcodes is not the best way, use file_exists or something instead.
I had to place my translation into the -en.js file, becase i dont want to hack core.

Version: 2.0.16

Milbo

thx, changed to

/*$existingLang = array("cz", "da", "de", "en", "es", "fr", "it", "ja", "nl", "pl", "pt", "ro", "ru", "tr");
if (!in_array ($lang, $existingLang)) {
$lang = "en";
}*/
$vlePath = vmJsApi::setPath('languages/jquery.validationEngine-'.$lang);
if(file_exists($vlePath) and !is_dir($vlePath)){
vmJsApi::js( 'languages/jquery.validationEngine-'.$lang );
} else {
vmJsApi::js( 'languages/jquery.validationEngine-en' );
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/