6 use File
::Temp
qw(tempdir);
9 use Test::More tests => 36;
11 my $tempdir = tempdir(CLEANUP => 1);
13 write_file("$tempdir/files", "$Bin/sample.tt");
15 my $xgettext_cmd = "$Bin/../../../../misc/translator/xgettext-tt2 --from-code=UTF-8 "
16 . "-o $tempdir/Koha.pot -f $tempdir/files";
18 system($xgettext_cmd);
19 my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
26 msgid => '"hello {name}"',
30 msgid_plural => '"items"',
33 msgid => '"{count} item"',
34 msgid_plural => '"{count} items"',
38 msgctxt => '"context"',
41 msgid => '"hello {name}"',
42 msgctxt => '"context"',
46 msgid_plural => '"items"',
47 msgctxt => '"context"',
50 msgid => '"{count} item"',
51 msgid_plural => '"{count} items"',
52 msgctxt => '"context"',
55 msgid => '"status is {status}"',
61 msgid => '"inactive"',
64 msgid => '"Inside block"',
68 for (my $i = 0; $i < @expected; $i++) {
69 for my $key (qw(msgid msgid_plural msgctxt)) {
70 my $expected = $expected[$i]->{$key};
71 my $expected_str = defined $expected ?
$expected : 'not defined';
72 is
($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");