summaryrefslogtreecommitdiff
path: root/perl/Git
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-12-27 08:11:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-27 08:11:40 (GMT)
commit1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac (patch)
tree943d4c5dd8f366e610f08ce92fcb5d76291d72f0 /perl/Git
parent95d0367b2e397080d37c4b82dbd2ba10ffa262dc (diff)
parenta948ebacbf0debd5129f4f528229183c97ff90b1 (diff)
downloadgit-1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac.zip
git-1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac.tar.gz
git-1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac.tar.bz2
Merge branch 'va/i18n-perl-scripts'
Porcelain scripts written in Perl are getting internationalized. * va/i18n-perl-scripts: i18n: difftool: mark warnings for translation i18n: send-email: mark composing message for translation i18n: send-email: mark string with interpolation for translation i18n: send-email: mark warnings and errors for translation i18n: send-email: mark strings for translation i18n: add--interactive: mark status words for translation i18n: add--interactive: remove %patch_modes entries i18n: add--interactive: mark edit_hunk_manually message for translation i18n: add--interactive: i18n of help_patch_cmd i18n: add--interactive: mark patch prompt for translation i18n: add--interactive: mark plural strings i18n: clean.c: match string with git-add--interactive.perl i18n: add--interactive: mark strings with interpolation for translation i18n: add--interactive: mark simple here-documents for translation i18n: add--interactive: mark strings for translation Git.pm: add subroutines for commenting lines
Diffstat (limited to 'perl/Git')
-rw-r--r--perl/Git/I18N.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index f889fd6..c41425c 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -13,7 +13,7 @@ BEGIN {
}
}
-our @EXPORT = qw(__);
+our @EXPORT = qw(__ __n N__);
our @EXPORT_OK = @EXPORT;
sub __bootstrap_locale_messages {
@@ -44,6 +44,7 @@ BEGIN
eval {
__bootstrap_locale_messages();
*__ = \&Locale::Messages::gettext;
+ *__n = \&Locale::Messages::ngettext;
1;
} or do {
# Tell test.pl that we couldn't load the gettext library.
@@ -51,7 +52,10 @@ BEGIN
# Just a fall-through no-op
*__ = sub ($) { $_[0] };
+ *__n = sub ($$$) { $_[2] == 1 ? $_[0] : $_[1] };
};
+
+ sub N__($) { return shift; }
}
1;
@@ -70,6 +74,9 @@ Git::I18N - Perl interface to Git's Gettext localizations
printf __("The following error occurred: %s\n"), $error;
+ printf __n("commited %d file\n", "commited %d files\n", $files), $files;
+
+
=head1 DESCRIPTION
Git's internal Perl interface to gettext via L<Locale::Messages>. If
@@ -87,6 +94,16 @@ it.
L<Locale::Messages>'s gettext function if all goes well, otherwise our
passthrough fallback function.
+=head2 __n($$$)
+
+L<Locale::Messages>'s ngettext function or passthrough fallback function.
+
+=head2 N__($)
+
+No-operation that only returns its argument. Use this if you want xgettext to
+extract the text to the pot template but do not want to trigger retrival of the
+translation at run time.
+
=head1 AUTHOR
E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>