Update all the _( to dgettext ("domframework"

Update locales


git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5271 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-05-13 08:36:47 +00:00
parent b54fc6baa0
commit 5fcd1731fd
12 changed files with 703 additions and 511 deletions

View File

@@ -95,8 +95,8 @@ class authshibboleth extends auth
{ {
// Redirect to Shibboleth IDP // Redirect to Shibboleth IDP
if ($this->urlLogout === "") if ($this->urlLogout === "")
throw new \Exception (_("Shibboleth is not configured to allow logout"), throw new \Exception (dgettext("domframework",
405); "Shibboleth is not configured to allow logout"), 405);
$route = new route (); $route = new route ();
$route->redirect ($this->urlLogout); $route->redirect ($this->urlLogout);
} }

View File

@@ -58,8 +58,8 @@ extendedKeyUsage = serverAuth, clientAuth
// {{{ // {{{
{ {
if (! function_exists ("openssl_csr_new")) if (! function_exists ("openssl_csr_new"))
throw new \Exception (_("No openssl support in PHP"), throw new \Exception (dgettext("domframework",
500); "No openssl support in PHP"), 500);
$this->opensslCnfPath = tempnam ("/tmp", "openssl-"); $this->opensslCnfPath = tempnam ("/tmp", "openssl-");
file_put_contents ($this->opensslCnfPath, $this->opensslConf); file_put_contents ($this->opensslCnfPath, $this->opensslConf);
$this->configargs = array ( $this->configargs = array (

View File

@@ -38,30 +38,33 @@ class dbjson
500); 500);
$pos = strpos ($dsn, "://"); $pos = strpos ($dsn, "://");
if ($pos === false) if ($pos === false)
throw new \Exception (_("No DSN provided to dbjson"), 500); throw new \Exception (dgettext("domframework",
"No DSN provided to dbjson"), 500);
if (substr ($dsn, 0, $pos) !== "dbjson") if (substr ($dsn, 0, $pos) !== "dbjson")
throw new \Exception (_("Invalid database type provided in dbjson"), 500); throw new \Exception (dgettext("domframework",
"Invalid database type provided in dbjson"), 500);
$this->dbfile = substr ($dsn, $pos+3); $this->dbfile = substr ($dsn, $pos+3);
$directory = dirname ($this->dbfile); $directory = dirname ($this->dbfile);
if (! file_exists ($directory)) if (! file_exists ($directory))
@mkdir ($directory, 0777, true); @mkdir ($directory, 0777, true);
if (! file_exists ($directory)) if (! file_exists ($directory))
throw new \Exception (sprintf (_("Directory '%s' doesn't exists"), throw new \Exception (sprintf (dgettext("domframework",
$directory), 500); "Directory '%s' doesn't exists"), $directory), 500);
if (! file_exists ($this->dbfile)) if (! file_exists ($this->dbfile))
{ {
if (! is_readable ($directory)) if (! is_readable ($directory))
throw new \Exception (sprintf ( throw new \Exception (sprintf (
_("Directory '%s' not writeable and dbfile '%s' not exists"), dgettext("domframework",
"Directory '%s' not writeable and dbfile '%s' not exists"),
$directory, $this->dbfile), 500); $directory, $this->dbfile), 500);
touch ($this->dbfile); touch ($this->dbfile);
} }
if (! is_readable ($this->dbfile)) if (! is_readable ($this->dbfile))
throw new \Exception(sprintf (_("File '%s' not readable"), $this->dbfile), throw new \Exception(sprintf (dgettext("domframework",
500); "File '%s' not readable"), $this->dbfile), 500);
if (! is_writeable ($this->dbfile)) if (! is_writeable ($this->dbfile))
throw new \Exception(sprintf (_("File '%s' not readable"), $this->dbfile), throw new \Exception(sprintf (dgettext("domframework",
500); "File '%s' not readable"), $this->dbfile), 500);
$this->dsn = $dsn; $this->dsn = $dsn;
$this->dbfile = $this->dbfile; $this->dbfile = $this->dbfile;
} }

View File

@@ -453,7 +453,8 @@ class form
if ($field->mandatory !== null && if ($field->mandatory !== null &&
(! array_key_exists ($field->name, $values) || (! array_key_exists ($field->name, $values) ||
trim ($values[$field->name]) === "")) trim ($values[$field->name]) === ""))
$errors[$field->name] = _("Field mandatory and not provided"); $errors[$field->name] = dgettext("domframework",
"Field mandatory and not provided");
} }
return $errors; return $errors;
} }

View File

