summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-08-27 15:51:55 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-08-27 15:51:55 -0400
commit023c3046c0d5d595fd92c535842bf05fb0da0955 (patch)
tree0a7dd23492f6e089351f32bad33e7e77cc686b07
parentf8ad1bfec4e12944482d5f58a0961b0c476602c9 (diff)
parentcdc3576c8d1efb2593cac2d9da3f2393a2afe26e (diff)
Merge commit 'intrigeri/po'
-rw-r--r--IkiWiki/Plugin/po.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 1b313a979..12f41f6de 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -51,8 +51,6 @@ sub import {
hook(type => "formbuilder_setup", id => "po", call => \&formbuilder_setup, last => 1);
hook(type => "formbuilder", id => "po", call => \&formbuilder);
- $origsubs{'bestlink'}=\&IkiWiki::bestlink;
- inject(name => "IkiWiki::bestlink", call => \&mybestlink);
$origsubs{'beautify_urlpath'}=\&IkiWiki::beautify_urlpath;
inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
$origsubs{'targetpage'}=\&IkiWiki::targetpage;
@@ -153,6 +151,10 @@ sub checkconfig () {
warn(gettext('po_link_to=negotiated requires usedirs to be enabled, falling back to po_link_to=default'));
$config{po_link_to}='default';
}
+ unless ($config{po_link_to} eq 'default') {
+ $origsubs{'bestlink'}=\&IkiWiki::bestlink;
+ inject(name => "IkiWiki::bestlink", call => \&mybestlink);
+ }
push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/;
@@ -543,13 +545,13 @@ sub formbuilder (@) {
# `----
# Implement po_link_to 'current' and 'negotiated' settings.
+# Not injected otherwise.
sub mybestlink ($$) {
my $page=shift;
my $link=shift;
my $res=$origsubs{'bestlink'}->(masterpage($page), $link);
if (length $res
- && ($config{po_link_to} eq "current" || $config{po_link_to} eq "negotiated")
&& istranslatable($res)
&& istranslation($page)) {
return $res . "." . lang($page);