Fix some plural strings and a missing title. Reported by David Ciscar Presas.

This commit is contained in:
Sébastien Lucas 2013-01-05 14:33:12 +01:00
parent 5105fa0a69
commit 393f38a281
5 changed files with 14 additions and 6 deletions

View File

@ -53,7 +53,7 @@ order by substr (upper (sort), 1, 1)');
while ($post = $result->fetchObject ())
{
array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
str_format (localize("authorword.many"), $post->count), "text",
str_format (localize("authorword", $post->count), $post->count), "text",
array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title)))));
}
return $entryArray;
@ -74,7 +74,7 @@ order by substr (upper (sort), 1, 1)');
{
$author = new Author ($post->id, $post->sort);
array_push ($entryArray, new Entry ($post->sort, $author->getEntryId (),
str_format (localize("bookword.many"), $post->count), "text",
str_format (localize("bookword", $post->count), $post->count), "text",
array ( new LinkNavigation ($author->getUri ()))));
}
return $entryArray;

View File

@ -43,7 +43,14 @@ function str_format($format) {
* This method is based on this page
* http://www.mind-it.info/2010/02/22/a-simple-approach-to-localization-in-php/
*/
function localize($phrase) {
function localize($phrase, $count=-1) {
if ($count == 0)
$phrase .= ".none";
if ($count == 1)
$phrase .= ".one";
if ($count > 1)
$phrase .= ".many";
/* Static keyword is used to ensure the file is loaded only once */
static $translations = NULL;
/* If no instance of $translations has occured load the language file */
@ -312,6 +319,7 @@ class PageAllAuthorsLetter extends Page
{
global $config;
$this->title = str_format (localize ("splitByLetter.letter"), localize ("authorword.title"), $this->idGet);
$this->idPage = Author::getEntryIdByLetter ($this->idGet);
$this->entryArray = Author::getAuthorsByStartingLetter ($this->idGet);
}

View File

@ -421,7 +421,7 @@ order by substr (upper (sort), 1, 1)");
while ($post = $result->fetchObject ())
{
array_push ($entryArray, new Entry ($post->title, Book::getEntryIdByLetter ($post->title),
str_format (localize("bookword.many"), $post->count), "text",
str_format (localize("bookword", $post->count), $post->count), "text",
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_BOOKS_LETTER."&id=". rawurlencode ($post->title)))));
}
return $entryArray;

View File

@ -66,7 +66,7 @@ order by series.sort');
{
$serie = new Serie ($post->id, $post->sort);
array_push ($entryArray, new Entry ($serie->name, $serie->getEntryId (),
str_format (localize("bookword.many"), $post->count), "text",
str_format (localize("bookword", $post->count), $post->count), "text",
array ( new LinkNavigation ($serie->getUri ()))));
}
return $entryArray;

View File

@ -55,7 +55,7 @@ order by tags.name');
{
$tag = new Tag ($post->id, $post->name);
array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (),
str_format (localize("bookword.many"), $post->count), "text",
str_format (localize("bookword", $post->count), $post->count), "text",
array ( new LinkNavigation ($tag->getUri ()))));
}
return $entryArray;