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
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user