HFP-924 Add singular version of plural install info

pull/44/head
Frode Petterson 2017-11-15 13:24:56 +01:00
parent 717edc2a6f
commit 6798e0bbbf
1 changed files with 37 additions and 3 deletions

View File

@ -1455,14 +1455,48 @@ class H5PStorage {
// Tell the user what we've done. // Tell the user what we've done.
if ($newOnes && $oldOnes) { if ($newOnes && $oldOnes) {
$message = $this->h5pF->t('Added %new new H5P libraries and updated %old old.', array('%new' => $newOnes, '%old' => $oldOnes)); if ($newOnes === 1) {
if ($oldOnes === 1) {
// Singular Singular
$message = $this->h5pF->t('Added %new new H5P library and updated %old old one.', array('%new' => $newOnes, '%old' => $oldOnes));
}
else {
// Singular Plural
$message = $this->h5pF->t('Added %new new H5P library and updated %old old ones.', array('%new' => $newOnes, '%old' => $oldOnes));
}
}
else {
// Plural
if ($oldOnes === 1) {
// Plural Singular
$message = $this->h5pF->t('Added %new new H5P libraries and updated %old old one.', array('%new' => $newOnes, '%old' => $oldOnes));
}
else {
// Plural Plural
$message = $this->h5pF->t('Added %new new H5P libraries and updated %old old ones.', array('%new' => $newOnes, '%old' => $oldOnes));
}
}
} }
elseif ($newOnes) { elseif ($newOnes) {
if ($newOnes === 1) {
// Singular
$message = $this->h5pF->t('Added %new new H5P library.', array('%new' => $newOnes));
}
else {
// Plural
$message = $this->h5pF->t('Added %new new H5P libraries.', array('%new' => $newOnes)); $message = $this->h5pF->t('Added %new new H5P libraries.', array('%new' => $newOnes));
} }
}
elseif ($oldOnes) { elseif ($oldOnes) {
if ($oldOnes === 1) {
// Singular
$message = $this->h5pF->t('Updated %old H5P library.', array('%old' => $oldOnes));
}
else {
// Plural
$message = $this->h5pF->t('Updated %old H5P libraries.', array('%old' => $oldOnes)); $message = $this->h5pF->t('Updated %old H5P libraries.', array('%old' => $oldOnes));
} }
}
if (isset($message)) { if (isset($message)) {
$this->h5pF->setInfoMessage($message); $this->h5pF->setInfoMessage($message);