use warnings;
use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
use Encode;
use Locale::Po4a::Chooser;
use Locale::Po4a::Po;
hook(type => "canremove", id => "po", call => \&canremove);
hook(type => "canrename", id => "po", call => \&canrename);
hook(type => "editcontent", id => "po", call => \&editcontent);
+ hook(type => "formbuilder_setup", id => "po", call => \&formbuilder_setup);
$origsubs{'bestlink'}=\&IkiWiki::bestlink;
inject(name => "IkiWiki::bestlink", call => \&mybestlink);
return $params{content};
}
+sub formbuilder_setup (@) {
+ my %params=@_;
+ my $form=$params{form};
+ my $q=$params{cgi};
+
+ return unless (defined $form->field("do") && $form->field("do") eq "create");
+
+ $form->tmpl_param(
+ message => sprintf(
+ gettext('**WARNING: this page must be written in %s**'),
+ $config{po_master_language}{name})
+ );
+}
+
# ,----
# | Injected functions
writefile(basename($infile), File::Spec->tmpdir, $content)
or return failure("failed to write $infile");
- my $res = (system("msgfmt", "--check", $infile) == 0);
+ my $res = (system("msgfmt", "--check", $infile, "-o", "/dev/null") == 0);
# Unlinking should happen automatically, thanks to File::Temp,
# but it does not work here, probably because of the way writefile()