From: Pierre Habouzit Date: Wed, 10 Sep 2003 19:08:04 +0000 (+0000) Subject: error message i18n handling X-Git-Tag: procmail~40 X-Git-Url: http://git.polytechnique.org/?p=old-projects.git;a=commitdiff_plain;h=f0a83324f4cda95839ae5f033289c478db499c71 error message i18n handling --- diff --git a/philter/philter/include/emails.inc.php b/philter/philter/include/emails.inc.php index 1cc1eaf..0ee1afa 100644 --- a/philter/philter/include/emails.inc.php +++ b/philter/philter/include/emails.inc.php @@ -54,7 +54,7 @@ class Email { function toggle_flag($_flag) { $flags = explode(",", $this->flags); $key = array_search($_flag,$flags); - if($key===false) + if($key===NULL || $key===false) $flags[]=$_flag; else unset($flags[$key]); @@ -173,7 +173,7 @@ class EmailPool { // we check that the email is not already there foreach($this->emails as $id=>$key) if($key->email == $new_mail) { - $philter->set_error("$new_mail is already in the Email Pool"); + $philter->set_error("$new_mail "._i18n('pool_err_already')); return false; } @@ -183,7 +183,7 @@ class EmailPool { $this->emails[$mid]->commit($this->uid, $mid); uasort($this->emails, "email_cmp"); } else { - $philter->set_error($_POST['emails']['new']." is not a valid email"); + $philter->set_error($_POST['emails']['new'].' '._i18n('pool_err_not_valid')); return false; } } elseif(isset($_POST['emails']['del']) && $_POST['emails']['del'] != -1) { // delete one email @@ -203,7 +203,7 @@ class EmailPool { ."WHERE uid='{$this->uid}' AND pid='" .FwdPlugin::rtti()."' AND data='$del_id'")); if($count) { - $philter->set_error("This email is still in use and can't be deleted !"); + $philter->set_error(_i18n('pool_err_active')); return false; } else { mysql_query("DELETE FROM emails WHERE uid='{$this->uid}' " @@ -211,12 +211,11 @@ class EmailPool { unset($this->emails[$del_id]); } } else { - $philter->set_error("you must have at least one active email !"); + $philter->set_error(_i18n('pool_err_need_one')); return false; } } elseif(isset($_POST['emails']['apply'])) { // apply actives changes $one_active = false; - foreach($this->emails as $id=>$mail) if(isset($_POST['emails'][$id]['active'])) { $one_active = true; @@ -224,15 +223,16 @@ class EmailPool { } if(!$one_active) { - $philter->set_error("you must have at least one active email !"); + $philter->set_error(_i18n('pool_err_need_one')); return false; } - foreach($this->emails as $id=>$key) + foreach($this->emails as $id=>$key) { if(isset($_POST['emails'][$id]['active']) xor $this->emails[$id]->is_active()) { $this->emails[$id]->toggle_flag('active'); $this->emails[$id]->commit($this->uid, $id); } + } return true; } } diff --git a/philter/philter/include/filter.inc.php b/philter/philter/include/filter.inc.php index ce95d9d..827d252 100644 --- a/philter/philter/include/filter.inc.php +++ b/philter/philter/include/filter.inc.php @@ -70,7 +70,7 @@ class Filter { $my_rule->actions[] = $data; if(!count($my_rule->actions) && !count($my_rule->matches)) { - $philter->set_error("You cannot add an empty rule"); + $philter->set_error(_i18n('filter_err_empty')); return false; } diff --git a/philter/philter/locales/philter.en.inc.php b/philter/philter/locales/philter.en.inc.php index 184cf43..000101b 100644 --- a/philter/philter/locales/philter.en.inc.php +++ b/philter/philter/locales/philter.en.inc.php @@ -21,9 +21,14 @@ $philter->config['i18n'] = Array( 'global_title' => 'Global configuration', 'pool_title' => 'Redirection addresses Pool', + 'pool_err_already' => ' is already in the Email Pool', + 'pool_err_not_valid' => ' is not a valid email', + 'pool_err_active' => 'This email is still in use and can\'t be deleted !', + 'pool_err_need_one' => 'you must have at least one active email !', 'filter_title' => 'Individuals Rules', 'filter_list_title' => 'Filter List', + 'filter_err_empty' => 'You cannot add an empty rule', 'new_rule' => '[ new rule ]', 'filter_rule_conf' => 'Global Options', diff --git a/philter/philter/locales/philter.fr.inc.php b/philter/philter/locales/philter.fr.inc.php index 2274ca7..24baaf3 100644 --- a/philter/philter/locales/philter.fr.inc.php +++ b/philter/philter/locales/philter.fr.inc.php @@ -23,6 +23,11 @@ $philter->config['i18n'] = Array( les filtres globaux comme l\'anti-spam ou l\'anti-virus

', 'pool_title' => 'Stock d\'adresses de redirection', + 'pool_err_already' => 'est déjà dans le stock d\'emails', + 'pool_err_not_valid' => 'est un email invalide', + 'pool_err_active' => 'Cet email est encore utilisé et ne peut pas être supprimé !', + 'pool_err_need_one' => 'Vous devez avoir au moins un email actif !', + 'pool_help' => '

Tu configures ici les adresses emails vers lesquelles tu rediriges ton courrier.

Toutes les modifications faites sur cette page sont immédiatement prises @@ -56,6 +61,7 @@ $philter->config['i18n'] = Array( pas d\'action. attention ni ton correspondant ni toi ne serez averti que le mail a été jeté

', 'filter_list_title' => 'Liste des règles', + 'filter_err_empty' => 'Vous ne pouvez pas ajouter de règle vide', 'new_rule' => '[ nvlle règle ]', 'filter_rule_conf' => 'Options globales',