]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
Pass src, srcfile, dest and destfile to the canrename hook.
[ikiwiki.git] / IkiWiki / Plugin / po.pm
index 18bc999095a961685787b76bdba6f1092c74030e..c0c7557e461e9dba79b955d18c4c2c2d8046c310 100644 (file)
@@ -348,7 +348,7 @@ sub postscan (@) {
 
 # Add the renamed page translations to the list of to-be-renamed pages.
 sub renamepages($$$) {
-       my ($torename, $cgi, $session) = shift;
+       my ($torename, $cgi, $session) = (shift, shift, shift);
 
        # copy the initial array, so that we can iterate on it AND
        # modify it at the same time, without iterating on the items we
@@ -426,17 +426,18 @@ sub canremove ($$$) {
        my ($page, $cgi, $session) = (shift, shift, shift);
 
        if (istranslation($page)) {
-               return gettext("Can not remove a translation. Removing the master 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);
+sub canrename ($$@) {
+       my ($cgi, $session) = (shift, shift);
+       my %params = @_;
 
-       if (istranslation($page)) {
-               my $masterpage = masterpage($page);
+       if (istranslation($params{src})) {
+               my $masterpage = masterpage($params{src});
                # Tell the difference between:
                #  - a translation being renamed as a consequence of its master page
                #    being renamed, which is allowed
@@ -445,7 +446,7 @@ sub canrename ($$$) {
                # saved early in the renaming process.
                my $orig_torename = $session->param("po_orig_torename");
                unless (scalar grep { $_->{src} eq $masterpage } @{$orig_torename}) {
-                       return gettext("Can not rename a translation. Renaming the master page,".
+                       return gettext("Can not rename a translation. Renaming the master page, ".
                                       "though, renames its translations as well.");
                }
        }