summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-06 13:47:09 +0100
committerintrigeri <intrigeri@boum.org>2008-11-06 13:47:09 +0100
commit769be3d48e5612a73232b868cbd6cd35ab3515df (patch)
treea7a59083b7bbce25e5e3ef1366ba4bc0f7940af6 /IkiWiki
parent419de149a6b4c1cf598f33f0c96a2a21104528ec (diff)
po: po_link_to is safe, and fallbacks to a working value if needed
warnings are displayed if it is set to an invalid or incompatible value (e.g. po_link_to=negotiated and disabled usedirs) Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm22
1 files changed, 15 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 3b92583a1..1ef332d83 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -87,7 +87,7 @@ sub getsetup () { #{{{
type => "string",
example => "current",
description => "internal linking behavior (default/current/negotiated)",
- safe => 0,
+ safe => 1,
rebuild => 1,
},
} #}}}
@@ -107,16 +107,24 @@ sub checkconfig () { #{{{
islanguagecode($_)
or error(sprintf(gettext("%s is not a valid language code"), $_));
} ($config{po_master_language}{code}, keys %{$config{po_slave_languages}});
- if (! exists $config{po_link_to} ||
- ! defined $config{po_link_to}) {
- $config{po_link_to}="default";
- }
if (! exists $config{po_translatable_pages} ||
! defined $config{po_translatable_pages}) {
$config{po_translatable_pages}="";
}
- if ($config{po_link_to} eq "negotiated" && ! $config{usedirs}) {
- error(gettext("po_link_to=negotiated requires usedirs to be set"));
+ if (! exists $config{po_link_to} ||
+ ! defined $config{po_link_to}) {
+ $config{po_link_to}='default';
+ }
+ elsif ($config{po_link_to} != 'default'
+ && $config{po_link_to} != 'current'
+ && $config{po_link_to} != 'negotiated') {
+ warn(sprintf(gettext('po_link_to=%s is not a valid setting, falling back to po_link_to=default'),
+ $config{po_link_to}));
+ $config{po_link_to}='default';
+ }
+ elsif ($config{po_link_to} eq "negotiated" && ! $config{usedirs}) {
+ warn(gettext('po_link_to=negotiated requires usedirs to be enabled, falling back to po_link_to=default'));
+ $config{po_link_to}='default';
}
push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/;
} #}}}