summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/po.pm17
-rw-r--r--doc/plugins/po.mdwn5
2 files changed, 17 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index c8ec37c22..7902fa745 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -48,6 +48,8 @@ sub import { #{{{
inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
$origsubs{'targetpage'}=\&IkiWiki::targetpage;
inject(name => "IkiWiki::targetpage", call => \&mytargetpage);
+ $origsubs{'urlto'}=\&IkiWiki::urlto;
+ inject(name => "IkiWiki::urlto", call => \&myurlto);
} #}}}
sub getsetup () { #{{{
@@ -256,6 +258,21 @@ sub urlto_with_orig_beautiful_urlpath($$) { #{{{
return $res;
} #}}}
+sub myurlto ($$;$) { #{{{
+ my $to=shift;
+ my $from=shift;
+ my $absolute=shift;
+
+ if (! length $to
+ && $config{po_link_to} eq "current"
+ && istranslation($from)
+ && istranslatable('index')) {
+ my ($masterpage, $curlang) = ($from =~ /(.*)[.]([a-z]{2})$/);
+ return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . $curlang . ".$config{htmlext}");
+ }
+ return $origsubs{'urlto'}->($to,$from,$absolute);
+} #}}}
+
sub mybestlink ($$) { #{{{
my $page=shift;
my $link=shift;
diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn
index 923ccd63a..4262640bc 100644
--- a/doc/plugins/po.mdwn
+++ b/doc/plugins/po.mdwn
@@ -254,11 +254,6 @@ in the backlinks.
`po_link_to = current`: seems to work nicely
-### parentlinks
-
-When `usedirs` is disabled and the home page is translatable, the
-parent link to the wiki home page is broken (`/index.html`).
-
Translation quality assurance
-----------------------------