4 use Test
::More tests
=> 35;
13 my $koha_i18n = Test::MockModule->new('Koha::I18N');
14 $koha_i18n->mock('_base_directory', sub { "$Bin/I18N/po" });
16 my $c4_languages = Test::MockModule->new('C4::Languages');
17 $c4_languages->mock('getlanguage', sub { 'xx-XX' });
19 # If you need to modify the MO file to add new tests
20 # 1) msgunfmt -o Koha.po t/Koha/I18N/po/xx_XX/LC_MESSAGES/Koha.mo
22 # 3) msgfmt -o t/Koha/I18N/po/xx_XX/LC_MESSAGES/Koha.mo Koha.po
24 [ __('test') => 'test ツ' ],
25 [ __x('Hello {name}', name => 'World') => 'Hello World ツ' ],
26 [ __n('Singular', 'Plural', 0) => 'Zero ツ' ],
27 [ __n('Singular', 'Plural', 1) => 'Singular ツ' ],
28 [ __n('Singular', 'Plural', 2) => 'Plural ツ' ],
29 [ __n('Singular', 'Plural', 3) => 'Plural ツ' ],
30 [ __nx('one item', '{count} items', 0, count => 0) => 'no item ツ' ],
31 [ __nx('one item', '{count} items', 1, count => 1) => 'one item ツ' ],
32 [ __nx('one item', '{count} items', 2, count => 2) => '2 items ツ' ],
33 [ __nx('one item', '{count} items', 3, count => 3) => '3 items ツ' ],
34 [ __xn('one item', '{count} items', 0, count => 0) => 'no item ツ' ],
35 [ __xn('one item', '{count} items', 1, count => 1) => 'one item ツ' ],
36 [ __xn('one item', '{count} items', 2, count => 2) => '2 items ツ' ],
37 [ __xn('one item', '{count} items', 3, count => 3) => '3 items ツ' ],
38 [ __p('biblio', 'title') => 'title (biblio) ツ' ],
39 [ __p('patron', 'title') => 'title (patron) ツ' ],
40 [ __px('biblio', 'Remove item {id}', id => 42) => 'Remove item 42 (biblio) ツ' ],
41 [ __px('list', 'Remove item {id}', id => 42) => 'Remove item 42 (list) ツ' ],
42 [ __np('ctxt1', 'singular', 'plural', 0) => 'zero (ctxt1) ツ' ],
43 [ __np('ctxt1', 'singular', 'plural', 1) => 'singular (ctxt1) ツ' ],
44 [ __np('ctxt1', 'singular', 'plural', 2) => 'plural (ctxt1) ツ' ],
45 [ __np('ctxt1', 'singular', 'plural', 3) => 'plural (ctxt1) ツ' ],
46 [ __np('ctxt2', 'singular', 'plural', 0) => 'zero (ctxt2) ツ' ],
47 [ __np('ctxt2', 'singular', 'plural', 1) => 'singular (ctxt2) ツ' ],
48 [ __np('ctxt2', 'singular', 'plural', 2) => 'plural (ctxt2) ツ' ],
49 [ __np('ctxt2', 'singular', 'plural', 3) => 'plural (ctxt2) ツ' ],
50 [ __npx('biblio', 'one item', '{count} items', 0, count => 0) => 'no item (biblio) ツ' ],
51 [ __npx('biblio', 'one item', '{count} items', 1, count => 1) => 'one item (biblio) ツ' ],
52 [ __npx('biblio', 'one item', '{count} items', 2, count => 2) => '2 items (biblio) ツ' ],
53 [ __npx('biblio', 'one item', '{count} items', 3, count => 3) => '3 items (biblio) ツ' ],
54 [ __npx('list', 'one item', '{count} items', 0, count => 0) => 'no item (list) ツ' ],
55 [ __npx('list', 'one item', '{count} items', 1, count => 1) => 'one item (list) ツ' ],
56 [ __npx('list', 'one item', '{count} items', 2, count => 2) => '2 items (list) ツ' ],
57 [ __npx('list', 'one item', '{count} items', 3, count => 3) => '3 items (list) ツ' ],
60 foreach my $test (@tests) {
61 is($test->[0], decode_utf8($test->[1]), $test->[1]);