diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 6e43d21f1..c31d35331 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -303,6 +303,25 @@ class PMA_Message return $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 * diff --git a/libraries/messages.inc.php b/libraries/messages.inc.php index b6bc22bc2..c6dd01cd2 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 d69ab8b26..9234af8b9 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 f71e90ae2..3167baa10 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); }