summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-06 13:26:45 +0100
committerintrigeri <intrigeri@boum.org>2008-11-06 13:26:45 +0100
commit34afa2c07d2defcaf683cf8d7eb486517b4fc389 (patch)
tree59b88213f45e91d80f89b77079686a633b8cee28 /IkiWiki/Plugin
parentc96dd00480b8c0d18f74d42d3b6820f1cdd67240 (diff)
po: po_master_language and po_slave_languages are safe config settings
... and check their validity in checkconfig Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/po.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index bdf4b2c29..5acbcd4f8 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -61,7 +61,7 @@ sub getsetup () { #{{{
'name' => 'English'
},
description => "master language (non-PO files)",
- safe => 0,
+ safe => 1,
rebuild => 1,
},
po_slave_languages => {
@@ -72,7 +72,7 @@ sub getsetup () { #{{{
'de' => 'Deutsch'
},
description => "slave languages (PO files)",
- safe => 0,
+ safe => 1,
rebuild => 1,
},
po_translatable_pages => {
@@ -92,12 +92,21 @@ sub getsetup () { #{{{
},
} #}}}
+sub islanguagecode ($) { #{{{
+ my $code=shift;
+ return ($code =~ /^[a-z]{2}$/);
+} #}}}
+
sub checkconfig () { #{{{
foreach my $field (qw{po_master_language po_slave_languages}) {
if (! exists $config{$field} || ! defined $config{$field}) {
error(sprintf(gettext("Must specify %s"), $field));
}
}
+ map {
+ 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";