doc: use `sprintf' in exceptions

refs #4820
This commit is contained in:
Eric Lippmann 2014-08-19 13:20:46 +02:00
parent 127e4f444f
commit d35e0816c9
4 changed files with 13 additions and 8 deletions

View File

@ -44,13 +44,13 @@ class Doc_ModuleController extends DocController
$moduleManager = Icinga::app()->getModuleManager();
if (! $moduleManager->hasInstalled($moduleName)) {
throw new Zend_Controller_Action_Exception(
$this->translate('Module') . ' \'' . $moduleName . '\' ' . $this->translate('is not installed'),
$this->translate(sprintf('Module \'%s\' is not installed', $moduleName)),
404
);
}
if (! $moduleManager->hasEnabled($moduleName)) {
throw new Zend_Controller_Action_Exception(
$this->translate('Module') . ' \'' . $moduleName . '\' ' . $this->translate('is not enabled'),
$this->translate(sprintf('Module \'%s\' is not enabled', $moduleName)),
404
);
}

View File

@ -41,19 +41,24 @@ class DocParser
{
if (! is_dir($path)) {
throw new DocException(
mt('doc', 'Documentation directory') . ' \'' . $path . '\' ' . mt('doc', 'does not exist')
mt('doc', sprintf('Documentation directory \'%s\' does not exist', $path))
);
}
if (! is_readable($path)) {
throw new DocException(
mt('doc', 'Documentation directory') . ' \'' . $path . '\' ' . mt('doc', 'is not readable')
mt('doc', sprintf('Documentation directory \'%s\' is not readable', $path))
);
}
$docIterator = new DocIterator($path);
if ($docIterator->count() === 0) {
throw new DocEmptyException(
mt('doc', 'Documentation directory') . ' \'' . $path . '\' '
. mt('doc', 'does not contain any non-empty Markdown file (\'.md\' suffix')
mt(
'doc',
sprintf(
'Documentation directory \'%s\' does not contain any non-empty Markdown file (\'.md\' suffix)',
$path
)
)
);
}
$this->path = $path;

View File

@ -57,7 +57,7 @@ class DocTree extends Node
}
if (! isset($this->nodes[$parentId])) {
throw new LogicException(
sprintf('Can\'t add child node: there\'s no parent node having the id \'%s\'', $parentId)
mt('doc', sprintf('Can\'t add child node: there\'s no parent node having the id \'%s\'', $parentId))
);
}
$this->nodes[$childId] = $this->nodes[$parentId]->appendChild($child);

View File

@ -134,7 +134,7 @@ class SectionRenderer extends Renderer
$filter = new SectionFilterIterator($docTree, $chapterId);
if ($filter->count() === 0) {
throw new ChapterNotFoundException(
mt('doc', 'Chapter') . ' \'' . $chapterId . '\' ' . mt('doc', 'not found')
mt('doc', sprintf('Chapter \'%s\' not found', $chapterId))
);
}
parent::__construct(