summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorLibravatar Vasco Almeida <vascomalmeida@sapo.pt>2016-12-14 11:54:30 -0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-12-14 11:00:05 -0800
commit0539d5e6d535760a99694ff5d5592e46ed929d15 (patch)
treef2f2dc021af40a4baa77333ae92472dfd10834d3 /perl
parenti18n: add--interactive: mark plural strings (diff)
downloadtgif-0539d5e6d535760a99694ff5d5592e46ed929d15.tar.xz
i18n: add--interactive: mark patch prompt for translation
Mark prompt message assembled in place for translation, unfolding each use case for each entry in the %patch_modes hash table. Previously, this script relied on whether $patch_mode was set to run the command patch_update_cmd() or show status and loop the main loop. Now, it uses $cmd to indicate we must run patch_update_cmd() and $patch_mode is used to tell which flavor of the %patch_modes are we on. This is introduced in order to be able to mark and unfold the message prompt knowing in which context we are. The tracking of context was done previously by point %patch_mode_flavour hash table to the correct entry of %patch_modes, focusing only on value of %patch_modes. Now, we are also interested in the key ('staged', 'stash', 'checkout_head', ...). Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl')
-rw-r--r--perl/Git/I18N.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 617d8c2a17..c41425c8d0 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -13,7 +13,7 @@ BEGIN {
}
}
-our @EXPORT = qw(__ __n);
+our @EXPORT = qw(__ __n N__);
our @EXPORT_OK = @EXPORT;
sub __bootstrap_locale_messages {
@@ -54,6 +54,8 @@ BEGIN
*__ = sub ($) { $_[0] };
*__n = sub ($$$) { $_[2] == 1 ? $_[0] : $_[1] };
};
+
+ sub N__($) { return shift; }
}
1;
@@ -74,6 +76,7 @@ Git::I18N - Perl interface to Git's Gettext localizations
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
@@ -95,6 +98,12 @@ passthrough fallback function.
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>