summaryrefslogtreecommitdiff
path: root/t/t0202
diff options
context:
space:
mode:
authorVasco Almeida <vascomalmeida@sapo.pt>2016-12-14 12:54:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-14 19:00:05 (GMT)
commitc4a85c3b8eef8c3b37f5103870e82894d9e5e7d0 (patch)
treefc2e7d5f464935c16a249a03990f5182936a28e1 /t/t0202
parent901707babc95950a6e6bd0fcea2070f63b704ef4 (diff)
downloadgit-c4a85c3b8eef8c3b37f5103870e82894d9e5e7d0.zip
git-c4a85c3b8eef8c3b37f5103870e82894d9e5e7d0.tar.gz
git-c4a85c3b8eef8c3b37f5103870e82894d9e5e7d0.tar.bz2
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-xt/t0202/test.pl11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/t0202/test.pl b/t/t0202/test.pl
index 2c10cb4..4101833 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