summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-11 22:26:01 +0100
committerintrigeri <intrigeri@boum.org>2008-11-11 22:29:47 +0100
commit2b4e76a96124384fd4c53490373a443d46365ed8 (patch)
tree26ad374e0c48632b47033846d6928d1be155af0d /IkiWiki/Plugin
parentb7a4e5a51cbb3867e37f4ed5de8f94e0d41fd152 (diff)
po: change a bit the way links are generated
This will soon enable usage of translated page titles in link. Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/po.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 96ba467c5..d5964ea81 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);
@@ -407,6 +407,9 @@ sub mybeautify_urlpath ($) { #{{{
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;
} #}}}
@@ -699,7 +702,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),