diff options
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/po.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index a8d9b9cd9..492b05c47 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -385,14 +385,14 @@ sub editcontent () { #{{{ # | Injected functions # `---- -# Implement po_link_to=current +# Implement po_link_to 'current' and 'negotiated' settings. sub mybestlink ($$) { #{{{ my $page=shift; my $link=shift; my $res=$origsubs{'bestlink'}->($page, $link); if (length $res - && $config{po_link_to} eq "current" + && ($config{po_link_to} eq "current" || $config{po_link_to} eq "negotiated") && istranslatable($res) && istranslation($page)) { return $res . "." . lang($page); @@ -406,6 +406,10 @@ sub mybeautify_urlpath ($) { #{{{ my $res=$origsubs{'beautify_urlpath'}->($url); if ($config{po_link_to} eq "negotiated") { $res =~ s!/\Qindex.$config{po_master_language}{code}.$config{htmlext}\E$!/!; + $res =~ s!/\Qindex.$config{htmlext}\E$!/!; + map { + $res =~ s!/\Qindex.$_.$config{htmlext}\E$!/!; + } (keys %{$config{po_slave_languages}}); } return $res; } #}}} @@ -497,7 +501,6 @@ sub _istranslation ($) { #{{{ my $page=shift; my $file=$pagesources{$page}; - return 0 unless (defined $file && defined pagetype($file) && pagetype($file) eq 'po'); @@ -551,7 +554,7 @@ sub otherlanguages($) { #{{{ my %ret; if (istranslatable($page)) { - %ret = %{$translations{$page}}; + %ret = %{$translations{$page}} if defined $translations{$page}; } elsif (istranslation($page)) { my $masterpage = masterpage($page); @@ -698,7 +701,7 @@ sub otherlanguagesloop ($) { #{{{ } else { push @ret, { - url => urlto($otherpage, $page), + url => urlto_with_orig_beautiful_urlpath($otherpage, $page), code => $lang, language => languagename($lang), percent => percenttranslated($otherpage), |