summaryrefslogtreecommitdiff
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
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>
-rw-r--r--IkiWiki/Plugin/po.pm22
-rw-r--r--doc/plugins/po.mdwn11
2 files changed, 15 insertions, 18 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$/;
} #}}}
diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn
index ee6dbb097..93ece9fb9 100644
--- a/doc/plugins/po.mdwn
+++ b/doc/plugins/po.mdwn
@@ -255,17 +255,6 @@ does. This is actually a duplicate for
[[bugs/pagetitle_function_does_not_respect_meta_titles]], which might
be fixed by something like [[todo/using_meta_titles_for_parentlinks]].
-### websetup
-
-Which configuration settings are safe enough for websetup, apart of
-`po_master_language`, `po_slave_languages` and `po_translatable_pages`
-that have been checked already?
-
-> `po_link_to` w/o usedirs causes ikiwiki to error out. If it were
-> changed to fall back to a safe setting in this case rather than
-> error, it would be safe.
-> --[[Joey]]
-
### backlinks
`po_link_to = negotiated`: if a given translatable `sourcepage.mdwn`