8 our @EXPORT_OK = @EXPORT;
10 sub __bootstrap_locale_messages
{
11 our $TEXTDOMAIN = 'git';
12 our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR
} || '++LOCALEDIR++';
15 POSIX
->import(qw(setlocale));
16 # Non-core prerequisite module
17 require Locale
::Messages
;
18 Locale
::Messages
->import(qw(:locale_h :libintl_h));
20 setlocale
(LC_MESSAGES
(), '');
21 setlocale
(LC_CTYPE
(), '');
22 textdomain
($TEXTDOMAIN);
23 bindtextdomain
($TEXTDOMAIN => $TEXTDOMAINDIR);
30 # Used by our test script to see if it should test fallbacks or
32 our $__HAS_LIBRARY = 1;
36 __bootstrap_locale_messages
();
37 *__
= \
&Locale
::Messages
::gettext
;
40 # Tell test.pl that we couldn't load the gettext library.
41 $Git::I18N
::__HAS_LIBRARY
= 0;
43 # Just a fall-through no-op
44 *__
= sub ($) { $_[0] };
54 Git::I18N - Perl interface to Git's Gettext localizations
60 print __("Welcome to Git!\n");
62 printf __("The following error occured: %s\n"), $error;
66 Git's internal Perl interface to gettext via L<Locale::Messages>. If
67 L<Locale::Messages> can't be loaded (it's not a core module) we
68 provide stub passthrough fallbacks.
70 This is a distilled interface to gettext, see C<info '(gettext)Perl'>
71 for the full interface. This module implements only a small part of
78 L<Locale::Messages>'s gettext function if all goes well, otherwise our
79 passthrough fallback function.
83 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>
87 Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>