@@ -98,7 +98,7 @@ class fts
{ {
if (! array_key_exists ($field, $dbl->fields ())) if (! array_key_exists ($field, $dbl->fields ()))
throw new \Exception (sprintf ( throw new \Exception (sprintf (
_("The field '%s' doesn't exists in database"), dgettext("domframework", "The field '%s' doesn't exists in database"),
$field), 500); $field), 500);
if ($i > 0) if ($i > 0)
$dbl->whereAddOR (); $dbl->whereAddOR ();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -109,7 +109,8 @@ class mail
private function sectionAddChild ($sectionIDParent, $sectionIDchild) private function sectionAddChild ($sectionIDParent, $sectionIDchild)
{ {
if (! array_key_exists ($sectionIDParent, $this->sections)) if (! array_key_exists ($sectionIDParent, $this->sections))
throw new \Exception (_("Section parent not found"), 404); throw new \Exception (dgettext("domframework",
"Section parent not found"), 404);
$this->sections[$sectionIDParent]["_partsIDchild"][] = $sectionIDchild; $this->sections[$sectionIDParent]["_partsIDchild"][] = $sectionIDchild;
$this->sections[$sectionIDchild]["_parentID"] = $sectionIDParent; $this->sections[$sectionIDchild]["_parentID"] = $sectionIDParent;
} }
@@ -121,7 +122,8 @@ class mail
private function sectionAddChildFirst ($sectionIDParent, $sectionIDchild) private function sectionAddChildFirst ($sectionIDParent, $sectionIDchild)
{ {
if (! array_key_exists ($sectionIDParent, $this->sections)) if (! array_key_exists ($sectionIDParent, $this->sections))
throw new \Exception (_("Section parent not found"), 404); throw new \Exception (dgettext("domframework",
"Section parent not found"), 404);
array_unshift ($this->sections[$sectionIDParent]["_partsIDchild"], array_unshift ($this->sections[$sectionIDParent]["_partsIDchild"],
$sectionIDchild); $sectionIDchild);
$this->sections[$sectionIDchild]["_parentID"] = $sectionIDParent; $this->sections[$sectionIDchild]["_parentID"] = $sectionIDParent;
@@ -134,7 +136,8 @@ class mail
private function sectionDelChilds ($sectionID) private function sectionDelChilds ($sectionID)
{ {
if (! array_key_exists ($sectionID, $this->sections)) if (! array_key_exists ($sectionID, $this->sections))
throw new \Exception (_("Section not found"), 404); throw new \Exception (dgettext("domframework",
"Section not found"), 404);
unset ($this->sections[$sectionID]["_partsIDchild"]); unset ($this->sections[$sectionID]["_partsIDchild"]);
} }
@@ -145,10 +148,10 @@ class mail
private function sectionUpdate ($sectionID, $param) private function sectionUpdate ($sectionID, $param)
{ {
if (! array_key_exists ($sectionID, $this->sections)) if (! array_key_exists ($sectionID, $this->sections))
throw new \Exception (_("Section not found"), 404); throw new \Exception (dgettext("domframework", "Section not found"), 404);
if (! is_array ($param)) if (! is_array ($param))
throw new \Exception (_("Param provided to sectionUpdate is not array"), throw new \Exception (dgettext("domframework",
406); "Param provided to sectionUpdate is not array"), 406);
foreach ($param as $key=>$val) foreach ($param as $key=>$val)
{ {
$this->sections[$sectionID][$key] = $val; $this->sections[$sectionID][$key] = $val;
@@ -186,7 +189,8 @@ class mail
private function sectionGet ($sectionID) private function sectionGet ($sectionID)
{ {
if (! array_key_exists ($sectionID, $this->sections)) if (! array_key_exists ($sectionID, $this->sections))
throw new \Exception (_("Section not found"), 404); throw new \Exception (dgettext("domframework",
"Section not found"), 404);
return $this->sections[$sectionID]; return $this->sections[$sectionID];
} }
@@ -260,7 +264,8 @@ class mail
$boundaryCR = array_shift ($boundaryArray); $boundaryCR = array_shift ($boundaryArray);
} }
if ($boundary === false) if ($boundary === false)
throw new \Exception (_("Can't find boundary in multipart/"), 406); throw new \Exception (dgettext("domframework",
"Can't find boundary in multipart/"), 406);
$boundary = substr ($boundary, 2); $boundary = substr ($boundary, 2);
unset ($boundaryArray); unset ($boundaryArray);
$this->sectionUpdate ($sectionIDParent, $this->sectionUpdate ($sectionIDParent,
@@ -428,9 +433,11 @@ class mail
public function __construct () public function __construct ()
{ {
if (! function_exists ("finfo_buffer")) if (! function_exists ("finfo_buffer"))
throw new \Exception (_("Missing FileInfo PHP Extension"), 500); throw new \Exception (dgettext("domframework",
"Missing FileInfo PHP Extension"), 500);
if (! function_exists ("openssl_random_pseudo_bytes")) if (! function_exists ("openssl_random_pseudo_bytes"))
throw new \Exception (_("Missing OpenSSL PHP Extension"), 500); throw new \Exception (dgettext("domframework",
"Missing OpenSSL PHP Extension"), 500);
// Define default headers // Define default headers
$this->addHeader ("Date", date ("r")); $this->addHeader ("Date", date ("r"));
$this->addHeader ("Message-ID", $this->provideMessageID ()); $this->addHeader ("Message-ID", $this->provideMessageID ());
@@ -525,7 +532,8 @@ class mail
if ($sectionIDtoChange === "") if ($sectionIDtoChange === "")
{ {
// No existing section found : need to create one // No existing section found : need to create one
throw new \Exception (_("Can't find the place to store the HTML"), 500); throw new \Exception (dgettext("domframework",
"Can't find the place to store the HTML"), 500);
} }
$htmlContent = iconv ("utf-8", $charset, $htmlContent); $htmlContent = iconv ("utf-8", $charset, $htmlContent);
$part["_charset"] = $charset; $part["_charset"] = $charset;
@@ -610,7 +618,8 @@ class mail
if ($sectionIDtoChange === "") if ($sectionIDtoChange === "")
{ {
// No existing section found : need to create one // No existing section found : need to create one
throw new \Exception (_("Can't find the place to store the TEXT"), 500); throw new \Exception (dgettext("domframework",
"Can't find the place to store the TEXT"), 500);
} }
$textContent = iconv ("utf-8", $charset, $textContent); $textContent = iconv ("utf-8", $charset, $textContent);
$part["_charset"] = $charset; $part["_charset"] = $charset;
@@ -866,8 +875,8 @@ class mail
{ {
$attachmentIDs = $this->getAttachmentID ($inline); $attachmentIDs = $this->getAttachmentID ($inline);
if (! array_key_exists ($number, $attachmentIDs)) if (! array_key_exists ($number, $attachmentIDs))
throw new \Exception (sprintf (_("Attachment '%d' not found"), $number), throw new \Exception (sprintf (dgettext("domframework",
404); "Attachment '%d' not found"), $number), 404);
$part = $this->sectionGet ($attachmentIDs[$number]); $part = $this->sectionGet ($attachmentIDs[$number]);
$encoding = $this->getHeaderValue ("Content-Transfer-Encoding", $encoding = $this->getHeaderValue ("Content-Transfer-Encoding",
$part["_headersArray"]); $part["_headersArray"]);
@@ -883,8 +892,8 @@ class mail
{ {
$attachmentIDs = $this->getAttachmentID ($inline); $attachmentIDs = $this->getAttachmentID ($inline);
if (! array_key_exists ($number, $attachmentIDs)) if (! array_key_exists ($number, $attachmentIDs))
throw new \Exception (sprintf (_("Attachment '%d' not found"), $number), throw new \Exception (sprintf (dgettext("domframework",
404); "Attachment '%d' not found"), $number), 404);
$part = $this->sectionGet ($attachmentIDs[$number]); $part = $this->sectionGet ($attachmentIDs[$number]);
foreach ($part as $key=>$val) foreach ($part as $key=>$val)
{ {
@@ -1419,9 +1428,8 @@ class mail
return chunk_split ($content); return chunk_split ($content);
} }
throw new \Exception (sprintf ( throw new \Exception (sprintf (
_("Invalid encoding provided to encodingEncode : %s"), dgettext("domframework",
$encoding), "Invalid encoding provided to encodingEncode : %s"), $encoding), 500);
500);
} }
/** Decode the content with correct encoding. /** Decode the content with correct encoding.
@@ -1439,9 +1447,8 @@ class mail
elseif ($encoding === "8bit" || $encoding === "7bit" || $encoding === false) elseif ($encoding === "8bit" || $encoding === "7bit" || $encoding === false)
return $content; return $content;
throw new \Exception (sprintf ( throw new \Exception (sprintf (
_("Invalid encoding provided to encodingDecode : '%s'"), dgettext("domframework",
$encoding), "Invalid encoding provided to encodingDecode : '%s'"), $encoding), 500);
500);
} }
/** Encode a string to be compliant with MIME (used in headers) /** Encode a string to be compliant with MIME (used in headers)
@@ -1461,8 +1468,8 @@ class mail
elseif ($encoding === "base64") elseif ($encoding === "base64")
$prefs["scheme"] = "B"; $prefs["scheme"] = "B";
else else
throw new \Exception (_("Invalid encoding provided to encodeHeaders"), throw new \Exception (dgettext("domframework",
500); "Invalid encoding provided to encodeHeaders"), 500);
return substr (iconv_mime_encode ($header, $content, $prefs), return substr (iconv_mime_encode ($header, $content, $prefs),
strlen ($header)+2); strlen ($header)+2);
} }
@@ -1496,9 +1503,8 @@ class mail
elseif ($encoding === "base64") elseif ($encoding === "base64")
$prefs["scheme"] = "B"; $prefs["scheme"] = "B";
else else
throw new \Exception (_("Invalid encoding provided to ". throw new \Exception (dgettext("domframework",
"encodeHeaderStringWithPosition"), "Invalid encoding provided to encodeHeaderStringWithPosition"), 500);
500);
return substr (iconv_mime_encode (str_repeat (" ", $blanks), $content, return substr (iconv_mime_encode (str_repeat (" ", $blanks), $content,
$prefs), $prefs),
$blanks+2); $blanks+2);

View File

@@ -203,7 +203,8 @@ class queuefile extends queue
if (! key_exists ($i, $entries)) if (! key_exists ($i, $entries))
{ {
$file->lockUN ($this->queue); $file->lockUN ($this->queue);
throw new \Exception ("Invalid entry requested", 406); throw new \Exception (dgettext("domframework",
"Invalid entry requested"), 406);
} }
$json = $entries[$i]; $json = $entries[$i];
$content = json_decode ($json, true); $content = json_decode ($json, true);

View File

@@ -79,8 +79,8 @@ class smtp
{ {
if ($errstr === "" && $php_errormsg !== "") if ($errstr === "" && $php_errormsg !== "")
$errstr = $php_errormsg; $errstr = $php_errormsg;
throw new \Exception (sprintf (_("Can't connect to SMTP server : %s"), throw new \Exception (sprintf (dgettext("domframework",
$errstr), 500); "Can't connect to SMTP server : %s"), $errstr), 500);
} }
stream_set_timeout ($this->smtpStream, $this->timeout); stream_set_timeout ($this->smtpStream, $this->timeout);
// Wait for banner // Wait for banner
@@ -103,14 +103,15 @@ class smtp
if (@stream_socket_enable_crypto ($this->smtpStream, true, if (@stream_socket_enable_crypto ($this->smtpStream, true,
STREAM_CRYPTO_METHOD_TLS_CLIENT) === STREAM_CRYPTO_METHOD_TLS_CLIENT) ===
false) false)
throw new \Exception (sprintf (_("Can't activate STARTTLS %s"), throw new \Exception (sprintf (dgettext("domframework",
strstr ($php_errormsg, ": ")), 500); "Can't activate STARTTLS %s"), strstr ($php_errormsg, ": ")), 500);
ini_set('track_errors', 0); ini_set('track_errors', 0);
$this->debug ("STARTTLS ACTIVATED\n"); $this->debug ("STARTTLS ACTIVATED\n");
} }
} }
elseif ($this->starttls === "encrypt") elseif ($this->starttls === "encrypt")
throw new \Exception (_("Server doesn't supports STARTTLS"), 500); throw new \Exception (dgettext("domframework",
"Server doesn't supports STARTTLS"), 500);
if ($this->user !== null && $this->password !== null) if ($this->user !== null && $this->password !== null)
{ {
@@ -132,8 +133,8 @@ class smtp
} }
else else
throw new \Exception ( throw new \Exception (
_("No authentication method available for the server"), dgettext("domframework",
500); "No authentication method available for the server"), 500);
} }
} }
@@ -168,8 +169,8 @@ class smtp
{ {
if ($this->smtpStream === null) if ($this->smtpStream === null)
throw new \Exception ( throw new \Exception (
_("Can't send email : not connected to SMTP server"), dgettext("domframework",
500); "Can't send email : not connected to SMTP server"), 500);
$from = $this->cleanMail ($from); $from = $this->cleanMail ($from);
if (is_string ($to)) if (is_string ($to))
$to = explode (",", $to); $to = explode (",", $to);
@@ -198,8 +199,8 @@ class smtp
{ {
if ($this->smtpStream === null) if ($this->smtpStream === null)
throw new \Exception ( throw new \Exception (
_("Can't send email : not connected to SMTP server"), dgettext("domframework",
500); "Can't send email : not connected to SMTP server"), 500);
$this->putLine ("QUIT\r\n"); $this->putLine ("QUIT\r\n");
fclose ($this->smtpStream); fclose ($this->smtpStream);
} }
@@ -210,8 +211,8 @@ class smtp
{ {
if ($this->smtpStream === null) if ($this->smtpStream === null)
throw new \Exception ( throw new \Exception (
_("Can't send email : not connected to SMTP server"), dgettext("domframework",
500); "Can't send email : not connected to SMTP server"), 500);
$this->putLine ("RSET\r\n"); $this->putLine ("RSET\r\n");
} }