diff options
author | Vasco Almeida <vascomalmeida@sapo.pt> | 2016-12-14 15:54:29 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-14 22:00:05 +0300 |
commit | c4a85c3b8eef8c3b37f5103870e82894d9e5e7d0 (patch) | |
tree | fc2e7d5f464935c16a249a03990f5182936a28e1 /t/t0202 | |
parent | 901707babc95950a6e6bd0fcea2070f63b704ef4 (diff) |
i18n: add--interactive: mark plural strings
Mark plural strings for translation. Unfold each action case in one
entire sentence.
Pass new keyword for xgettext to extract.
Update test to include new subroutine __n() for plural strings handling.
Update documentation to include a description of the new __n()
subroutine.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0202')
-rwxr-xr-x | t/t0202/test.pl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/t/t0202/test.pl b/t/t0202/test.pl index 2c10cb4693..4101833a8e 100755 --- a/t/t0202/test.pl +++ b/t/t0202/test.pl @@ -4,7 +4,7 @@ use lib (split(/:/, $ENV{GITPERLLIB})); use strict; use warnings; use POSIX qw(:locale_h); -use Test::More tests => 8; +use Test::More tests => 11; use Git::I18N; my $has_gettext_library = $Git::I18N::__HAS_LIBRARY; @@ -31,6 +31,7 @@ is_deeply(\@Git::I18N::EXPORT, \@Git::I18N::EXPORT_OK, "sanity: Git::I18N export # more gettext wrapper functions. my %prototypes = (qw( __ $ + __n $$$ )); while (my ($sub, $proto) = each %prototypes) { is(prototype(\&{"Git::I18N::$sub"}), $proto, "sanity: $sub has a $proto prototype"); @@ -46,6 +47,14 @@ is_deeply(\@Git::I18N::EXPORT, \@Git::I18N::EXPORT_OK, "sanity: Git::I18N export my ($got, $expect) = (('TEST: A Perl test string') x 2); is(__($got), $expect, "Passing a string through __() in the C locale works"); + + my ($got_singular, $got_plural, $expect_singular, $expect_plural) = + (('TEST: 1 file', 'TEST: n files') x 2); + + is(__n($got_singular, $got_plural, 1), $expect_singular, + "Get singular string through __n() in C locale"); + is(__n($got_singular, $got_plural, 2), $expect_plural, + "Get plural string through __n() in C locale"); } # Test a basic message on different locales |