po plugin: fix linking from a translation to its master page
authorintrigeri <intrigeri@boum.org>
Sun, 2 Nov 2008 19:08:38 +0000 (20:08 +0100)
committerintrigeri <intrigeri@boum.org>
Sun, 2 Nov 2008 19:08:38 +0000 (20:08 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm

index 88f8194fbe7cb70bb93c15c74dd14a1dbe96ae5a..0902322e31be9fbe5d41dba47fe75e3384f37e48 100644 (file)
@@ -252,6 +252,17 @@ sub mybeautify_urlpath ($) { #{{{
        return $res;
 } #}}}
 
+sub urlto_with_orig_beautiful_urlpath($$) { #{{{
+       my $to=shift;
+       my $from=shift;
+
+       inject(name => "IkiWiki::beautify_urlpath", call => $origsubs{'beautify_urlpath'});
+       my $res=urlto($to, $from);
+       inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
+
+       return $res;
+} #}}}
+
 sub mybestlink ($$) { #{{{
        my $page=shift;
        my $link=shift;
@@ -359,7 +370,7 @@ sub otherlanguages ($) { #{{{
        elsif (istranslation($page)) {
                my ($masterpage, $curlang) = ($page =~ /(.*)[.]([a-z]{2})$/);
                push @ret, {
-                       url => urlto($masterpage, $page),
+                       url => urlto_with_orig_beautiful_urlpath($masterpage, $page),
                        code => $config{po_master_language}{code},
                        language => $config{po_master_language}{name},
                        master => 1,