X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/5412a95fd00017fb95037140393b864d38e2be0b..a8105f68590c7aa56fc37ec62df854546a119060:/IkiWiki/Plugin/po.pm diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 205066341..2dad3b60b 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -39,6 +39,8 @@ sub import { hook(type => "rename", id => "po", call => \&renamepages); hook(type => "delete", id => "po", call => \&mydelete); hook(type => "change", id => "po", call => \&change); + hook(type => "canremove", id => "po", call => \&canremove); + hook(type => "canrename", id => "po", call => \&canrename); hook(type => "editcontent", id => "po", call => \&editcontent); $origsubs{'bestlink'}=\&IkiWiki::bestlink; @@ -406,6 +408,26 @@ sub change(@) { } } +sub canremove ($$$) { + my ($page, $cgi, $session) = (shift, shift, shift); + + if (istranslation($page)) { + return gettext("Can not remove a translation. Removing the master page,". + "though, removes its translations as well."); + } + return undef; +} + +sub canrename ($$$) { + my ($page, $cgi, $session) = (shift, shift, shift); + + if (istranslation($page)) { + return gettext("Can not rename a translation. Renaming the master page,". + "though, renames its translations as well."); + } + return undef; +} + # As we're previewing or saving a page, the content may have # changed, so tell the next filter() invocation it must not be lazy. sub editcontent () {