[-] FO : #PSCFV-2151 : Translations of errors are connected width sprintf()

This commit is contained in:
lLefevre
2012-05-14 11:45:41 +00:00
parent 97a37ff566
commit 83703dc4ee
21 changed files with 830 additions and 761 deletions
+12 -12
View File
@@ -871,10 +871,10 @@ class AdminControllerCore extends Controller
{
foreach ($languages as $language)
if (($value = Tools::getValue($field.'_'.$language['id_lang'])) == false && (string)$value != '0')
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $values['title']);
}
elseif (($value = Tools::getValue($field)) == false && (string)$value != '0')
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $values['title']);
// Check field validator
if (isset($values['type']) && $values['type'] == 'textLang')
@@ -882,11 +882,11 @@ class AdminControllerCore extends Controller
foreach ($languages as $language)
if (Tools::getValue($field.'_'.$language['id_lang']) && isset($values['validation']))
if (!Validate::$values['validation'](Tools::getValue($field.'_'.$language['id_lang'])))
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
$this->errors[] = sprintf(Tools::displayError('field %s is invalid.'), $values['title']);
}
elseif (Tools::getValue($field) && isset($values['validation']))
if (!Validate::$values['validation'](Tools::getValue($field)))
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
$this->errors[] = sprintf(Tools::displayError('field %s is invalid.'), $values['title']);
// Set default value
if (Tools::getValue($field) === false && isset($values['default']))
@@ -2157,7 +2157,7 @@ class AdminControllerCore extends Controller
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
$this->errors[] = sprintf(
$this->l('The field %s is required.'),
Tools::displayError('The field %s is required.'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
);
@@ -2165,7 +2165,7 @@ class AdminControllerCore extends Controller
foreach ($rules['requiredLang'] as $field_lang)
if (($empty = Tools::getValue($field_lang.'_'.$default_language->id)) === false || $empty !== '0' && empty($empty))
$this->errors[] = sprintf(
$this->l('The field %s is required at least in %s.'),
Tools::displayError('The field %1$s is required at least in %2$s.'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$default_language->name
);
@@ -2174,7 +2174,7 @@ class AdminControllerCore extends Controller
foreach ($rules['size'] as $field => $max_length)
if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length)
$this->errors[] = sprintf(
$this->l('The field %s is too long (%d chars max).'),
Tools::displayError('The field %1$s is too long (%2$d chars max).'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name),
$max_length
);
@@ -2186,7 +2186,7 @@ class AdminControllerCore extends Controller
$field_lang = Tools::getValue($field_lang.'_'.$language['id_lang']);
if ($field_lang !== false && Tools::strlen($field_lang) > $max_length)
$this->errors[] = sprintf(
$this->l('The field %s (%s) is too long (%d chars max, html chars including).'),
Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$language['name'],
$max_length
@@ -2200,7 +2200,7 @@ class AdminControllerCore extends Controller
if (($value = Tools::getValue($field)) !== false && ($field != 'passwd'))
if (!Validate::$function($value) && !empty($value))
$this->errors[] = sprintf(
$this->l('The field %s is invalid.'),
Tools::displayError('The field %s is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
);
@@ -2209,12 +2209,12 @@ class AdminControllerCore extends Controller
{
if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value))
$this->errors[] = sprintf(
$this->l('The field %s is invalid.'),
Tools::displayError('The field %s is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
);
elseif ($class_name == 'Customer' && !Validate::isPasswd($value))
$this->errors[] = sprintf(
$this->l('The field %s is invalid.'),
Tools::displayError('The field %s is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
);
}
@@ -2225,7 +2225,7 @@ class AdminControllerCore extends Controller
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
if (!Validate::$function($value))
$this->errors[] = sprintf(
$this->l('The field %s (%s) is invalid.'),
Tools::displayError('The field %1$s (%2$s) is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$language['name']
);