6 =head2 translate-templates.t
8 This test verifies that all staff and OPAC template
9 files can be processed by the string extractor
10 without error; such errors usually indicate a
11 construct that the extractor cannot parse.
15 use Test::More tests => 2;
16 use File::Temp qw/tempdir/;
19 use Symbol qw(gensym);
21 my $po_dir = tempdir(CLEANUP => 1);
23 chdir "misc/translator"; # for now, tmpl_process3.pl works only if run from its directory
24 test_string_extraction("opac", "../../koha-tmpl/opac-tmpl/prog/en", $po_dir);
25 test_string_extraction("intranet", "../../koha-tmpl/intranet-tmpl/prog/en", $po_dir);
27 sub test_string_extraction {
29 my $template_dir = shift;
32 my $command = "./tmpl_process3.pl create -i $template_dir -s $po_dir/$module.po -r --pedantic-warnings";
34 open (NULL, ">", File::Spec->devnull);
35 print NULL "foo"; # avoid warning;
36 my $pid = open3(gensym, ">&NULL", \*PH, $command);
39 # ignore some noise on STDERR
40 next if /^\.* done\.$/;
41 next if /^\.* termin\?\.$/;
42 next if /^Warning: Can't determine original templates' charset/;
43 next if /^Warning: Charset Out defaulting to/;
44 next if /^Removing empty file /;
45 next if /^I UTF-8 O UTF-8 at /;
50 ok($#warnings == -1, "$module templates are translatable") or diag join("\n", @warnings, '');