summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c96dd00)
... and check their validity in checkconfig
Signed-off-by: intrigeri <intrigeri@boum.org>
'name' => 'English'
},
description => "master language (non-PO files)",
'name' => 'English'
},
description => "master language (non-PO files)",
rebuild => 1,
},
po_slave_languages => {
rebuild => 1,
},
po_slave_languages => {
'de' => 'Deutsch'
},
description => "slave languages (PO files)",
'de' => 'Deutsch'
},
description => "slave languages (PO files)",
rebuild => 1,
},
po_translatable_pages => {
rebuild => 1,
},
po_translatable_pages => {
+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));
}
}
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";
if (! exists $config{po_link_to} ||
! defined $config{po_link_to}) {
$config{po_link_to}="default";
-Which configuration settings are safe enough for websetup?
+Which configuration settings are safe enough for websetup, apart of
+`po_master_language` and `po_slave_languages` that already have
+been checked?
-> I see no problems with `po_master_language` and `po_slave_languages`
-> (assuming websetup handles the hashes correctly). Would not hurt to check
-> that the values of these are legal language codes, in `checkconfig`.
> `po_translatable_pages` seems entirely safe. `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.
> `po_translatable_pages` seems entirely safe. `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.