Skip to content
Snippets Groups Projects
Commit 36f8efce authored by Uma's avatar Uma
Browse files

Merge branch 'vtransalte_picking_wrong' into 'master'

Fixes #1269 vtranslate arguments parsing is buggy

See merge request !575
parents 613e5219 53ac124a
No related branches found
No related tags found
No related merge requests found
...@@ -233,11 +233,30 @@ class Vtiger_Language_Handler { ...@@ -233,11 +233,30 @@ class Vtiger_Language_Handler {
} }
function vtranslate($key, $moduleName = '') { function vtranslate($key, $moduleName = '') {
$args = func_get_args(); $unformattedArgs = func_get_args();
if(count($unformattedArgs) > 2){
// slice an array by taking first 2 values into another array.
$formattedArgs = array_slice($unformattedArgs,0,2);
// Make third value as empty
$formattedArgs['2'] = '';
$sliced_part = array_slice($unformattedArgs,2);
foreach ($sliced_part as $key => $value) {
array_push($formattedArgs,$value);
}
$args = $formattedArgs;
} else {
$args = $unformattedArgs;
}
$formattedString = call_user_func_array(array('Vtiger_Language_Handler', 'getTranslatedString'), $args); $formattedString = call_user_func_array(array('Vtiger_Language_Handler', 'getTranslatedString'), $args);
array_shift($args);
array_shift($args); if(count($unformattedArgs) > 2){
if (is_array($args) && !empty($args)) { // Remove first three values from an array (key,modulename,languagecode)
array_shift($args); array_shift($args);array_shift($args);
} else {
// Remove first two values from an array (key,modulename)
array_shift($args); array_shift($args);
}
if(is_array($args) && !empty($args)) {
$formattedString = call_user_func_array('vsprintf', array($formattedString, $args)); $formattedString = call_user_func_array('vsprintf', array($formattedString, $args));
} }
return $formattedString; return $formattedString;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment