8 *import = \&Exporter::import;
10 # Exporter 5.57 which supports this invocation was
11 # released with perl 5.8.3
12 Exporter->import('import');
17 our @EXPORT_OK = @EXPORT;
19 sub __bootstrap_locale_messages {
20 our $TEXTDOMAIN = 'git';
21 our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
24 POSIX->import(qw(setlocale));
25 # Non-core prerequisite module
26 require Locale::Messages;
27 Locale::Messages->import(qw(:locale_h :libintl_h));
29 setlocale(LC_MESSAGES(), '');
30 setlocale(LC_CTYPE(), '');
31 textdomain($TEXTDOMAIN);
32 bindtextdomain($TEXTDOMAIN => $TEXTDOMAINDIR);
39 # Used by our test script to see if it should test fallbacks or
41 our $__HAS_LIBRARY = 1;
45 __bootstrap_locale_messages();
46 *__ = \&Locale::Messages::gettext;
49 # Tell test.pl that we couldn't load the gettext library.
50 $Git::I18N::__HAS_LIBRARY = 0;
52 # Just a fall-through no-op
53 *__ = sub ($) { $_[0] };
63 Git::I18N - Perl interface to Git's Gettext localizations
69 print __("Welcome to Git!\n");
71 printf __("The following error occured: %s\n"), $error;
75 Git's internal Perl interface to gettext via L<Locale::Messages>. If
76 L<Locale::Messages> can't be loaded (it's not a core module) we
77 provide stub passthrough fallbacks.
79 This is a distilled interface to gettext, see C<info '(gettext)Perl'>
80 for the full interface. This module implements only a small part of
87 L<Locale::Messages>'s gettext function if all goes well, otherwise our
88 passthrough fallback function.
92 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>
96 Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>