From 47a299721628b405bffcf8ba424da2eba83fa4a8 Mon Sep 17 00:00:00 2001 From: tokul Date: Fri, 25 Mar 2005 14:12:39 +0000 Subject: [PATCH] translating some internal vmailmgr library messages git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9136 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/change_password/backend/vmailmgrd.php | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/plugins/change_password/backend/vmailmgrd.php b/plugins/change_password/backend/vmailmgrd.php index 9575954e..e8527d5d 100644 --- a/plugins/change_password/backend/vmailmgrd.php +++ b/plugins/change_password/backend/vmailmgrd.php @@ -185,7 +185,7 @@ function cpw_vmailmgrd_dochange($data) $vmgrd_response2 = cpw_vmailmgrd_passwd($vm_user,$vm_domain,$curpw,$newpw); if ($vmgrd_response2[0]!=0) { // TODO: add vmail.inc error message parser. - array_push($msgs, $vmgrd_response2[1]); + array_push($msgs, cpw_i18n_vmail_response($vmgrd_response2[1])); } return $msgs; @@ -210,4 +210,88 @@ function cpw_vmailmgrd_passwd($user,$domain,$oldpass,$newpass) { return vchpass($domain,$oldpass,$user,$newpass); } + +/** + * Function is used to translate messages returned by vmailmgr + * php library and vmailmgr daemon. + * @param string $string vmailmrgd message. + * @return string translated string. + */ +function cpw_i18n_vmail_response($string) { + if ($string=='Empty domain') { + // block one: vchpass responses + $ret = _("Empty domain"); + } elseif ($string=='Empty domain password') { + $ret = _("Empty domain password"); + } elseif ($string=='Empty username') { + $ret = _("Empty username"); + } elseif ($string=='Empty new password') { + $ret = _("Empty new password"); +/* + * block is disabled in order to reduce load on translators. + * these error messages should be very rare. + } elseif ($string=='Invalid or unknown base user or domain') { + // block two: vmailmgr daemon strings + $ret = _("Invalid or unknown base user or domain"); + } elseif ($string=='Invalid or unknown virtual user') { + $ret = _("Invalid or unknown virtual user"); + } elseif ($string=='Invalid or incorrect password') { + $ret = _("Invalid or incorrect password"); + } elseif ($string=='Unknown operation to stat') { + $ret = _("Unknown operation to stat"); + } elseif (preg_match("/^Incorrect number of parameters to command (.+)/",$string,$match)) { + $ret = sprintf(_("Incorrect number of parameters to command %s"),$match[1]); + } elseif (preg_match("/^Invalid or unknown domain name: (.+)/",$string,$match)) { + $ret = sprintf(_("Invalid or unknown domain name: %s"),$match[1]); + } elseif ($string=='Invalid operation') { + $ret = _("Invalid operation"); + } elseif (preg_match("/^Invalid or unknown base user name: (.+)/",$string,$match)) { + $ret = sprintf(_("Invalid or unknown base user name: %s"),$match[1]); + } elseif ($string=='Invalid or incorrect password') { + $ret = _("Invalid or incorrect password"); + } elseif ($string=='Base user has no virtual password table') { + $ret = _("Base user has no virtual password table"); + } elseif ($string=='Failed while writing initial OK response') { + $ret = _("Failed while writing initial OK response"); + } elseif ($string=='Failed while writing list entry') { + $ret = _("Failed while writing list entry"); + } elseif ($string=='Internal error -- userpass && !mustexist') { + $ret = _("Internal error -- userpass && !mustexist"); + } elseif ($string=='Invalid or unknown base user or domain') { + $ret = _("Invalid or unknown base user or domain"); + } elseif ($string=='Incorrect password') { + $ret = CPW_INVALID_PW; + } elseif ($string=='User name does not refer to a virtual user') { + $ret = _("User name does not refer to a virtual user"); + } elseif ($string=='Invalid or unknown virtual user') { + $ret = _("Invalid or unknown virtual user"); + } elseif ($string=='Virtual user already exists') { + $ret = _("Virtual user already exists"); + } elseif ($string=='Timed out waiting for remote') { + $ret = _("Timed out waiting for remote"); + } elseif ($string=='Connection to client lost') { + $ret = _("Connection to client lost"); + } elseif ($string=="Couldn't decode the command string") { + $ret = _("Couldn't decode the command string"); + } elseif ($string=='Empty command string') { + $ret = _("Empty command string"); + } elseif ($string=='Error decoding a command parameter') { + $ret = _("Error decoding a command parameter"); + } elseif ($string=='read system call failed or was interrupted') { + $ret = _("read system call failed or was interrupted"); + } elseif ($string=='Short read while reading protocol header') { + $ret = _("Short read while reading protocol header"); + } elseif ($string=='Invalid protocol from client') { + $ret = _("Invalid protocol from client"); + } elseif ($string=='Short read while reading message data') { + $ret = _("Short read while reading message data"); + } elseif ($string=='Error writing response') { + $ret = _("Error writing response"); +*/ + } else { + // return unknown strings + $ret = $string; + } + return $ret; +} ?> \ No newline at end of file -- 2.25.1