Fourth batch
[gitweb.git] / perl / Git / I18N.pm
index 617d8c2a17de00277e1ba133436d7597b3edd5ad..bfb4fb67a13f4530aae2d974e579b9ba45e20cdb 100644 (file)
@@ -13,12 +13,12 @@ BEGIN
        }
 }
 
-our @EXPORT = qw(__ __n);
+our @EXPORT = qw(__ __n N__);
 our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
        our $TEXTDOMAIN = 'git';
-       our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+       our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
        require POSIX;
        POSIX->import(qw(setlocale));
@@ -54,6 +54,8 @@ BEGIN
                *__ = sub ($) { $_[0] };
                *__n = sub ($$$) { $_[2] == 1 ? $_[0] : $_[1] };
        };
+
+       sub N__($) { return shift; }
 }
 
 1;
@@ -72,7 +74,8 @@ =head1 SYNOPSIS
 
        printf __("The following error occurred: %s\n"), $error;
 
-       printf __n("commited %d file\n", "commited %d files\n", $files), $files;
+       printf __n("committed %d file\n", "committed %d files\n", $files), $files;
+
 
 =head1 DESCRIPTION
 
@@ -95,6 +98,12 @@ =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>