From: Jan Schneider Date: Tue, 12 Oct 2010 21:15:31 +0000 (+0200) Subject: We need to use ngettext() for the method name, otherwise the gettext tools don't... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1988a02cffeb23fa460d3427f07f2aba75a7617b;p=horde.git We need to use ngettext() for the method name, otherwise the gettext tools don't handle this as plural form gettext. --- diff --git a/framework/Block/lib/Horde/Block/Layout/Manager.php b/framework/Block/lib/Horde/Block/Layout/Manager.php index 2b1682569..e740a6579 100644 --- a/framework/Block/lib/Horde/Block/Layout/Manager.php +++ b/framework/Block/lib/Horde/Block/Layout/Manager.php @@ -242,7 +242,7 @@ class Horde_Block_Layout_Manager extends Horde_Block_Layout try { $message = Horde::callHook('perms_denied', array('horde:max_blocks')); } catch (Horde_Exception_HookNotSet $e) { - $message = htmlspecialchars(sprintf($this->_dict->n("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", $max_blocks), $max_blocks)); + $message = htmlspecialchars(sprintf($this->_dict->ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", $max_blocks), $max_blocks)); } $GLOBALS['notification']->push($message, 'horde.error', array('content.raw')); break; diff --git a/framework/Core/lib/Horde/Core/Auth/Application.php b/framework/Core/lib/Horde/Core/Auth/Application.php index 2d4e0ecb1..a31bd3d34 100644 --- a/framework/Core/lib/Horde/Core/Auth/Application.php +++ b/framework/Core/lib/Horde/Core/Auth/Application.php @@ -580,7 +580,7 @@ class Horde_Core_Auth_Application extends Horde_Auth_Base isset($GLOBALS['notification']) && ($expire = $this->_base->getCredential('expire'))) { $toexpire = ($expire - time()) / 86400; - $GLOBALS['notification']->push(sprintf($this->_coreDict->n("%d day until your password expires.", "%d days until your password expires.", $toexpire), $toexpire), 'horde.warning'); + $GLOBALS['notification']->push(sprintf($this->_coreDict->ngettext("%d day until your password expires.", "%d days until your password expires.", $toexpire), $toexpire), 'horde.warning'); } if ($this->hasCapability('authenticatecallback')) { diff --git a/framework/Core/lib/Horde/Core/Mime/Viewer/Vcard.php b/framework/Core/lib/Horde/Core/Mime/Viewer/Vcard.php index c16b05ab0..424794f60 100644 --- a/framework/Core/lib/Horde/Core/Mime/Viewer/Vcard.php +++ b/framework/Core/lib/Horde/Core/Mime/Viewer/Vcard.php @@ -130,7 +130,7 @@ class Horde_Core_Mime_Viewer_Vcard extends Horde_Mime_Viewer_Base } } } - $notification->push(sprintf($this->_coreDict->n( + $notification->push(sprintf($this->_coreDict->ngettext( "%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), diff --git a/framework/Date/lib/Horde/Date/Utils.php b/framework/Date/lib/Horde/Date/Utils.php index 49df5fe10..bfa2b5aed 100644 --- a/framework/Date/lib/Horde/Date/Utils.php +++ b/framework/Date/lib/Horde/Date/Utils.php @@ -84,16 +84,16 @@ class Horde_Date_Utils $delta = time() - $timestamp; if ($delta < 60) { - return sprintf($dict->n("%d second ago", "%d seconds ago", $delta), $delta); + return sprintf($dict->ngettext("%d second ago", "%d seconds ago", $delta), $delta); } $delta = round($delta / 60); if ($delta < 60) { - return sprintf($dict->n("%d minute ago", "%d minutes ago", $delta), $delta); + return sprintf($dict->ngettext("%d minute ago", "%d minutes ago", $delta), $delta); } $delta = round($delta / 60); if ($delta < 24) { - return sprintf($dict->n("%d hour ago", "%d hours ago", $delta), $delta); + return sprintf($dict->ngettext("%d hour ago", "%d hours ago", $delta), $delta); } if ($delta > 24 && $delta < 48) { @@ -108,7 +108,7 @@ class Horde_Date_Utils if (round($delta / 7) < 5) { $delta = round($delta / 7); - return sprintf($dict->n("%d week ago", "%d weeks ago", $delta), $delta); + return sprintf($dict->ngettext("%d week ago", "%d weeks ago", $delta), $delta); } // Default to the user specified date format. diff --git a/framework/Form/Form/Type.php b/framework/Form/Form/Type.php index 24a3a92a2..f20748f25 100644 --- a/framework/Form/Form/Type.php +++ b/framework/Form/Form/Type.php @@ -641,7 +641,7 @@ class Horde_Form_Type_countedtext extends Horde_Form_Type_longtext { $message = $this->_dict->t("This field is required."); } elseif ($length > $this->_chars) { $valid = false; - $message = sprintf($this->_dict->n("There are too many characters in this field. You have entered %d character; ", "There are too many characters in this field. You have entered %d characters; ", $length), $length) + $message = sprintf($this->_dict->ngettext("There are too many characters in this field. You have entered %d character; ", "There are too many characters in this field. You have entered %d characters; ", $length), $length) . sprintf($this->_dict->t("you must enter less than %d."), $this->_chars); } diff --git a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Rar.php b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Rar.php index e221ac5f1..2fff6dbb9 100644 --- a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Rar.php +++ b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Rar.php @@ -92,7 +92,7 @@ class Horde_Mime_Viewer_Rar extends Horde_Mime_Viewer_Base 'encode' => true, 'encode_all' => true )) . "\n" . - $this->_textFilter(sprintf($this->_dict->n("File Count: %d file", "File Count: %d files", $fileCount), $fileCount), 'space2html', array( + $this->_textFilter(sprintf($this->_dict->ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount), 'space2html', array( 'charset' => $charset, 'encode' => true, 'encode_all' => true diff --git a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Tgz.php b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Tgz.php index b5a10429c..2467358a3 100644 --- a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Tgz.php +++ b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Tgz.php @@ -110,7 +110,7 @@ class Horde_Mime_Viewer_Tgz extends Horde_Mime_Viewer_Base 'encode' => true, 'encode_all' => true )) . "\n" . - $this->_textFilter(sprintf($this->_dict->n("File Count: %d file", "File Count: %d files", $fileCount), $fileCount), 'Space2html', array( + $this->_textFilter(sprintf($this->_dict->ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount), 'Space2html', array( 'charset' => $charset, 'encode' => true, 'encode_all' => true diff --git a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Zip.php b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Zip.php index d77bdb8e1..08a3e718f 100644 --- a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Zip.php +++ b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Zip.php @@ -98,7 +98,7 @@ class Horde_Mime_Viewer_Zip extends Horde_Mime_Viewer_Base $this->_dict->t("Archive Name") . ': ' . $name . "\n" . $this->_dict->t("Archive File Size") . ': ' . strlen($contents) . " bytes\n" . - sprintf($this->_dict->n("File Count: %d file", "File Count: %d files", $fileCount), $fileCount) . + sprintf($this->_dict->ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount) . "\n\n" . str_repeat(' ', 15) . Horde_String::pad($this->_dict->t("Attributes"), 10, ' ', STR_PAD_LEFT) . diff --git a/framework/Translation/lib/Horde/Translation/Gettext.php b/framework/Translation/lib/Horde/Translation/Gettext.php index e4f06e4b7..a5078dba7 100644 --- a/framework/Translation/lib/Horde/Translation/Gettext.php +++ b/framework/Translation/lib/Horde/Translation/Gettext.php @@ -73,7 +73,7 @@ class Horde_Translation_Gettext implements Horde_Translation * @return string The string translation, or the original string if no * translation exists. */ - public function n($singular, $plural, $number) + public function ngettext($singular, $plural, $number) { return $this->_gettext ? dngettext($this->_domain, $singular, $plural, $number)