The branch, master has been updated via 4dd524eaf12ba46c2b1be88ad342c1973905f2cd (commit) from 9858d031da39930d15d0b309ff38e0c7644b1f8f (commit)
- Log ----------------------------------------------------------------- commit 4dd524eaf12ba46c2b1be88ad342c1973905f2cd Author: Michal Čihař mcihar@novell.com Date: Tue Mar 30 14:51:09 2010 +0200
Use ngettext for number of inserted rows.
-----------------------------------------------------------------------
Summary of changes: libraries/Message.class.php | 19 +++++++++++++++++++ libraries/messages.inc.php | 1 - sql.php | 3 +-- tbl_replace.php | 3 +-- 4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 6e43d21..c31d353 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -304,6 +304,25 @@ class PMA_Message }
/** + * get PMA_Message for number of inserted rows + * + * shorthand for getting a customized message + * + * @static + * @uses PMA_Message as returned object + * @uses PMA_Message::success() + * @uses PMA_Message::addParam() + * @param integer $rows Number of rows + * @return PMA_Message + */ + static public function inserted_rows($rows) + { + $message = PMA_Message::success(_ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows)); + $message->addParam($rows); + return $message; + } + + /** * get PMA_Message of type error with custom content * * shorthand for getting a customized error message diff --git a/libraries/messages.inc.php b/libraries/messages.inc.php index b6bc22b..c6dd01c 100644 --- a/libraries/messages.inc.php +++ b/libraries/messages.inc.php @@ -829,7 +829,6 @@ $strRoutineReturnType = __('Return type'); $strRoutines = __('Routines'); $strRowLength = __('Row length'); $strRowsFrom = __('row(s) starting from record #'); -$strRowsInserted = __('%1$d row(s) inserted.'); $strRowSize = __(' Row size '); $strRowsModeFlippedHorizontal = __('horizontal (rotated headers)'); $strRowsModeHorizontal = __('horizontal'); diff --git a/sql.php b/sql.php index d69ab8b..9234af8 100644 --- a/sql.php +++ b/sql.php @@ -492,8 +492,7 @@ if (0 == $num_rows || $is_affected) { /* For replace we get DELETED + INSERTED row count, so we have to call it affected */ $message = PMA_Message::affected_rows($num_rows); } else { - $message = PMA_Message::success('strRowsInserted'); - $message->addParam($num_rows); + $message = PMA_Message::inserted_rows($num_rows); } $insert_id = PMA_DBI_insert_id(); if ($insert_id != 0) { diff --git a/tbl_replace.php b/tbl_replace.php index f71e90a..3167baa 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -400,8 +400,7 @@ foreach ($query as $single_query) { unset($single_query, $query);
if ($is_insert && count($value_sets) > 0) { - $message = PMA_Message::success('strRowsInserted'); - $message->addParam($total_affected_rows); + $message = PMA_Message::inserted_rows($total_affected_rows); } else { $message = PMA_Message::affected_rows($total_affected_rows); }
hooks/post-receive