--- /dev/null
+Section:
+ Subsection:
+ -
+ - pref: SamplePref
+ choices:
+ on: Do
+ off: Do not do
+ - that thing
+ -
+ - pref: MultiplePref
+ multiple:
+ foo: Foo ツ
+ bar: Bar
+ baz: Baz
--- /dev/null
+[% USE raw %]
+[% PROCESS 'i18n.inc' %]
+[% t('hello ツ') | $raw %]
+[% tx('hello {name}', { name = 'Bob' }) | $raw %]
+[% tn('item', 'items', count) | $raw %]
+[% tnx('{count} item', '{count} items', count, { count = count }) | $raw %]
+[% tp('context', 'hello') | $raw %]
+[% tpx('context', 'hello {name}', { name = 'Bob' }) | $raw %]
+[% tnp('context', 'item', 'items', count) | $raw %]
+[% tnpx('context', '{count} item', '{count} items', count, { count = count }) | $raw %]
+
+[% # it also works on multiple lines
+ tnpx (
+ 'context',
+ '{count} item',
+ '{count} items',
+ count,
+ {
+ count = count,
+ }
+ ) | $raw
+%]
+
+[% # and t* calls can be nested
+ tx('status is {status}', {
+ status = active ? t('active') : t('inactive')
+ }) | $raw
+%]
+
+[%# but a TT comment won't get picked
+ t('not translatable')
+%]
+
+[% BLOCK %]
+ [% t('Inside block') | $raw %]
+[% END %]
--- /dev/null
+description:
+ - "Sample installer file"
+
+tables:
+ - table1:
+ translatable: [ column1, column2 ]
+ multiline: [ column2 ]
+ rows:
+ - column1: foo ツ
+ column2:
+ - bar
+ - baz
+ column3: qux
+ column4:
+ - quux
--- /dev/null
+#!/usr/bin/perl
+
+use Modern::Perl;
+
+use File::Slurp;
+use File::Temp qw(tempdir);
+use FindBin qw($Bin);
+use Locale::PO;
+use Test::More tests => 4;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+write_file("$tempdir/files", "$Bin/sample.yml");
+
+my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-installer "
+ . "-o $tempdir/Koha.pot -f $tempdir/files";
+
+system($xgettext_cmd);
+my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
+
+my @expected = (
+ { msgid => '"Sample installer file"' },
+ { msgid => '"bar"' },
+ { msgid => '"baz"' },
+ { msgid => '"foo ツ"' },
+);
+
+for (my $i = 0; $i < @expected; $i++) {
+ my $expected = $expected[$i]->{msgid};
+ my $expected_str = defined $expected ? $expected : 'not defined';
+ is($pot->[$i + 1]->msgid, $expected, "$i: msgid is $expected_str");
+}
--- /dev/null
+#!/usr/bin/perl
+
+use Modern::Perl;
+
+use File::Slurp;
+use File::Temp qw(tempdir);
+use FindBin qw($Bin);
+use Locale::PO;
+use Test::More tests => 16;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+write_file("$tempdir/files", "$Bin/sample.pref");
+
+my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-pref "
+ . "-o $tempdir/Koha.pot -f $tempdir/files";
+
+system($xgettext_cmd);
+my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
+
+my @expected = (
+ {
+ msgid => '"sample.pref"',
+ },
+ {
+ msgid => '"sample.pref Subsection"',
+ },
+ {
+ msgid => '"sample.pref#MultiplePref# Bar"',
+ },
+ {
+ msgid => '"sample.pref#MultiplePref# Baz"',
+ },
+ {
+ msgid => '"sample.pref#MultiplePref# Foo ツ"',
+ },
+ {
+ msgid => '"sample.pref#SamplePref# Do"',
+ },
+ {
+ msgid => '"sample.pref#SamplePref# Do not do"',
+ },
+ {
+ msgid => '"sample.pref#SamplePref# that thing"',
+ },
+);
+
+for (my $i = 0; $i < @expected; $i++) {
+ for my $key (qw(msgid msgctxt)) {
+ my $expected = $expected[$i]->{$key};
+ my $expected_str = defined $expected ? $expected : 'not defined';
+ is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
+ }
+}
--- /dev/null
+#!/usr/bin/perl
+
+use Modern::Perl;
+
+use File::Slurp;
+use File::Temp qw(tempdir);
+use FindBin qw($Bin);
+use Locale::PO;
+use Test::More tests => 36;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+write_file("$tempdir/files", "$Bin/sample.tt");
+
+my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-tt2 --from-code=UTF-8 "
+ . "-o $tempdir/Koha.pot -f $tempdir/files";
+
+system($xgettext_cmd);
+my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
+
+my @expected = (
+ {
+ msgid => '"hello ツ"',
+ },
+ {
+ msgid => '"hello {name}"',
+ },
+ {
+ msgid => '"item"',
+ msgid_plural => '"items"',
+ },
+ {
+ msgid => '"{count} item"',
+ msgid_plural => '"{count} items"',
+ },
+ {
+ msgid => '"hello"',
+ msgctxt => '"context"',
+ },
+ {
+ msgid => '"hello {name}"',
+ msgctxt => '"context"',
+ },
+ {
+ msgid => '"item"',
+ msgid_plural => '"items"',
+ msgctxt => '"context"',
+ },
+ {
+ msgid => '"{count} item"',
+ msgid_plural => '"{count} items"',
+ msgctxt => '"context"',
+ },
+ {
+ msgid => '"status is {status}"',
+ },
+ {
+ msgid => '"active"',
+ },
+ {
+ msgid => '"inactive"',
+ },
+ {
+ msgid => '"Inside block"',
+ },
+);
+
+for (my $i = 0; $i < @expected; $i++) {
+ for my $key (qw(msgid msgid_plural msgctxt)) {
+ my $expected = $expected[$i]->{$key};
+ my $expected_str = defined $expected ? $expected : 'not defined';
+ is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
+ }
+}
+++ /dev/null
-Section:
- Subsection:
- -
- - pref: SamplePref
- choices:
- on: Do
- off: Do not do
- - that thing
- -
- - pref: MultiplePref
- multiple:
- foo: Foo ツ
- bar: Bar
- baz: Baz
+++ /dev/null
-[% USE raw %]
-[% PROCESS 'i18n.inc' %]
-[% t('hello ツ') | $raw %]
-[% tx('hello {name}', { name = 'Bob' }) | $raw %]
-[% tn('item', 'items', count) | $raw %]
-[% tnx('{count} item', '{count} items', count, { count = count }) | $raw %]
-[% tp('context', 'hello') | $raw %]
-[% tpx('context', 'hello {name}', { name = 'Bob' }) | $raw %]
-[% tnp('context', 'item', 'items', count) | $raw %]
-[% tnpx('context', '{count} item', '{count} items', count, { count = count }) | $raw %]
-
-[% # it also works on multiple lines
- tnpx (
- 'context',
- '{count} item',
- '{count} items',
- count,
- {
- count = count,
- }
- ) | $raw
-%]
-
-[% # and t* calls can be nested
- tx('status is {status}', {
- status = active ? t('active') : t('inactive')
- }) | $raw
-%]
-
-[%# but a TT comment won't get picked
- t('not translatable')
-%]
-
-[% BLOCK %]
- [% t('Inside block') | $raw %]
-[% END %]
+++ /dev/null
-description:
- - "Sample installer file"
-
-tables:
- - table1:
- translatable: [ column1, column2 ]
- multiline: [ column2 ]
- rows:
- - column1: foo ツ
- column2:
- - bar
- - baz
- column3: qux
- column4:
- - quux
+++ /dev/null
-#!/usr/bin/perl
-
-use Modern::Perl;
-
-use File::Slurp;
-use File::Temp qw(tempdir);
-use FindBin qw($Bin);
-use Locale::PO;
-use Test::More tests => 4;
-
-my $tempdir = tempdir(CLEANUP => 1);
-
-write_file("$tempdir/files", "$Bin/sample.yml");
-
-my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-installer "
- . "-o $tempdir/Koha.pot -f $tempdir/files";
-
-system($xgettext_cmd);
-my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
-
-my @expected = (
- { msgid => '"Sample installer file"' },
- { msgid => '"bar"' },
- { msgid => '"baz"' },
- { msgid => '"foo ツ"' },
-);
-
-for (my $i = 0; $i < @expected; $i++) {
- my $expected = $expected[$i]->{msgid};
- my $expected_str = defined $expected ? $expected : 'not defined';
- is($pot->[$i + 1]->msgid, $expected, "$i: msgid is $expected_str");
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use Modern::Perl;
-
-use File::Slurp;
-use File::Temp qw(tempdir);
-use FindBin qw($Bin);
-use Locale::PO;
-use Test::More tests => 16;
-
-my $tempdir = tempdir(CLEANUP => 1);
-
-write_file("$tempdir/files", "$Bin/sample.pref");
-
-my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-pref "
- . "-o $tempdir/Koha.pot -f $tempdir/files";
-
-system($xgettext_cmd);
-my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
-
-my @expected = (
- {
- msgid => '"sample.pref"',
- },
- {
- msgid => '"sample.pref Subsection"',
- },
- {
- msgid => '"sample.pref#MultiplePref# Bar"',
- },
- {
- msgid => '"sample.pref#MultiplePref# Baz"',
- },
- {
- msgid => '"sample.pref#MultiplePref# Foo ツ"',
- },
- {
- msgid => '"sample.pref#SamplePref# Do"',
- },
- {
- msgid => '"sample.pref#SamplePref# Do not do"',
- },
- {
- msgid => '"sample.pref#SamplePref# that thing"',
- },
-);
-
-for (my $i = 0; $i < @expected; $i++) {
- for my $key (qw(msgid msgctxt)) {
- my $expected = $expected[$i]->{$key};
- my $expected_str = defined $expected ? $expected : 'not defined';
- is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
- }
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use Modern::Perl;
-
-use File::Slurp;
-use File::Temp qw(tempdir);
-use FindBin qw($Bin);
-use Locale::PO;
-use Test::More tests => 36;
-
-my $tempdir = tempdir(CLEANUP => 1);
-
-write_file("$tempdir/files", "$Bin/sample.tt");
-
-my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-tt2 --from-code=UTF-8 "
- . "-o $tempdir/Koha.pot -f $tempdir/files";
-
-system($xgettext_cmd);
-my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
-
-my @expected = (
- {
- msgid => '"hello ツ"',
- },
- {
- msgid => '"hello {name}"',
- },
- {
- msgid => '"item"',
- msgid_plural => '"items"',
- },
- {
- msgid => '"{count} item"',
- msgid_plural => '"{count} items"',
- },
- {
- msgid => '"hello"',
- msgctxt => '"context"',
- },
- {
- msgid => '"hello {name}"',
- msgctxt => '"context"',
- },
- {
- msgid => '"item"',
- msgid_plural => '"items"',
- msgctxt => '"context"',
- },
- {
- msgid => '"{count} item"',
- msgid_plural => '"{count} items"',
- msgctxt => '"context"',
- },
- {
- msgid => '"status is {status}"',
- },
- {
- msgid => '"active"',
- },
- {
- msgid => '"inactive"',
- },
- {
- msgid => '"Inside block"',
- },
-);
-
-for (my $i = 0; $i < @expected; $i++) {
- for my $key (qw(msgid msgid_plural msgctxt)) {
- my $expected = $expected[$i]->{$key};
- my $expected_str = defined $expected ? $expected : 'not defined';
- is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
- }
-}