Use ngettext for number of inserted rows.

This commit is contained in:
Michal Čihař
2010-03-30 14:51:09 +02:00
parent 9858d031da
commit 4dd524eaf1
4 changed files with 21 additions and 5 deletions

View File

@@ -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
*

View File

@@ -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');

View File

@@ -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) {

View File

@@ -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);
}