1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-15 03:05:26 +02:00

Fix issue processwire/processwire-issues#690 where isMoveable() error messages were not yet multi-language translatable

This commit is contained in:
Ryan Cramer
2018-09-13 10:33:40 -04:00
parent 2c9b25fdfd
commit 84e5fd6b51

View File

@@ -219,32 +219,46 @@ class PagesEditor extends Wire {
// make sure the page template allows moves. // make sure the page template allows moves.
// only move always allowed is to the trash, unless page has system status // only move always allowed is to the trash, unless page has system status
$reason = $reason =
"Page using template '$page->template' is not moveable " . sprintf($this->_('Page using template “%s” is not moveable.'), $page->template->name) . ' ' .
"(Template::noMove) [{$oldParent->path} => {$newParent->path}]."; "(Template::noMove) [{$oldParent->path} => {$newParent->path}]";
} else if($newParent->template->noChildren) { } else if($newParent->template->noChildren) {
// check if new parent disallows children // check if new parent disallows children
$reason = $reason = sprintf(
"Chosen parent '$newParent->path' uses template '$newParent->template' that does not allow children."; $this->_('Chosen parent “%1$s” uses template “%2$s” that does not allow children.'),
$newParent->path,
$newParent->template->name
);
} else if($newParent->id && $newParent->id != $config->trashPageID && count($newParent->template->childTemplates) } else if($newParent->id && $newParent->id != $config->trashPageID && count($newParent->template->childTemplates)
&& !in_array($page->template->id, $newParent->template->childTemplates)) { && !in_array($page->template->id, $newParent->template->childTemplates)) {
// make sure the new parent's template allows pages with this template // make sure the new parent's template allows pages with this template
$reason = $reason = sprintf(
"Cannot move '$page->name' because template '$newParent->template' used by page '$newParent->path' " . $this->_('Cannot move “%1$s” because template “%2$s” used by page “%3$s” does not allow children using template “%4$s”.'),
"does not allow children using template '$page->template'."; $page->name,
$newParent->template->name,
$newParent->path,
$page->template->name
);
} else if(count($page->template->parentTemplates) && $newParent->id != $config->trashPageID } else if(count($page->template->parentTemplates) && $newParent->id != $config->trashPageID
&& !in_array($newParent->template->id, $page->template->parentTemplates)) { && !in_array($newParent->template->id, $page->template->parentTemplates)) {
// check for allowed parentTemplates setting // check for allowed parentTemplates setting
$reason = $reason = sprintf(
"Cannot move '$page->name' because template '$newParent->template' used by new parent '$newParent->path' " . $this->_('Cannot move “%1$s” because template “%2$s” used by new parent “%3$s” is not allowed by moved page template “%4$s”.'),
"is not allowed by moved page template '$page->template'."; $page->name,
$newParent->template->name,
$newParent->path,
$page->template->name
);
} else if(count($newParent->children("name=$page->name, id!=$page->id, include=all"))) { } else if(count($newParent->children("name=$page->name, id!=$page->id, include=all"))) {
// check for page name collision // check for page name collision
$reason = $reason = sprintf(
"Chosen parent '$newParent->path' already has a page named '$page->name'."; $this->_('Chosen parent “%1$s” already has a page named “%2$s”.'),
$newParent->path,
$page->name
);
} else { } else {
$moveable = true; $moveable = true;