code:
$Id: Credits,v 1.1 2009-11-01 18:59:59 pertusus Exp $

These people have helped in the development of libintl-perl:

- Imperia (http://www.imperia.net/) has contributed this part of the
  Enterprise Content Management System Imperia to the Perl community
  as free software.

- Joshua Miller <unrtst@cpan.com> has extended libintl-perl to provide
  the important context-sensitive functions (pgettext() and friends).

- Christian Lackas <delta@lackas.net> has given various hints on
  performance optimizations

- Ingrid Gräfen <ingrid.graefen@imperia.net> has fixed a major performance
  penalty on systems without POSIX::LC_MESSAGES, and she has extensively
  tested the Perl backend for GNU xgettext under cygwin

- Norma Karl <bcrazy@gmx.de> has thoroughly revised the documentation for
  the Perl backend to GNU xgettext, and she deserves a credit anyway

- Bruno Haible for libiconv which was the base for many conversions and
  for integrating my Perl backend into GNU gettext

Other people have helped by sending in improvements, suggestions and
bug reports:

- DH <crazyinsomniac@yahoo.com>
- Jo-Even Skarstein <joska@nvg.org>
- Gerhard Stoll <gerhard_stoll@gmx.de>
- Marc Brockschmidt <marc@marcbrockschmidt.de>
- Laurent Bonnaud <Laurent.Bonnaud@inpg.fr>
- Jan Kratochvil <lace@jankratochvil.net>
- Светослав Агафонкин <slavi.agafonkin@imperia.net>
- Michael Bell <michael.bell@cms.hu-berlin.de>
- David Cantrell <dcantrell@cpan.org>

Please inform me if I have forgotten your contribution.

Guido Flohr

repo_name: mthl/texinfo

license: mit


code:
$Id: FAQ,v 1.1 2009-11-01 18:59:59 pertusus Exp $

The FAQ has been podified, see "perldoc Locale::libintlFAQ".  If you
haven't installed libintl-perl and read this file in the source distribution,
either try "perldoc lib/Locale/libintlFAQ.pod", or point your favorite
web browser to
http://search.cpan.org/~guido/libintl-perl/lib/Locale/libintlFAQ.pod.


code:
COPYING.LESSER			Lesser GNU Public License
ChangeLog			Detailed list of changes
FAQ				Frequently asked questions
MANIFEST			This list of files
META.yml			Generated
Makefile.PL			Makefile generator
MyInstall.pm			Workaround file
NEWS				Latest Changes
ReleaseNotes			Same as NEWS
README				Read it
README-oldversions		Where are old versions of this module?
README.solaris			Build libintl-perl on Solaris platforms
README.win32			Build libintl-perl on MS-DOS platforms
REFERENCES			Who uses libintl-perl?
THANKS				Contributors
Credits				Same as THANKS
TODO				Missing
gettext_xs/Makefile.PL		Makefile generator
gettext_xs/gettext_xs.pm	XS loader
gettext_xs/gettext_xs.xs	XS binding
lib/Locale/Messages.pm		Gettext Like Message Retrieval
lib/Locale/Recode.pm		Object−Oriented Portable Charset Conversion
lib/Locale/Recode/_Aliases.pm
lib/Locale/Recode/_Conversions.pm
lib/Locale/RecodeData.pm
lib/Locale/RecodeData/ASMO_449.pm
lib/Locale/RecodeData/ATARI_ST.pm
lib/Locale/RecodeData/ATARI_ST_EURO.pm
lib/Locale/RecodeData/CP10007.pm
lib/Locale/RecodeData/CP1250.pm
lib/Locale/RecodeData/CP1251.pm
lib/Locale/RecodeData/CP1252.pm
lib/Locale/RecodeData/CP1253.pm
lib/Locale/RecodeData/CP1254.pm
lib/Locale/RecodeData/CP1256.pm
lib/Locale/RecodeData/CP1257.pm
lib/Locale/RecodeData/CSN_369103.pm
lib/Locale/RecodeData/CWI.pm
lib/Locale/RecodeData/DEC_MCS.pm
lib/Locale/RecodeData/EBCDIC_AT_DE.pm
lib/Locale/RecodeData/EBCDIC_AT_DE_A.pm
lib/Locale/RecodeData/EBCDIC_CA_FR.pm
lib/Locale/RecodeData/EBCDIC_DK_NO.pm
lib/Locale/RecodeData/EBCDIC_DK_NO_A.pm
lib/Locale/RecodeData/EBCDIC_ES.pm
lib/Locale/RecodeData/EBCDIC_ES_A.pm
lib/Locale/RecodeData/EBCDIC_ES_S.pm
lib/Locale/RecodeData/EBCDIC_FI_SE.pm
lib/Locale/RecodeData/EBCDIC_FI_SE_A.pm
lib/Locale/RecodeData/EBCDIC_FR.pm
lib/Locale/RecodeData/EBCDIC_IS_FRISS.pm
lib/Locale/RecodeData/EBCDIC_IT.pm
lib/Locale/RecodeData/EBCDIC_PT.pm
lib/Locale/RecodeData/EBCDIC_UK.pm
lib/Locale/RecodeData/EBCDIC_US.pm
lib/Locale/RecodeData/ECMA_CYRILLIC.pm
lib/Locale/RecodeData/GEORGIAN_ACADEMY.pm
lib/Locale/RecodeData/GEORGIAN_PS.pm
lib/Locale/RecodeData/GOST_19768_74.pm
lib/Locale/RecodeData/GREEK7.pm
lib/Locale/RecodeData/GREEK7_OLD.pm
lib/Locale/RecodeData/GREEK_CCITT.pm
lib/Locale/RecodeData/HP_ROMAN8.pm
lib/Locale/RecodeData/IBM037.pm
lib/Locale/RecodeData/IBM038.pm
lib/Locale/RecodeData/IBM1004.pm
lib/Locale/RecodeData/IBM1026.pm
lib/Locale/RecodeData/IBM1047.pm
lib/Locale/RecodeData/IBM256.pm
lib/Locale/RecodeData/IBM273.pm
lib/Locale/RecodeData/IBM274.pm
lib/Locale/RecodeData/IBM275.pm
lib/Locale/RecodeData/IBM277.pm
lib/Locale/RecodeData/IBM278.pm
lib/Locale/RecodeData/IBM280.pm
lib/Locale/RecodeData/IBM281.pm
lib/Locale/RecodeData/IBM284.pm
lib/Locale/RecodeData/IBM285.pm
lib/Locale/RecodeData/IBM290.pm
lib/Locale/RecodeData/IBM297.pm
lib/Locale/RecodeData/IBM420.pm
lib/Locale/RecodeData/IBM423.pm
lib/Locale/RecodeData/IBM424.pm
lib/Locale/RecodeData/IBM437.pm
lib/Locale/RecodeData/IBM500.pm
lib/Locale/RecodeData/IBM850.pm
lib/Locale/RecodeData/IBM851.pm
lib/Locale/RecodeData/IBM852.pm
lib/Locale/RecodeData/IBM855.pm
lib/Locale/RecodeData/IBM857.pm
lib/Locale/RecodeData/IBM860.pm
lib/Locale/RecodeData/IBM861.pm
lib/Locale/RecodeData/IBM862.pm
lib/Locale/RecodeData/IBM863.pm
lib/Locale/RecodeData/IBM864.pm
lib/Locale/RecodeData/IBM865.pm
lib/Locale/RecodeData/IBM866.pm
lib/Locale/RecodeData/IBM868.pm
lib/Locale/RecodeData/IBM869.pm
lib/Locale/RecodeData/IBM870.pm
lib/Locale/RecodeData/IBM871.pm
lib/Locale/RecodeData/IBM874.pm
lib/Locale/RecodeData/IBM875.pm
lib/Locale/RecodeData/IBM880.pm
lib/Locale/RecodeData/IBM891.pm
lib/Locale/RecodeData/IBM903.pm
lib/Locale/RecodeData/IBM904.pm
lib/Locale/RecodeData/IBM905.pm
lib/Locale/RecodeData/IBM918.pm
lib/Locale/RecodeData/IEC_P27_1.pm
lib/Locale/RecodeData/INIS.pm
lib/Locale/RecodeData/INIS_8.pm
lib/Locale/RecodeData/INIS_CYRILLIC.pm
lib/Locale/RecodeData/ISO_10367_BOX.pm
lib/Locale/RecodeData/ISO_2033_1983.pm
lib/Locale/RecodeData/ISO_5427.pm
lib/Locale/RecodeData/ISO_5427_EXT.pm
lib/Locale/RecodeData/ISO_5428.pm
lib/Locale/RecodeData/ISO_8859_1.pm
lib/Locale/RecodeData/ISO_8859_10.pm
lib/Locale/RecodeData/ISO_8859_11.pm
lib/Locale/RecodeData/ISO_8859_13.pm
lib/Locale/RecodeData/ISO_8859_14.pm
lib/Locale/RecodeData/ISO_8859_15.pm
lib/Locale/RecodeData/ISO_8859_16.pm
lib/Locale/RecodeData/ISO_8859_2.pm
lib/Locale/RecodeData/ISO_8859_3.pm
lib/Locale/RecodeData/ISO_8859_4.pm
lib/Locale/RecodeData/ISO_8859_5.pm
lib/Locale/RecodeData/ISO_8859_6.pm
lib/Locale/RecodeData/ISO_8859_7.pm
lib/Locale/RecodeData/ISO_8859_8.pm
lib/Locale/RecodeData/ISO_8859_9.pm
lib/Locale/RecodeData/KOI8_R.pm
lib/Locale/RecodeData/KOI8_RU.pm
lib/Locale/RecodeData/KOI8_T.pm
lib/Locale/RecodeData/KOI8_U.pm
lib/Locale/RecodeData/KOI_8.pm
lib/Locale/RecodeData/LATIN_GREEK.pm
lib/Locale/RecodeData/LATIN_GREEK_1.pm
lib/Locale/RecodeData/MACARABIC.pm
lib/Locale/RecodeData/MACCROATIAN.pm
lib/Locale/RecodeData/MACCYRILLIC.pm
lib/Locale/RecodeData/MACGREEK.pm
lib/Locale/RecodeData/MACHEBREW.pm
lib/Locale/RecodeData/MACICELAND.pm
lib/Locale/RecodeData/MACINTOSH.pm
lib/Locale/RecodeData/MACROMANIA.pm
lib/Locale/RecodeData/MACTHAI.pm
lib/Locale/RecodeData/MACTURKISH.pm
lib/Locale/RecodeData/MACUKRAINE.pm
lib/Locale/RecodeData/MAC_IS.pm
lib/Locale/RecodeData/MAC_SAMI.pm
lib/Locale/RecodeData/MAC_UK.pm
lib/Locale/RecodeData/NATS_DANO.pm
lib/Locale/RecodeData/NATS_SEFI.pm
lib/Locale/RecodeData/NEXTSTEP.pm
lib/Locale/RecodeData/SAMI_WS2.pm
lib/Locale/RecodeData/TIS_620.pm
lib/Locale/RecodeData/US_ASCII.pm
lib/Locale/RecodeData/UTF_8.pm
lib/Locale/RecodeData/VISCII.pm
lib/Locale/RecodeData/_Encode.pm
lib/Locale/TextDomain.pm
lib/Locale/Util.pm                       Attention! Alpha code!
lib/Locale/gettext_pp.pm
lib/Locale/gettext_xs.pod
lib/Locale/libintlFAQ.pod
sample/README
sample/simplecal/MANIFEST
sample/simplecal/Makefile.PL
sample/simplecal/README-NLS
sample/simplecal/TRANSLATIONS
sample/simplecal/bin/simplecal.pl
sample/simplecal/lib/LocaleData/ar/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/ar_SA/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/de/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/de_AT/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/fr/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/ga/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/it/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/nl/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/pt/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/pt_BR/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/LocaleData/ru/LC_MESSAGES/org.imperia.simplecal.mo
sample/simplecal/lib/SimpleCal.pm
sample/simplecal/po/Makefile
sample/simplecal/po/PACKAGE
sample/simplecal/po/POTFILES.in
sample/simplecal/po/ar.po
sample/simplecal/po/ar_SA.po
sample/simplecal/po/de.po
sample/simplecal/po/de_AT.po
sample/simplecal/po/fr.po
sample/simplecal/po/ga.po
sample/simplecal/po/it.po
sample/simplecal/po/nl.po
sample/simplecal/po/org.imperia.simplecal.pot
sample/simplecal/po/pt.po
sample/simplecal/po/pt_BR.po
sample/simplecal/po/ru.po
test.pl
tests/00gettext.t
tests/00recode.t
tests/01trivial.t
tests/02asmo_449.t
tests/02atari-st-euro.t
tests/02atari-st.t
tests/02cp10007.t
tests/02cp1250.t
tests/02cp1251.t
tests/02cp1252.t
tests/02cp1253.t
tests/02cp1254.t
tests/02cp1256.t
tests/02cp1257.t
tests/02csn_369103.t
tests/02cwi.t
tests/02dec-mcs.t
tests/02ebcdic-at-de-a.t
tests/02ebcdic-at-de.t
tests/02ebcdic-ca-fr.t
tests/02ebcdic-dk-no-a.t
tests/02ebcdic-dk-no.t
tests/02ebcdic-es-a.t
tests/02ebcdic-es-s.t
tests/02ebcdic-es.t
tests/02ebcdic-fi-se-a.t
tests/02ebcdic-fi-se.t
tests/02ebcdic-fr.t
tests/02ebcdic-is-friss.t
tests/02ebcdic-it.t
tests/02ebcdic-pt.t
tests/02ebcdic-uk.t
tests/02ebcdic-us.t
tests/02ecma-cyrillic.t
tests/02georgian-academy.t
tests/02georgian-ps.t
tests/02gost_19768-74.t
tests/02greek-ccitt.t
tests/02greek7-old.t
tests/02greek7.t
tests/02hp-roman8.t
tests/02ibm037.t
tests/02ibm038.t
tests/02ibm1004.t
tests/02ibm1026.t
tests/02ibm1047.t
tests/02ibm256.t
tests/02ibm273.t
tests/02ibm274.t
tests/02ibm275.t
tests/02ibm277.t
tests/02ibm278.t
tests/02ibm280.t
tests/02ibm281.t
tests/02ibm284.t
tests/02ibm285.t
tests/02ibm290.t
tests/02ibm297.t
tests/02ibm420.t
tests/02ibm423.t
tests/02ibm424.t
tests/02ibm437.t
tests/02ibm500.t
tests/02ibm850.t
tests/02ibm851.t
tests/02ibm852.t
tests/02ibm855.t
tests/02ibm857.t
tests/02ibm860.t
tests/02ibm861.t
tests/02ibm862.t
tests/02ibm863.t
tests/02ibm864.t
tests/02ibm865.t
tests/02ibm866.t
tests/02ibm868.t
tests/02ibm869.t
tests/02ibm870.t
tests/02ibm871.t
tests/02ibm874.t
tests/02ibm875.t
tests/02ibm880.t
tests/02ibm891.t
tests/02ibm903.t
tests/02ibm904.t
tests/02ibm905.t
tests/02ibm918.t
tests/02iec_p27-1.t
tests/02inis-8.t
tests/02inis-cyrillic.t
tests/02inis.t
tests/02iso-8859-1.t
tests/02iso-8859-10.t
tests/02iso-8859-11.t
tests/02iso-8859-13.t
tests/02iso-8859-14.t
tests/02iso-8859-15.t
tests/02iso-8859-16.t
tests/02iso-8859-2.t
tests/02iso-8859-3.t
tests/02iso-8859-4.t
tests/02iso-8859-5.t
tests/02iso-8859-6.t
tests/02iso-8859-7.t
tests/02iso-8859-8.t
tests/02iso-8859-9.t
tests/02iso_10367-box.t
tests/02iso_2033-1983.t
tests/02iso_5427-ext.t
tests/02iso_5427.t
tests/02iso_5428.t
tests/02koi-8.t
tests/02koi8-r.t
tests/02koi8-ru.t
tests/02koi8-t.t
tests/02koi8-u.t
tests/02latin-greek-1.t
tests/02latin-greek.t
tests/02mac-is.t
tests/02mac-sami.t
tests/02mac-uk.t
tests/02macarabic.t
tests/02maccroatian.t
tests/02maccyrillic.t
tests/02macgreek.t
tests/02machebrew.t
tests/02maciceland.t
tests/02macintosh.t
tests/02macromania.t
tests/02macthai.t
tests/02macturkish.t
tests/02macukraine.t
tests/02nats-dano.t
tests/02nats-sefi.t
tests/02nextstep.t
tests/02sami-ws2.t
tests/02tis-620.t
tests/02us-ascii.t
tests/02utf-8.t
tests/02viscii.t
tests/03_tester_david_pp.t
tests/03_tester_david_xs.t
tests/03bind_textdomain_codeset_pp.t
tests/03bind_textdomain_codeset_xs.t
tests/03bind_textdomain_filter_pp.t
tests/03bind_textdomain_filter_xs.t
tests/03bindtextdomain_pp.t
tests/03bindtextdomain_xs.t
tests/03dcgettext_pp.t
tests/03dcgettext_xs.t
tests/03dcngettext_pp.t
tests/03dcngettext_xs.t
tests/03dcnpgettext_pp.t
tests/03dcnpgettext_xs.t
tests/03dcpgettext_pp.t
tests/03dcpgettext_xs.t
tests/03dgettext_pp.t
tests/03dgettext_xs.t
tests/03dngettext_pp.t
tests/03dngettext_xs.t
tests/03dnpgettext_pp.t
tests/03dnpgettext_xs.t
tests/03dpgettext_pp.t
tests/03dpgettext_xs.t
tests/03gettext_pp.t
tests/03gettext_xs.t
tests/03language_pp.t
tests/03ngettext_pp.t
tests/03ngettext_xs.t
tests/03npgettext_pp.t
tests/03npgettext_xs.t
tests/03pgettext_pp.t
tests/03pgettext_xs.t
tests/03textdomain_pp.t
tests/03textdomain_xs.t
tests/04find_domain_bug.t
tests/04scalar_noop.t
tests/05parse_accept.t
tests/LocaleData/de/LC_MESSAGES/additional.mo
tests/LocaleData/de/LC_MESSAGES/existing.mo
tests/LocaleData/de_AT/LC_MESSAGES/additional.mo
tests/LocaleData/de_AT/LC_MESSAGES/existing.mo
tests/po/Makefile
tests/po/additional.de.po
tests/po/additional.de_AT.po
tests/po/existing.de.po
tests/po/existing.de_AT.po
META.yml                                Module meta-data (added by MakeMaker)


code:
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
name:         libintl-perl
version:      1.20
version_from: lib/Locale/Messages.pm
installdirs:  site
requires:
    File::Spec:                    0

distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.30


code:
#! /usr/local/bin/perl -w

# vim: tabstop=4
# $Id: Makefile.PL,v 1.1 2009-11-01 18:59:59 pertusus Exp $

# Makefile generator for libintl-perl.
# Copyright (C) 2002-2009 Guido Flohr <guido@imperia.net>,
# all rights reserved.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.use ExtUtils::MakeMaker;

use 5.004;
use ExtUtils::MakeMaker;

# Make standard channels unbuffered.
select STDERR; $| = 1;
select STDOUT; $| = 1;

# Now try to compile and link a simple test program that uses all
# gettext facilities we need.  Failure of the test is not fatal
# since the pure Perl implementation will provide the same functionality.
# However, any help on making this test more portable would be
# highly appreciated!

use Config;

my $c_code = <<'EOF';
/* The following code only compiles if the interface to gettext is
   complete.  */

#include <libintl.h>
/* Handle the case that we link against GNU libintl but include a non
 * GNU libintl.h.  */
#ifndef __USE_GNU_GETTEXT
# error "<libintl.h> is not GNU gettext.  Maybe you have to adjust your include path."
#endif

#include <locale.h>

int
main (argc, argv)
	int argc;
    char* argv[];
{
	/* FIXME: The gettext runtime libraries provided by Solaris 8 and 9
       are not sufficient.  Those of Solaris 10 *may* work.  To play
       safe, we currently only compile the XS version for GNU gettext
       and use some undocumented features, to test for that.  Thanks
       to Bruno Haible for the hint.  */
	extern int _nl_msg_cat_cntr;
#if 0
        /* This seems to be defined in the GNU libc only, not in standalone
         * GNU gettext.  */
        extern int* _nl_domain_bindings;
#endif

	textdomain ("dummy");
	bindtextdomain ("dummy", ".");
	bind_textdomain_codeset ("dummy", "us-ascii");

	gettext ("msgid");
    	dgettext ("dummy", "msgid");
    	dcgettext ("dummy", "msgid", LC_MESSAGES);
	ngettext ("msgid", "msgid_plural",
#if 0
		  _nl_msg_cat_cntr + *_nl_domain_bindings);
#else
                  _nl_msg_cat_cntr);
#endif
	dngettext ("dummy", "msgid", "msgid_plural", 1);
	dcngettext ("dummy", "msgid", "msgid_plural", 1, LC_MESSAGES);

    	return 0;
}
EOF

my $cc = $Config{cc};

print STDERR "Checking whether we can compile the XS version ... ";
local *HANDLE;
open HANDLE, ">gettest.c" or die "cannot create file 'gettest.c': $!\n";
print HANDLE $c_code;
close HANDLE or die "cannot close file 'gettest.c': $!\n";

my @cmd = $cc;
push @cmd, $Config{ccflags};
push @cmd, $Config{ldflags};
push @cmd, $Config{perllibs};
push @cmd, "-o", "gettest.exe", "gettest.c";

my $cmd = join ' ', @cmd;

# Temporarily redirect stdout and stderr.
open OLDOUT, ">&STDOUT" or die "cannot dup STDOUT: $!";
open OLDERR, ">&STDERR" or die "cannot dup STDERR: $!";
open STDOUT, ">config.log" or die "cannot redirect STDOUT: $!";
open STDERR, ">&STDOUT" or die "cannot dup STDOUT: $!";
select STDERR; $| = 1;
select STDOUT; $| = 1;

print "$cmd\n";
my $result = system $cmd;
unless ($result == 0) {
	$cmd .= " -lintl";
	print "$cmd\n";
	$result = system $cmd;
}
unless ($result == 0) {
	$cmd .= " -liconv";
	print "$cmd\n";
	$result = system $cmd;
}

# Restore standard file descriptors.
close STDOUT; #or die "cannot close STDOUT: $!";
close STDERR; #or die "cannot close STDERR: $!";
open STDOUT, ">&OLDOUT" or die "cannot dup \$oldout: $!";
open STDERR, ">&OLDERR" or die "cannot dup OLDERR: $!";
close OLDOUT; close OLDERR; # Shut up warnings.

unless ($result == 0) {
	print STDERR <<EOF;
no
=> Cannot build the XS version of libintl-perl (see 'config.log' for
=> details).  This is harmless!
EOF
} else {
	print STDERR <<EOF;
ok
=> Building the XS version of libintl-perl.
EOF
}
unlink "gettest.c", "gettest.exe";

package MY;

# FIXME: This is really a hack! Problem: Depending on the build system,
# we may or may not build and install the XS version.  If the XS version
# is being built, the directory blib/arch will be populated, if it is
# not being built, blib/arch will be empty.  Unfortunately, if blib/arch
# is not empty, *all* library files will be installed in the architecture
# dependent locations, if it is empty, they will be installed in the
# architecture independent tree.
#
# Unfortunately, ExtUtils::MakeMaker does not take care of uninstalling
# files from previous installations.  Consequently, we cannot determine
# which version of the library will be loaded, since this depends on the
# current value of @INC.
#
# The solution does not really make me happy.  The Makefile will be patched,
# so that instead of ExtUtils::Install a custom module MyInstall.pm will
# be used.  This custom module overwrites the subroutine that detects
# whether a directory is empty in ExtUtils::Install, and will lie if that
# directory happens to be "blib/arch".  This little hack effectively disables
# the annoying behavior of ExtUtils::Install (and I sincerely hope that
# this is portable).
sub libscan
{
	my ($self, $file) = @_;

	return if 'MyInstall.pm' eq $file;

	$self->SUPER::libscan ($file);
}

sub tools_other
{
	my $self = shift;

	my $fragment = $self->SUPER::tools_other (@_);

	$fragment =~ s/^MOD_INSTALL\s*=\s*(.*?)-MExtUtils::Install
		/MOD_INSTALL =$1-MMyInstall/msx;

	return $fragment;
}

package main;

my $name = $0;
$name =~ s,Makefile\.PL$,xs_disabled,;
local *HANDLE;
open HANDLE, ">$name" or die "cannot open '$name' for writing: $!";
print HANDLE $result;
close HANDLE or die "cannot close '$name': $!";

WriteMakefile (
    NAME		    => 'libintl-perl',
	VERSION_FROM	=> 'lib/Locale/Messages.pm',
    ($] >= 5.005 ?
		(ABSTRACT	=> 'High-Level Interface to Uniforum Message Translation',
	 	 AUTHOR		=> 'Guido Flohr <guido@imperia.net>',
		 ) : (),
	),
	PREREQ_PM		=> { File::Spec => 0 },
	PL_FILES        => {},
	DIR		=> [$result == 0 ? ('gettext_xs') : ()],
	clean			=> { FILES => 'xs_disabled build_xs' }
	# If you want to build the XS version although the automatic detection
	# suggests not to build it, uncomment the following line.
	#DIR => [ ('gettext_xs') ],,
);

sub MY::postamble {
        '
all :: Credits ReleaseNotes

# Make search.cpan.org happy but still follow GNU standards:
# # (Thanks to Graham Barr for the hint)
Credits: THANKS
	cat THANKS >$@

ReleaseNotes: NEWS
	cat NEWS >$@
'
}

__END__

Local Variables:
mode: perl
perl-indent-level: 4
perl-continued-statement-offset: 4
perl-continued-brace-offset: 0
perl-brace-offset: -4
perl-brace-imaginary-offset: 0
perl-label-offset: -4
cperl-indent-level: 4
cperl-continued-statement-offset: 2
tab-width: 4
End:


code:
package MyInstall;

use ExtUtils::Install;
use File::Find;

use vars qw (@ISA @EXPORT @EXPORT_OK);

@ISA = @ExtUtils::Install::ISA;
@EXPORT = @ExtUtils::Install::EXPORT;
@EXPORT_OK = @ExtUtils::Install::EXPORT_OK;

sub ExtUtils::Install::directory_not_empty ($) {
	my($dir) = @_;

	return 0 if $dir eq 'blib/arch';

	my $files = 0;
  	find(sub {
        	return if $_ eq ".exists";
           	if (-f) {
             		$File::Find::prune++;
             		$files = 1;
           	}
       	}, $dir);
  	return $files;
}

sub AUTOLOAD
{
        print STDERR "AUTOLOAD: $AUTOLOAD\n";

        my $name = 'func';
        my $code;
        my $string = "\$code = \\&ExtUtils::Install::$name";

        eval $string;
        *$AUTOLOAD = $code;

        goto &$AUTOLOAD;
}

1;


code:
Version 1.20 - 29 Jue 2009

* Test suite revamped.  Failures are now explained better, and it should
  be easier to debug them remotely.

Version 1.19 - 19 Jun 2009

* New context functions now work with Perl 5.6.2.

* N__() now mirrors its argument in scalar context for convenience.

Version 1.18 - 26 May 2009

* Cosmetic change: The version number is now both in Locale::Messages
  and in Locale::TextDomain to work around a shortcoming of the
  PAUSE indexer.

Version 1.17 - 25 May 2009

* New context support, supporting .po files with msgctxt, and
  appropriate supporting calls (*pgettext calls) under both
  gettext_pp and gettext_xs. TextDomain.pm received corresponding
  calls: __p __px __np __npx __xnp.

* New module Locale::Util with some utility functions, especially for
  web development.  Attention, this is still alpha code!

* Try to warn about wrong usage of the tied hashes in
  Locale::TextDomain.

* Minor bugfixes

Version 1.16 - 28 Sep 2005

* New function Locale::Messages::bind_textdomain_filter() allows you
  to register an output filter as a callback.  You can use this
  feature for example to set the utf-8 flag on translated string when
  you are sure that the output is actually utf-8.

* New function Locale::Messages::turn_utf_8_on().

* various minor bug fixes.

Version 1.15 - 1 Sep 2005

* Workarounds and bugfixes for misconfigured Solaris systems

* Fixed the completely broken simplecal example

* Added section about non-ascii msgids to the POD of Locale::Messages

Version 1.14 - 11 Aug 2005

* Oops: forgot to update the version check in Locale::Messages

* The XS version builds easier on *BSD systems now

Version 1.12 - 11 Aug 2005

* Minor bugfixes

* The test scripts now check whether the needed locales are installed

Version 1.11 - 11 Jun 2004

* Version 1.11 is a minor bugfix release

Version 1.10 - 12 Jan 2004

* XS version now compiles under Windows (GNU gettext and libiconv required,
  build with "perl Makefile.PL DIR=gettext_xs", see README.win32 for details)

Version 1.09 - 29 Dec 2003

* check version match with XS module

* in pure Perl version, use user supplied locale name when guessing
  the output character set

* corrections for Atari character maps

Version 1.08 - 30 Nov 2003

* fixed bug #4512 on https://rt.cpan.org/ (reported by unknown guest)

Version 1.07 - 28 Nov 2003

* bug with charset detection via I18N::Langinfo fixed

* new function Locale::Messages::turn_utf_8_off()

Version 1.06 - 24 Nov 2003

* fixed warning/error under Solaris 8 when I18N::Langinfo is not available

* simplified sample packaging

Version 1.05 - 10 Oct 2003

* fixed compatibility problems with gettext libraries under Solaris 8
  and higher

Version 1.04 - 09 Oct 2003

* support for language chains in $LANGUAGE (e. g. "fr_BE:fr:de")

* performance tweaks for Locale::gettext_pp

* do not clobber $@ in Locale::gettext_pp

Version 1.03 - 15 Sep 2003

* alternative XS implemenation of gettext() and friends (outperforms
  pure Perl version by factor 10-15)

Version 1.02 - 04 Sep 2003

* bugfixes for systems that lack both /usr/share/locale and
  /usr/local/share/locale

* compatibility tweaks for Perl 5.005

Version 1.01 - 19 Aug 2003

* bugfixes

* compatibility tweaks for MS-DOS


code:
README for libintl-perl
=======================

$Id: README,v 1.1 2009-11-01 18:59:59 pertusus Exp $

The package libintl-perl is an internationalization library for Perl
that aims to be compatible with the Uniforum message translations
system as implemented for example in GNU gettext.

    [NOTE for distributors: This file and the complete subdirectory
    "sample" of this release should be installed along with the library
    itself in the according documentation section!]

See the file COPYING.LESSER and the source code for licensing.

More extensive information may be available at the libintl-perl homepage
on the internet http://guido-flohr.net/projects/libintl-perl.

Requirements
------------

The library is entirely written in Perl.  It should run on every
system with a Perl5 interpreter.  The minimum required Perl version
should be 5.004.

The behavior of the package varies a little depending on the Perl
version:

- Perl 5.8 or better

Recommended.  Perl 5.8 offers maximum performance and support for
various multi-byte encodings (even more if Encode::Han is installed).
Additionally the output charset is chosen automatically according to
the information provided by I18N::Langinfo.  In fact, I18N::Langinfo
is already available for Perl 5.7 but this developer version is
probably not much in use any more.

- Perl 5.6 or better

Still offers high-performance UTF-8 handling but no support for other
multi-byte encodings unless the package Encode is installed.

- Earlier Perl versions

Full UTF-8 support but quiet slow since all conversion routines are
written in Perl.  More exactly: Encoding from 8 bit charsets into
UTF-8 is reasonably fast and usable.  Decoding UTF-8 is slow, however.

Note that these are actually the requirements for the *users* of your
software internationalized with libintl-perl.

As a maintainer of a Perl package that uses libintl-perl, you will
also need a recent version of GNU gettext (see the file README in the
subdirectory "sample/" of the source distribution of libintl-perl).
Translators of your software can basically do their job with any text
editor, but it usually makes sense for them, too, to have GNU gettext
installed.  End users of your software, or people that install an
internationalized Perl package do *not* need it, unless they want to
add a new language to your software.

Installation
------------

If libintl-perl is not installed on your system, you have to build it
from the sources, which is a lot easier than you may think.  You need
the program "make" for that and a command line shell.  No C compiler is
required.

Unpack the package in a directory of your choice, cd into that
directory and then type

     perl Makefile.PL
     make

This will build the package.  You can then run the tests with

     make test

To install the package, type

     make install

You will probably need root permissions to do that.

Of course, you can also use the CPAN module to install the package.

Feedback
--------

Send negative (and positive!) feedback to me.  Bug reports can be send
directly to me or you can use the bugtracking system at http://rt.cpan.org/.

If you use libintl-perl for your project, private or public, free or
commercial, please let me know.  I am interested in such information.

If you really like (or dislike?) libintl-perl, tell the world about.  You
can rate it and even write a review at http://cpanratings.perl.org/
(search for "libintl-perl").  You can also increase the popularity index of
libintl-perl at freshmeat.net by visiting its project page at
http://freshmeat.net/projects/libintl-perl, by subscribing to new
releases from the project page, or by rating it.

Design Goals
------------

The primary design goal of libintl-perl is maximum compatibility with
the gettext functions available for other programming languages.  It
is intended that programmers, translators, and end users can fully
benefit from all existing i18n tools like xgettext for message
extraction, msgfmt, msgmerge, etc. for catalog manipulation, Emacs PO
mode (or KBabel, PO-Edit, ...) for catalog editing and so on.

Another design goal is maximum portability.  The library should be
functional without any additional software but with a wide range of
Perl versions.  Wherever possible, hooks have been inserted to benefit
from advanced features in the runtime environment, but the basic
functionality should be present everywhere.

Overview
--------

The core of the library is the module Locale::gettext_pp.  It is a
pure Perl re-implementation of the module Locale::gettext available on
CPAN.  However, the XS version Locale::gettext lacks some functions
(notably plural handling and output conversion) that are already
present in Locale::gettext_pp.  Locale::gettext_pp provides the
internationalization functions that are available in your system
library (libc) or additional C libraries (for example libintl in the
case of GNU gettext).

The class Locale::Messages is an additional abstraction layer that is
prepared for dynamic switching between different gettext implementations (for
example Locale::gettext_pp and Locale::gettext).  It provides
basically the same interface as Locale::gettext_pp but in an
implementation-independent manner.

The module Locale::TextDomain is the only module that you should
actually use in your software.  It represents the message translation
system for a particular text domain (a text domain is a unique
identifier for your software package), makes use of Locale::Messages
for message translation and catalog location, and it provides
additional utility functions, for example common shortcut names for
i18n routines, tied hashes for hash-like lookups into the translation
database, and finally an interpolation mechanism suitable for
internationalized messages.

The package also contains a charset conversion library
Locale::Recode.  This library is used internally by Locale::gettext_pp
to allow on-the-fly charset conversion between the charset in a
message catalog and the preferred (end) user charset.  Its main
advantage about the Encode package available for recent Perl versions
is its portability, since it does not require the Unicode capabilities
of Perl that were introduced with Perl 5.6.  It fully supports UTF-8
with every Perl version and a wealth of common 8 bit encodings.  If
you have to do charset conversion with older Perl versions, then
Locale::Recode may be worth a try although it is really only a helper
library, not intended as a competitor to Encode.

Documentation
-------------

For a basic understanding of message translation in Perl with
libintl-perl you should read the perldoc of Locale::TextDomain.  Don't
bother about the documentation of the other modules in the library,
you will not need it unless you want to hack the library yourself.

There is a mailing list <libintl-perl AT imperia DOT net> (replace
" AT " with "@" and " DOT " with ".") where you can post questions
related to libintl-perl.  The list has also a certain focus on
internationalization of Perl CGI web applications.  Please note, that
postings from non-subscribers will be held back for approval, and it
may take a considerable amount of time until all list members will get
these postings.  You can subscribe to the list via a web interface at
http://ml.imperia.org/mailman/listinfo/libintl-perl/, a searchable
archive of prior postings to the list is available at
http://ml.imperia.org/libintl-perl/.

At the time of this writing (July 2003) the list is new and has
exactly one subscriber and zero postings.  But don't be shy, join
it. ;-)

In order to make use of the software, you will also need various tools
from GNU gettext (http://savannah.gnu.org/projects/gettext/).  The
documentation is located at http://www.gnu.org/manual/gettext/.
You will find there a language-independent overview of
internationalization with GNU gettext, and in the Perl-specific
sections you will find details about the parser that extracts
translatable messages from your Perl sources.

Quick-Start
-----------

The subdirectory "sample" of the source distribution of libintl-perl
contains a full-fledged example for an internationalized Perl package,
including a working Makefile.  The README of that subdirectory
explains all necessary steps.

However, if you are on a recent GNU/Linux system or similar (cygwin
should also do), chances are that you can get the following example to
run:

	#! /usr/local/bin/perl -w

	use strict;

	# This assumes that the textdomain 'libc' is available on your
	# system.  Try "locate libc.mo" or "locate libc.gmo" (or
	# "find / -type f -name libc.mo" if locate is not available on
	# your system).
	#
	# By the way, the "use Locale::TextDomain (TEXTDOMAIN) is the
	# equivalent of
	#
	#      textdomain ("TEXTDOMAIN");
	#
	# in C or similar languages.
	use Locale::TextDomain ('libc');

	# The locale category LC_MESSAGES is not exported by the POSIX
	# module on older Perl versions.
	use Locale::Messages qw (LC_MESSAGES);

	use POSIX ('setlocale');

	# Set the locale according to our environment.
	setlocale (LC_MESSAGES, '');

	# This makes the assumption that your system libc defines a
	# message "No such file or directory".  Check the exact
	# spelling on your system with something like
	# "ls NON-EXISTANT".
	# Note the double underscore in front of the string.  This is
	# really a function call to the function __() that is
	# automagically imported by Locale::TextDomain into your
	# namespace.  This function takes its argument, looks up a
	# translation for it, and returns that, or the unmodified
	# string in case of failure.
	print __"No such file or directory", ".\n";

	__END__

Now run the command "locale -a" or "nlsinfo" to get a list of
available locales on your system.  Try the section "Finding locales"
in "perldoc perllocale" if you have problems.

If, for example, the locale "fr_FR" is available on your system, set
the environment variable LANG to that value, for a POSIX shell

     LANG=fr_FR
     export LANG

for the C shell

     setenv LANG fr_FR

and run your little Perl script.  It should tell you what the error
message for "No such file or directory" is in French, or whatever
language you chose.  Not a real example, because we have "stolen" a
message from a system catalog.  But it should give you the general
idea, especially if you are already familiar with gettext in C.

If you still see the English message, this does not necessarily mean a
failure, since the string is maybe not translated on your system (try
"locate libc.mo" to get a list of available translations).  Even for
the translations listed there, that particular message might be
missing.  Try a common locale like "de_DE" or "fr_FR" that are usually
fully translated then.

Your next steps should be "perldoc Locale::TextDomain", and then study
the example in the subdirectory "sample" of this distribution.

Have fun with libintl-perl!

Guido Flohr


code:
Hi,

old versions of my modules can be found here:

	http://history.perl.org/backpan/authors/id/G/GU/GUIDO/

This is an effort to keep CPAN and its mirrors clean.

Regards,
Guido


code:
Special Notes for Sun Solaris
=============================

Recent versions of Solaris ship with a libintl that is mostly compatible
with GNU gettext.  Even the plural handling functions (ngettext,
dngettext, dcngettext, ...) and output character conversion functions
(bind_textdomain_codeset) are included.

On my test system, the behavior of the Solaris version differs in one
important point from the pure Perl version or the GNU gettext version:
In a locale environment that is a regional variant of another locale
(for example "fr_CA" is a regional variant of "fr"), both the pure Perl
version from libintl-perl and the C version from GNU gettext will fall
back to translations for the superordinate message catalog ("fr") if
no special translation for the selected locale ("fr_CA") can be found.
This fallback mechanism is missing in the Solaris implementation.

This could be considered harmless, because Solaris users are probably
used to this behavior.  On the other hand, the pure Perl version of
gettext in libintl-perl aims to be as compatible as possible to the
GNU gettext implementation.  Furthermore, if the pure Perl and the
C/XS version behave differently, users may be unnecessarily confused.

If you think you can live with that little inconsistence, you are not
completely lost: Edit the toplevel Makefile.PL, in the function
WriteMakefile(), change the value for the hash slot "DIR" from
the value depending on "$result" to simply "['gettext_xs']".  If you
have a look at the source code of Makefile.PL, you will see that this
has already been prepared.

If you do this, the test suite will fail, because the above described
behavior ("fr_CA" vs. "fr" ...) is checked by the tests.  In this case,
expect the following failures:

Failed Test                    Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
./tests/03bind_textdomain_codeset_xs.t        9    2  22.22%  5 9
./tests/03dcgettext_xs.t                      9    2  22.22%  3 7
./tests/03dcngettext_xs.t                    83   51  61.45%  22-31 43-83
./tests/03dgettext_xs.t                       9    2  22.22%  3 7
./tests/03dngettext_xs.t                     83   51  61.45%  22-31 43-83
./tests/03gettext_xs.t                        6    1  16.67%  3
./tests/03ngettext_xs.t                      85   51  60.00%  23-32 45-85

But even if you have installed GNU gettext, you may run into this error
when trying to compile the XS version:

"gettext_xs.xs", line 32: #error: "<libintl.h> is not GNU gettext.  Maybe you have to adjust your include path."
cc: acomp failed for gettext_xs.c
make[1]: *** [gettext_xs.o] Error 2
make[1]: Leaving directory `/root/libintl-perl-1.15/gettext_xs'
make: *** [subdirs] Error 2

What has happened here?  Have a look at the source code of <libintl.h>
that ships with GNU gettext:

/* We define an additional symbol to signal that we use the GNU
   implementation of gettext.  */
#define __USE_GNU_GETTEXT 1

...

/* We redirect the functions to those prefixed with "libintl_".  This is
   necessary, because some systems define gettext/textdomain/... in the C
   library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
   If we used the unprefixed names, there would be cases where the
   definition in the C library would override the one in the libintl.so
   shared library.  Recall that on ELF systems, the symbols are looked
   up in the following order:
     1. in the executable,
     2. in the shared libraries specified on the link command line, in order,
     3. in the dependencies of the shared libraries specified on the link
        command line,
     4. in the dlopen()ed shared libraries, in the order in which they were
        dlopen()ed.
   The definition in the C library would override the one in libintl.so if
   either
     * -lc is given on the link command line and -lintl isn't, or
     * -lc is given on the link command line before -lintl, or
     * libintl.so is a dependency of a dlopen()ed shared library but not
       linked to the executable at link time.
   Since Solaris gettext() behaves differently than GNU gettext(), this
   would be unacceptable.

   The redirection happens by default through macros in C, so that &gettext
   is independent of the compilation unit, but through inline functions in
   C++, in order not to interfere with the name mangling of class fields or
   class methods called 'gettext'.  */

In brief: The GNU libraries libintl.so and libintl.a prefix all functions
with "libintl_" in order to avoid symbol name conflicts with the vanilla
Solaris verssion.  These precautions still give room to a popular
misconfiguration: If you install GNU gettext with the default prefix
"/usr/local", libraries will get installed in "/usr/local/lib", the
header files - notably <libintl.h> - will get installed in
"/usr/local/include", so far so good.  Now set the environment variable
LD_LIBRARY_PATH to "/usr/local/lib", so that the GNU version of libintl.so
will be found by the dynamic loader at runtime.  Yet, if
"/usr/local/include" comes after "/usr/include" in your C compiler's
include path, the above described trick does not work, the functions
like "gettext", "dgettext" etc. will not get re-defined to "libintl_gettext",
"libintl_dgettext" and so on.  Remember, the preprocessor trick used by
GNU gettext will change every reference to the function gettext() into
a reference to libintl_gettext() for gettext() into a definition for
libintl_gettext().  If your C compiler includes the "wrong" include file
(/usr/include/libintl.h) instead of the "correct" one
(/usr/local/include/libintl.h), your C sources will still reference
gettext() instead of libintl_gettext().  At run-time, even if the dynamic
loader considers the GNU version of libintl.so (in "/usr/local/lib"), it
will not use it, because it looks for the "wrong" symbol gettext()
instead of libintl_gettext().

Too complicated? Okay: The order for C header files for the C compiler
(actually the preprocessor) differs from the inclusion order for
libraries and this must lead to trouble.  If you understand WHY, you
will find a way to fix it.  If not, ignore the problem: Do not
build the problem, and be assured, that the pure Perl version is
fast enough.  It is very, very unlikely that using the pure Perl
instead of the XS version of will be the bottleneck of any application
you use.

Life is complicated under the sun, ain't it? ;-)

Guido


code:
When building libintl-perl under 32 bit versions of MS-DOS, you have several
options, depending on the facilities available on your system, and on the Perl
version you use.

Cygwin Perl
===========

When using the Perl interpreter that ships with cygwin, you are in a pretty
Unix-like environment, and you should be able to build and use libintl-perl
like on ordinary operating system.

ActiveState Perl
================

By default, the XS version of libintl-perl is not built.  You will not win
a lot, by trying to build the XS version, but if you can't help, here are
the instructions that worked on my system.  Your mileage may vary, however.

C Compiler
----------

Windows does not ship with a C compiler.  Since ActiveState Perl is built
with Microsoft Visual C, you probably will not have a choice, and have to
purchase MSVC.

Building libiconv and GNU gettext
---------------------------------

The XS version of libintl-perl requires the runtime facilities provided by
GNU gettext, which in turn rely on libiconv.  You can both in source form
from ftp://ftp.gnu.org/pub/gnu.

First, unpack both the libiconv and gettext sources in a directory of your
choice, open the MS-DOS cripple shell ("cmd.exe"), and cd into the directory
where you have unpacked the libiconv sources.  There read the file
"README.woe32" or just type

    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1 check
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1 install

The second command line will run the test suite (you may omit this step).

Now cd to the directory where you have unpacked the gettext sources, and
read "README.woe32", or just type

    nmake -f Makefile.msvc MFLAGS=-MD DLL=1
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 check
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 install

You should now go back into the libiconv build directory, and re-build
the package again with native language support:

    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1 distclean
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 check
    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 install

You should now have the gettext and libiconv DLLs installed in "\usr\bin",
and libraries in "\usr\lib".  It should be theoretically possible to build
static versions (instead of DLLs) of both gettext and libiconv, but I
did not manage to do so here.

Build libintl-perl
------------------

The Makefile.PL provided with libintl-perl normally autodetects the presence
of the required gettext shared libraries, but this test (intentionally) fails
under Windows.  You have to bypass the mechanism by saying

    perl Makefile.PL DIR=gettext_xs

This should produce an output like this:

    Checking whether we can compile the XS version ... no
    => Cannot build the XS version of libintl-perl (see 'config.log' for
    => details).  This is harmless!
    Writing Makefile Locale::gettext_xs
    Writing Makefile for libintl-perl

Ignore the warning, that the XS version cannot be built.  It will be
built anyhow.

Now do the usual:

    nmake
    nmake test
    nmake install

Please run the testsuite!  If it fails, and you cannot sort out the reason,
re-build the module without the XS version.

Distribution
------------

If you want a binary version of libintl-perl, you either have to bundle it
with the DLLs and libraries for GNU gettext and libiconv, or you have to
build and link against static versions of the two libraries (which I didn't
manage to do).  In any case, please take care that your distribution does
not violate the licenses under which GNU gettext, libiconv, and libintl-perl
are provided! Please read the following statement by Bruno Haible,
maintainer of GNU gettext and libiconv:

  Note that DLLs created with MSVC 7.0 cannot be distributed: They depend
  on a closed-source library 'msvcr70.dll' which is not normally part of a
  Woe32 installation, therefore the distribution of such DLLs - with or
  without msvcr70.dll - would be a violation of the LGPL. This problem does
  not occur with MSVC 6.0 and earlier.

Guido Flohr <guido@imperia.net>


code:
- the dvd::rip project
  http://www.exit1.org/dvdrip/

- the Sympa mailing list manager
  http://www.sympa.org/

- the public key infrastructure (PKI) OpenCA
  http://www.openca.org/

- the Lire log file analysis tool
  http://www.logreport.org/

- the GPG key-signing utility gpgsigs
  http://www.palfrader.org/gpgsigs

- (the build script for) the TortoiseCVS CVS frontend
  http://www.tortoisecvs.org/

- the pure Perl implementation of the Twofish algorithm
  http://search.cpan.org/~guido/Crypt-Twofish_PP/

- the Imperia enterprise content management system
  http://www.imperia.net/

- the Imperia mailing list archive
  http://ml.imperia.org/

- the pimp Photo Importer
  http://www.grawert.net/software/pimp/

- midcat, concatenate MIDI files to stdout
  http://ptaff.ca/midcat/?lang=en_CA

- Luci is the University of New Brunswick, Canada's enterprise website
  accessibility solution and requires libintl-perl via Crypt::Twofish_PP
  http://luci.sourceforge.net/

- gwine, the Gnome wine cellar management tool
  http://home.gna.org/gwine/

- gtestrunner (Test-Unit-GTestRunner), a unit test GUI
  http://search.cpan.org/~guido/Test-Unit-GTestRunner/

- hdico, search a definition in the Hachette dictionary
  http://svn.naquadah.org/listing.php?repname=hdico&path=%2F&rev=0&sc=0

- IWL, a GUI toolkit for html
  http://search.cpan.org/~viktork/IWL/


code:
$Id: THANKS,v 1.1 2009-11-01 18:59:59 pertusus Exp $

These people have helped in the development of libintl-perl:

- Imperia (http://www.imperia.net/) has contributed this part of the
  Enterprise Content Management System Imperia to the Perl community
  as free software.

- Joshua Miller <unrtst@cpan.com> has extended libintl-perl to provide
  the important context-sensitive functions (pgettext() and friends).

- Christian Lackas <delta@lackas.net> has given various hints on
  performance optimizations

- Ingrid Gräfen <ingrid.graefen@imperia.net> has fixed a major performance
  penalty on systems without POSIX::LC_MESSAGES, and she has extensively
  tested the Perl backend for GNU xgettext under cygwin

- Norma Karl <bcrazy@gmx.de> has thoroughly revised the documentation for
  the Perl backend to GNU xgettext, and she deserves a credit anyway

- Bruno Haible for libiconv which was the base for many conversions and
  for integrating my Perl backend into GNU gettext

Other people have helped by sending in improvements, suggestions and
bug reports:

- DH <crazyinsomniac@yahoo.com>
- Jo-Even Skarstein <joska@nvg.org>
- Gerhard Stoll <gerhard_stoll@gmx.de>
- Marc Brockschmidt <marc@marcbrockschmidt.de>
- Laurent Bonnaud <Laurent.Bonnaud@inpg.fr>
- Jan Kratochvil <lace@jankratochvil.net>
- Светослав Агафонкин <slavi.agafonkin@imperia.net>
- Michael Bell <michael.bell@cms.hu-berlin.de>
- David Cantrell <dcantrell@cpan.org>

Please inform me if I have forgotten your contribution.

Guido Flohr


code:
- Use LGPL version 3?

- web_set_locale returns the language and the country for lang/country
  combinations (eg. de-AT) in the language field.  Correct?

- add conversion modules for other Unicode encodings than UTF-8
  (UTF-16, UCS-*)

- Better support for Windows, the locale detection stuff does not
  really work there.  Any help would be appreciated.

- Check whether other locale categories than LC_MESSAGES work.

- Avoid call to __load_domain in Locale::gettext_pp, use a cache table
  first

- The pure Perl version of gettext will always look for message catalogs
  in /usr/share/locale/{LANGUAGE}/LC_MESSAGES after the directory
  specified by bindtextdomain().  This can lead to undesired results.
  But I think the C version from libintl does the same, correct?

- Allow to dynamically expand the list of supported conversions

- Allow to dynamically restrict the list of suppported conversions


code:
#! /usr/local/bin/perl -w # -*- perl -*-

# vim: tabstop=4
# $Id: Makefile.PL,v 1.1 2009-11-01 19:00:00 pertusus Exp $

# Makefile generator for libintl-perl.
# Copyright (C) 2002-2009 Guido Flohr <guido@imperia.net>,
# all rights reserved.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.use ExtUtils::MakeMaker;

use 5.004;
use ExtUtils::MakeMaker;

#$ExtUtils::MakeMaker::Verbose = 2;
#@ExtUtils::MakeMaker::Parent = ();

WriteMakefile (
    NAME		    => 'Locale::gettext_xs',
    VERSION_FROM	=> '../lib/Locale/Messages.pm',
    ($] >= 5.005 ?
		(ABSTRACT	=> 'XS Interface to Uniforum Message Translation',
	 	 AUTHOR		=> 'Guido Flohr <guido@imperia.net>',
    ) : (),
    ),
    PREREQ_PM => { File::Spec => 0 },
	PL_FILES        => {},
	LIBS => ['-lintl -liconv'],
);

__END__

Local Variables:
mode: perl
perl-indent-level: 4
perl-continued-statement-offset: 4
perl-continued-brace-offset: 0
perl-brace-offset: -4
perl-brace-imaginary-offset: 0
perl-label-offset: -4
cperl-indent-level: 4
cperl-continued-statement-offset: 2
tab-width: 4
End:


code:
#! /bin/false

# vim: tabstop=4
# $Id: gettext_xs.pm,v 1.1 2009-11-01 19:00:00 pertusus Exp $

# Pure Perl implementation of Uniforum message translation.
# Copyright (C) 2002-2009 Guido Flohr <guido@imperia.net>,
# all rights reserved.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.

package Locale::gettext_xs;

require DynaLoader;
require Exporter;

use vars qw (%EXPORT_TAGS @EXPORT_OK @ISA);

%EXPORT_TAGS = (locale_h => [ qw (
								  gettext
								  dgettext
								  dcgettext
								  ngettext
								  dngettext
								  dcngettext
								  pgettext
								  dpgettext
								  dcpgettext
								  npgettext
								  dnpgettext
								  dcnpgettext
								  textdomain
								  bindtextdomain
								  bind_textdomain_codeset
								  )
							  ],
				libintl_h => [ qw (LC_CTYPE
								   LC_NUMERIC
								   LC_TIME
								   LC_COLLATE
								   LC_MONETARY
								   LC_MESSAGES
								   LC_ALL)
							   ],
				);

@EXPORT_OK = qw (gettext
				 dgettext
				 dcgettext
				 ngettext
				 dngettext
				 dcngettext
                 pgettext
                 dpgettext
                 dcpgettext
                 npgettext
                 dnpgettext
                 dcnpgettext
				 textdomain
				 bindtextdomain
				 bind_textdomain_codeset
                                 nl_putenv
				 LC_CTYPE
				 LC_NUMERIC
				 LC_TIME
				 LC_COLLATE
				 LC_MONETARY
				 LC_MESSAGES
				 LC_ALL);
@ISA = qw (Exporter DynaLoader);

bootstrap Locale::gettext_xs;

require File::Spec;

# Reimplement pgettext functions
sub pgettext ($$) {
	my ($msgctxt, $msgid) = @_;

	my $msg_ctxt_id = join("\004", $msgctxt, $msgid);
	return Locale::gettext_xs::_pgettext_aux
		("", $msg_ctxt_id, $msgid, Locale::gettext_xs::LC_MESSAGES());
}
sub dpgettext ($$$) {
	my ($domain, $msgctxt, $msgid) = @_;

	my $msg_ctxt_id = join("\004", $msgctxt, $msgid);
	return Locale::gettext_xs::_pgettext_aux
		($domain, $msg_ctxt_id, $msgid, Locale::gettext_xs::LC_MESSAGES());
}
sub dcpgettext ($$$$) {
	my ($domain, $msgctxt, $msgid, $category) = @_;

	my $msg_ctxt_id = join("\004", $msgctxt, $msgid);
	return Locale::gettext_xs::_pgettext_aux
		($domain, $msg_ctxt_id, $msgid, $category);
}

# Reimplement npgettext functions
sub npgettext ($$$$) {
	my ($msgctxt, $msgid1, $msgid2, $n) = @_;

	my $msg_ctxt_id = join("\004", $msgctxt, $msgid1);
	return Locale::gettext_xs::_npgettext_aux
		("", $msg_ctxt_id, $msgid1, $msgid2, $n, Locale::gettext_xs::LC_MESSAGES());
}
sub dnpgettext ($$$$$) {
	my ($domain, $msgctxt, $msgid1, $msgid2, $n) = @_;

	my $msg_ctxt_id = join("\004", $msgctxt, $msgid1);
	return Locale::gettext_xs::_npgettext_aux
		($domain, $msg_ctxt_id, $msgid1, $msgid2, $n, Locale::gettext_xs::LC_MESSAGES());
}
sub dcnpgettext ($$$$$$) {
	my ($domain, $msgctxt, $msgid1, $msgid2, $n, $category) = @_;

	my $msg_ctxt_id = join("\004", $msgctxt, $msgid1);
	return Locale::gettext_xs::_npgettext_aux
		($domain, $msg_ctxt_id, $msgid1, $msgid2, $n, $category);
}

# Wrapper function that converts Perl paths to OS paths.
sub bindtextdomain ($;$) {
	my ($domain, $directory) = @_;

	if (defined $domain && length $domain &&
		defined $directory && length $directory) {
		return Locale::gettext_xs::_bindtextdomain
			($domain, File::Spec->catdir ($directory));
	} else {
		return &Locale::gettext_xs::_bindtextdomain;
	}
}

# In the XS version, making the prototype optional, does not work.
sub textdomain (;$) {
	my $domain = shift;

	if (defined $domain) {
		return Locale::gettext_xs::_textdomain ($domain);
	} else {
		return Locale::gettext_xs::_textdomain ("");
	}
}

sub nl_putenv ($) {
    my ($envspec) = @_;

    return unless defined $envspec;
    return unless length $envspec;
    return if substr ($envspec, 0, 1) eq '=';

    my ($var, $value) = split /=/, $envspec, 2;

    if ($^O eq 'MSWin32') {
        $value = '' unless defined $value;
        return unless Locale::gettext_xs::_nl_putenv ("$var=$value") == 0;
        if (length $value) {
            $ENV{$var} = $value;
        } else {
            delete $ENV{$var};
        }
    } else {
        if (defined $value) {
            $ENV{$var} = $value;
        } else {
            delete $ENV{$var};
        }
    }

    return 1;
}

1;

__END__

Local Variables:
mode: perl
perl-indent-level: 4
perl-continued-statement-offset: 4
perl-continued-brace-offset: 0
perl-brace-offset: -4
perl-brace-imaginary-offset: 0
perl-label-offset: -4
tab-width: 4
End:


code:
/* -*- C -*- */
/* $Id: gettext_xs.xs,v 1.1 2009-11-01 19:00:00 pertusus Exp $ */
/*
# Perl binding for Uniforum message translation.
# Copyright (C) 2002-2009 Guido Flohr <guido@imperia.net>,
# all rights reserved.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.  */

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <string.h>
#include <locale.h>
#include <libintl.h>
/* Handle the case that we link against GNU libintl but include a non
 * GNU libintl.h.  */
#ifndef __USE_GNU_GETTEXT
# error "<libintl.h> is not GNU gettext.  Maybe you have to adjust your include path."
#endif

MODULE = Locale::gettext_xs	PACKAGE = Locale::gettext_xs

PROTOTYPES: ENABLE

char*
__gettext_xs_version ()
     CODE:
	  RETVAL = (VERSION);
     OUTPUT:
	  RETVAL

double
LC_CTYPE ()
     CODE:
          RETVAL = (double) LC_CTYPE;
     OUTPUT:
          RETVAL

double
LC_NUMERIC ()
     CODE:
          RETVAL = (double) LC_NUMERIC;
     OUTPUT:
          RETVAL

double
LC_TIME ()
     CODE:
          RETVAL = (double) LC_TIME;
     OUTPUT:
          RETVAL

double
LC_COLLATE ()
     CODE:
          RETVAL = (double) LC_COLLATE;
     OUTPUT:
          RETVAL

double
LC_MONETARY ()
     CODE:
          RETVAL = (double) LC_MONETARY;
     OUTPUT:
          RETVAL

double
LC_MESSAGES ()
     CODE:
          RETVAL = (double) LC_MESSAGES;
     OUTPUT:
          RETVAL

double
LC_ALL ()
     CODE:
          RETVAL = (double) LC_ALL;
     OUTPUT:
          RETVAL

char*
gettext (msgid)
     char* msgid
     PROTOTYPE: $
     CODE:
    	  RETVAL = (char*) gettext (msgid);
     OUTPUT:
	  RETVAL

char*
dgettext (domainname, msgid)
	char* domainname
	char* msgid
    PROTOTYPE: $$
    CODE:
	RETVAL = (char*) dgettext (domainname, msgid);
    OUTPUT:
	RETVAL

char*
dcgettext (domainname, msgid, category)
	char* domainname
	char* msgid
	int category
    PROTOTYPE: $$$
    CODE:
	RETVAL = (char*) dcgettext (domainname, msgid, category);
    OUTPUT:
	RETVAL

char*
ngettext (msgid1, msgid2, n)
	char* msgid1
	char* msgid2
	unsigned long n
    PROTOTYPE: $$$
    CODE:
	RETVAL = (char*) ngettext (msgid1, msgid2, n);
    OUTPUT:
	RETVAL

char*
dngettext (domainname, msgid1, msgid2, n)
	char* domainname
	char* msgid1
	char* msgid2
	unsigned long n
    PROTOTYPE: $$$$
    CODE:
	RETVAL = (char*) dngettext (domainname, msgid1, msgid2, n);
    OUTPUT:
	RETVAL

char*
dcngettext (domainname, msgid1, msgid2, n, category)
	char* domainname
	char* msgid1
	char* msgid2
	unsigned long n
	int category
    PROTOTYPE: $$$$$
    CODE:
	RETVAL = (char*) dcngettext (domainname, msgid1, msgid2, n, category);
    OUTPUT:
	RETVAL

char*
_pgettext_aux (domain, msg_ctxt_id, msgid, category)
    char* domain
    char* msg_ctxt_id
    char* msgid
    int category
    PROTOTYPE: $$$$
    PREINIT:
    char* translation;
    CODE:
    /* Treat empty or undefined strings as NULL. */
    if (!domain || domain[0] == '\000')
        domain = NULL;
    /* Treat -1 as null, and default to LC_MESSAGES */
    if (category == -1)
        category = LC_MESSAGES;
    /* reimplemented from gettext-0.17 */
    translation = (char*) dcgettext (domain, msg_ctxt_id, category);
    if (translation == msg_ctxt_id)
        RETVAL = msgid;
    else
        RETVAL = translation;
    OUTPUT:
    RETVAL

char*
_npgettext_aux (domain, msg_ctxt_id, msgid1, msgid2, n, category)
    char* domain
    char* msg_ctxt_id
    char* msgid1
    char* msgid2
	unsigned long n
    int category
    PROTOTYPE: $$$$$$
    PREINIT:
    char* translation;
    CODE:
    /* Treat empty or undefined strings as NULL. */
    if (!domain || domain[0] == '\000')
        domain = NULL;
    /* Treat -1 as null, and default to LC_MESSAGES */
    if (category == -1)
        category = LC_MESSAGES;
    translation = (char*) dcngettext (domain, msg_ctxt_id, msgid2, n, category);
    if (translation == msg_ctxt_id || translation == msgid2)
        RETVAL = (n == 1 ? msgid1 : msgid2);
    else
        RETVAL = translation;
    OUTPUT:
    RETVAL

# FIXME: The prototype should actually be ';$' but it doesn't work
# as expected.  Passing no argument results in an error.
char*
_textdomain (domain)
	char* domain
    PROTOTYPE: $
    CODE:
	/* Treat empty or undefined strings as NULL.  */
	if (!domain || domain[0] == '\000')
		domain = NULL;
	RETVAL = (char*) textdomain (domain);
	if (!RETVAL || RETVAL[0] == '\000') {
		XSRETURN_UNDEF;
	}
    OUTPUT:
	RETVAL

# This function is a no-op except for MS-DOS with its completely
# brain-damaged environment interface.
int
_nl_putenv (str)
        char* str
    PROTOTYPE: $
    CODE:
#if defined (WIN32)
        RETVAL = _putenv (str);
#else
        RETVAL = 0;
#endif
    OUTPUT:
        RETVAL

char*
_bindtextdomain (domain = NULL, dirname = NULL)
	char* domain
	char* dirname
    PROTOTYPE: $;$
    CODE:
	/* Treat empty or undefined strings as NULL.  */
	if (!domain || domain[0] == '\000')
		domain = NULL;
	if (!dirname || dirname[0] == '\000')
		dirname = NULL;
	RETVAL = (char*) bindtextdomain (domain, dirname);
	if (!RETVAL || RETVAL[0] == '\000') {
		XSRETURN_UNDEF;
	}

    OUTPUT:
	RETVAL

char*
bind_textdomain_codeset (domainname, codeset)
	char* domainname
	char* codeset
    PROTOTYPE: $;$
    CODE:
	/* Treat empty or undefined strings as NULL.  */
	if (!domainname || domainname[0] == '\000')
		domainname = NULL;
	if (!codeset || codeset[0] == '\000')
		codeset = NULL;
	RETVAL = (char*) bind_textdomain_codeset (domainname, codeset);
	if (!RETVAL || RETVAL[0] == '\000') {
		XSRETURN_UNDEF;
	}

    OUTPUT:
	RETVAL


code:
#! /bin/false

# vim: set autoindent shiftwidth=4 tabstop=4:
# $Id: Messages.pm,v 1.1 2009-11-01 19:00:00 pertusus Exp $

# Copyright (C) 2002-2009 Guido Flohr <guido@imperia.net>,
# all rights reserved.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.

package Locale::Messages;

use strict;

use vars qw ($package @EXPORT_OK %EXPORT_TAGS @ISA $VERSION);

$VERSION = '1.20';

# Try to load the C version first.
$package = 'gettext_xs';
my $can_xs = 1;
eval <<'EOF';
require Locale::gettext_xs;
my $version = Locale::gettext_xs::__gettext_xs_version();
die "Version: $version mismatch (1.20 vs. $version)" unless $version eq '1.20';
EOF
if ($@) {
    $package = 'gettext_pp';
	undef $can_xs;
    require Locale::gettext_pp;
}

require Exporter;
@ISA = qw (Exporter);
%EXPORT_TAGS = (locale_h => [ qw (gettext
				  dgettext
				  dcgettext
				  ngettext
				  dngettext
				  dcngettext
				  pgettext
				  dpgettext
				  dcpgettext
				  npgettext
				  dnpgettext
				  dcnpgettext
				  textdomain
				  bindtextdomain
				  bind_textdomain_codeset
				  )
			       ],
		 libintl_h => [ qw (LC_CTYPE
				    LC_NUMERIC
				    LC_TIME
				    LC_COLLATE
				    LC_MONETARY
				    LC_MESSAGES
				    LC_ALL)
				],
		 );

@EXPORT_OK = qw (select_package
				 turn_utf_8_on
				 turn_utf_8_off
				 gettext
				 dgettext
				 dcgettext
				 ngettext
				 dngettext
				 dcngettext
				 pgettext
				 dpgettext
				 dcpgettext
				 npgettext
				 dnpgettext
				 dcnpgettext
				 textdomain
				 bindtextdomain
				 bind_textdomain_codeset
				 bind_textdomain_filter
                 nl_putenv
				 LC_CTYPE
				 LC_NUMERIC
				 LC_TIME
				 LC_COLLATE
				 LC_MONETARY
				 LC_MESSAGES
				 LC_ALL);

BEGIN {
	my ($has_encode, $has_bytes);

	if ($] >= 5.006) {
		unless (defined $has_encode) {
			eval "require Encode";
			$has_encode = !$@;
		}

		unless ($has_encode || defined $has_bytes) {
			eval "use bytes";
			$has_bytes = !$@;
		}
	}

	# Turn the UTF-8 flag on or off unconditionally.  The prototypes
	# allow an optional second parameter, so that you can use the
	# functions as callbacks to bind_textdomain_filter.
	if ($has_encode) {
		eval <<'EOF';
sub turn_utf_8_on($;$)
{
	Encode::_utf8_on ($_[0]);
	return $_[0];
}

sub turn_utf_8_off($;$)
{
	Encode::_utf8_off ($_[0]);
	return $_[0];
}

EOF
	} elsif ($has_bytes) {
		eval <<'EOF';
sub turn_utf_8_on($;$)
{
	$_[0] = pack "U0C*", unpack "C*", $_[0];
}

sub turn_utf_8_off($;$)
{
	use bytes;
	$_[0] = join "", split //, $_[0];
}

EOF
	} else {
		eval <<'EOF';
sub turn_utf_8_on($;$)
{
	return $_[0];
}

sub turn_utf_8_off($;$)
{
	return $_[0];
}

EOF
	}
}

# The textdomain could be undef.  We avoid a warning by specifying
# a filter for the undefined textdomain.
my %filters = (
			   undef => \&turn_utf_8_off,
			   );

sub select_package
{
	my ($pkg, $compatibility) = @_;

	# Compatibility quirk for a bug pre 1.17:
	if (__PACKAGE__ eq $pkg && defined $compatibility) {
		$pkg = $compatibility;
	}

	if (!$can_xs || (defined $pkg && 'gettext_pp' eq $pkg)) {
		require Locale::gettext_pp;
		$package = 'gettext_pp';
	} else {
		eval "require Locale::gettext_xs";
		$package = 'gettext_xs' unless $@;
	}

    return $package;
}

sub bind_textdomain_filter($;$$)
{
	my ($textdomain, $coderef, $data) = @_;

	$filters{$textdomain} = [ $coderef, $data ];

	return 1;
}

sub textdomain(;$)
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::textdomain :
	&Locale::gettext_pp::textdomain;
}

sub bindtextdomain($;$)
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::bindtextdomain :
	&Locale::gettext_pp::bindtextdomain;
}

sub bind_textdomain_codeset($;$)
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::bind_textdomain_codeset :
	&Locale::gettext_pp::bind_textdomain_codeset;
}

sub gettext($)
{
	my $textdomain = textdomain;
	$filters{$textdomain} ||= [ \&turn_utf_8_off ];
	my $cb = $filters{$textdomain};

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::gettext :
		     &Locale::gettext_pp::gettext, $cb->[1]);
}

sub dgettext($$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dgettext :
		     &Locale::gettext_pp::dgettext, $cb->[1]);
}

sub dcgettext($$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dcgettext :
		     &Locale::gettext_pp::dcgettext, $cb->[1]);
}

sub ngettext($$$)
{
	my $textdomain = textdomain;
	$filters{$textdomain} ||= [ \&turn_utf_8_off ];
	my $cb = $filters{$textdomain};

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::ngettext :
		     &Locale::gettext_pp::ngettext, $cb->[1]);
}

sub dngettext($$$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dngettext :
		     &Locale::gettext_pp::dngettext, $cb->[1]);
}

sub dcngettext($$$$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dcngettext :
		     &Locale::gettext_pp::dcngettext, $cb->[1]);
}

###
sub pgettext($$)
{
	my $textdomain = textdomain;
	$filters{$textdomain} ||= [ \&turn_utf_8_off ];
	my $cb = $filters{$textdomain};

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::pgettext :
		     &Locale::gettext_pp::pgettext, $cb->[1]);
}

sub dpgettext($$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dpgettext :
		     &Locale::gettext_pp::dpgettext, $cb->[1]);
}

sub dcpgettext($$$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dcpgettext :
		     &Locale::gettext_pp::dcpgettext, $cb->[1]);
}

sub npgettext($$$$)
{
	my $textdomain = textdomain;
	$filters{$textdomain} ||= [ \&turn_utf_8_off ];
	my $cb = $filters{$textdomain};

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::npgettext :
		     &Locale::gettext_pp::npgettext, $cb->[1]);
}

sub dnpgettext($$$$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dnpgettext :
		     &Locale::gettext_pp::dnpgettext, $cb->[1]);
}

sub dcnpgettext($$$$$$)
{
	my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];

    $cb->[0] ('gettext_xs' eq $package ?
		     &Locale::gettext_xs::dcnpgettext :
		     &Locale::gettext_pp::dcnpgettext, $cb->[1]);
}

sub nl_putenv($)
{
    'gettext_xs' eq $package ?
		     &Locale::gettext_xs::nl_putenv :
		     &Locale::gettext_pp::nl_putenv;
}

sub LC_NUMERIC
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_NUMERIC :
	&Locale::gettext_pp::LC_NUMERIC;
}

sub LC_CTYPE
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_CTYPE :
	&Locale::gettext_pp::LC_CTYPE;
}

sub LC_TIME
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_TIME :
	&Locale::gettext_pp::LC_TIME;
}

sub LC_COLLATE
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_COLLATE :
	&Locale::gettext_pp::LC_COLLATE;
}

sub LC_MONETARY
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_MONETARY :
	&Locale::gettext_pp::LC_MONETARY;
}

sub LC_MESSAGES
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_MESSAGES :
	&Locale::gettext_pp::LC_MESSAGES;
}

sub LC_ALL
{
    'gettext_xs' eq $package ?
	&Locale::gettext_xs::LC_ALL :
	&Locale::gettext_pp::LC_ALL;
}

1;

__END__

=head1 NAME

Locale::Messages - Gettext Like Message Retrieval

=head1 SYNOPSIS

 use Locale::Messages (:locale_h :libintl_h);

 gettext $msgid;
 dgettext $textdomain, $msgid;
 dcgettext $textdomain, $msgid, LC_MESSAGES;
 ngettext $msgid, $msgid_plural, $count;
 dngettext $textdomain, $msgid, $msgid_plural, $count;
 dcngettext $textdomain, $msgid, $msgid_plural, $count, LC_MESSAGES;
 pgettext $msgctxt, $msgid;
 dpgettext $textdomain, $msgctxt, $msgid;
 dcpgettext $textdomain, $msgctxt, $msgid, LC_MESSAGES;
 npgettext $msgctxt, $msgid, $msgid_plural, $count;
 dnpgettext $textdomain, $msgctxt, $msgid, $msgid_plural, $count;
 dcnpgettext $textdomain, $msgctxt, $msgid, $msgid_plural, $count, LC_MESSAGES;
 textdomain $textdomain;
 bindtextdomain $textdomain, $directory;
 bind_textdomain_codeset $textdomain, $encoding;
 bind_textdomain_filter $textdomain, \&filter, $data;
 turn_utf_8_on ($variable);
 turn_utf_8_off ($variable);
 nl_putenv ('OUTPUT_CHARSET=koi8-r');
 my $category = LC_CTYPE;
 my $category = LC_NUMERIC;
 my $category = LC_TIME;
 my $category = LC_COLLATE;
 my $category = LC_MONETARY;
 my $category = LC_MESSAGES;
 my $category = LC_ALL;

=head1 DESCRIPTION

The module B<Locale::Messages> is a wrapper around the interface to
message translation according to the Uniforum approach that is
for example used in GNU gettext and Sun's Solaris.  It is intended
to allow Locale::Messages(3) to switch between different implementations
of the lower level libraries but this is not yet implemented.

Normally you should not use this module directly, but the high
level interface Locale::TextDomain(3) that provides a much simpler
interface.  This description is therefore deliberately kept
brief.  Please refer to the GNU gettext documentation available at
L<http://www.gnu.org/manual/gettext/> for in-depth and background
information on the topic.

The lower level module Locale::gettext_pp(3) provides the Perl
implementation of gettext() and related functions.

=head1 FUNCTIONS

The module exports by default nothing.  Every function has to be
imported explicitely or via an export tag (L</"EXPORT TAGS">).

=over 4

=item B<gettext MSGID>

Returns the translation for B<MSGID>.  Example:

    print gettext "Hello World!\n";

If no translation can be found, the unmodified B<MSGID> is returned,
i. e. the function can I<never> fail, and will I<never> mess up your
original message.

Note for Perl 5.6 and later: The returned string will I<always> have
the UTF-8 flag off by default.  See the documentation for function
bind_textdomain_filter() for a way to change this behavior.

One common mistake is this:

    print gettext "Hello $name!";

Perl will interpolate the variable C<$name> I<before> the function
will see the string.  Unless the corresponding message catalog
contains a message "Hello Tom!", "Hello Dick!" or "Hello Harry!",
no translation will be found.

Using printf() and friends has its own problems:

    print sprintf (gettext ("This is the %s %s."), $color, $thing);

(The example is stupid because neither color nor thing will get
translated here ...).

In English the adjective (the color) will precede the noun, many
other languages (for example French or Italian) differ here.  The
translator of the message may therefore have a hard time to find
a translation that will still work and not sound stupid in the
target language.  Many C implementations of printf() allow to
change the order of the arguments, and a French translator could
then say:

    "C'est le %$2s %$1s."

Perl printf() implements this feature as of version 5.8 or better.
Consequently you can only use it, if you are sure that your software
will run with Perl 5.8 or a later version.

Another disadvantage of using printf() is its cryptic syntax (maybe
not for you but translators of your software may have their own
opinion).

See the description of the function C<__x()> in Locale::TextDomain(3)
for a much better way to get around this problem.

Non-ASCII message ids ...

You should note that the function (and all other similar functions
in this module) does a bytewise comparison of the B<MSGID> for the
lookup in the translation catalog, no matter whether obscure utf-8
flags are set on it, whether the string looks like utf-8, whether
the utf8(3pm) pragma is used, or whatever other weird method past
or future perl(1) versions invent for guessing character sets of
strings.

Using other than us-ascii characters in Perl source code is a call
for trouble, a compatibility nightmare.  Furthermore, GNU gettext
only lately introduced support for non-ascii character sets in sources,
and support for this feature may not be available everywhere.  If
you absolutely want to use B<MSGID>s in non-ascii character sets,
it is wise to choose utf-8.  This will minimize the risk that perl(1)
itself will mess with the strings, and it will also be a guaranty
that you can later translate your project into arbitrary target
languages.

Other character sets can theoretically work.  Yet, using another
character set in the Perl source code than the one used in your
message catalogs will B<never> work, since the lookup is done bytewise,
and all strings with non-ascii characters will not be found.

Even if you have solved all these problems, there is still one show
stopper left: The gettext runtime API lacks a possibility to specify
the character set of the source code (including the original strings).
Consequently - in absence of a hint for the input encoding - strings
without a translation are not subject to output character set conversion.
In other words: If the (non-determinable) output character set differs
from the character set used in the source code, output can be a
mixture of two character sets.  There is no point in trying to address
this problem in the pure Perl version of the gettext functions.  because
breaking compatibilty between the Perl and the C version is a price too
high to pay.

This all boils down to: Only use ASCII characters in your translatable
strings!

=item B<dgettext TEXTDOMAIN, MSGID>

Like gettext(), but retrieves the message for the specified
B<TEXTDOMAIN> instead of the default domain.  In case you wonder what
a textdomain is, you should really read on with Locale::TextDomain(3).

=item B<dcgettext TEXTDOMAIN, MSGID, CATEGORY>

Like dgettext() but retrieves the message from the specified B<CATEGORY>
instead of the default category C<LC_MESSAGES>.

=item B<ngettext MSGID, MSGID_PLURAL, COUNT>

Retrieves the correct translation for B<COUNT> items.  In legacy software
you will often find something like:

    print "$count file(s) deleted.\n";

or

    printf "$count file%s deleted.\n", $count == 1 ? '' : 's';

The first example looks awkward, the second will only work in English
and languages with similar plural rules.  Before ngettext() was introduced,
the best practice for internationalized programs was:

    if ($count == 1) {
        print gettext "One file deleted.\n";
    } else {
        printf gettext "%d files deleted.\n";
    }

This is a nuisance for the programmer and often still not sufficient
for an adequate translation.  Many languages have completely different
ideas on numerals.  Some (French, Italian, ...) treat 0 and 1 alike,
others make no distinction at all (Japanese, Korean, Chinese, ...),
others have two or more plural forms (Russian, Latvian, Czech,
Polish, ...).  The solution is:

    printf (ngettext ("One file deleted.\n",
                     "%d files deleted.\n",
                     $count), # argument to ngettext!
            $count);          # argument to printf!

In English, or if no translation can be found, the first argument
(B<MSGID>) is picked if C<$count> is one, the second one otherwise.
For other languages, the correct plural form (of 1, 2, 3, 4, ...)
is automatically picked, too.  You don't have to know anything about
the plural rules in the target language, ngettext() will take care
of that.

This is most of the time sufficient but you will have to prove your
creativity in cases like

    printf "%d file(s) deleted, and %d file(s) created.\n";

=item B<dngettext TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT>

Like ngettext() but retrieves the translation from the specified
textdomain instead of the default domain.

=item B<dcngettext TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT, CATEGORY>

Like dngettext() but retrieves the translation from the specified
category, instead of the default category C<LC_MESSAGES>.

=item B<pgettext MSGCTXT, MSGID>

Returns the translation of MSGID, given the context of MSGCTXT.

Both items are used as a unique key into the message catalog.

This allows the translator to have two entries for words that may
translate to different foreign words based on their context. For
example, the word "View" may be a noun or a verb, which may be
used in a menu as File->View or View->Source.

    pgettext "Verb: To View", "View\n";
    pgettext "Noun: A View", "View\n";

The above will both lookup different entries in the message catalog.

A typical usage are GUI programs.  Imagine a program with a main
menu and the notorious "Open" entry in the "File" menu.  Now imagine,
there is another menu entry Preferences->Advanced->Policy where you have
a choice between the alternatives "Open" and "Closed".  In English, "Open"
is the adequate text at both places.  In other languages, it is very
likely that you need two different translations.  Therefore, you would
now write:

    pgettext "File|", "Open";
    pgettext "Preferences|Advanced|Policy", "Open";

In English, or if no translation can be found, the second argument
(MSGID) is returned.

The function was introduced with libintl-perl version 1.17.

=item B<dpgettext TEXTDOMAIN, MSGCTXT, MSGID>

Like pgettext(), but retrieves the message for the specified
B<TEXTDOMAIN> instead of the default domain.

The function was introduced with libintl-perl version 1.17.

=item B<dcpgettext TEXTDOMAIN, MSGCTXT, MSGID, CATEGORY>

Like dpgettext() but retrieves the message from the specified B<CATEGORY>
instead of the default category C<LC_MESSAGES>.

The function was introduced with libintl-perl version 1.17.

=item B<npgettext MSGCTXT, MSGID, MSGID_PLURAL, COUNT>

Like ngettext() with the addition of context as in pgettext().

In English, or if no translation can be found, the second argument
(MSGID) is picked if $count is one, the third one otherwise.

The function was introduced with libintl-perl version 1.17.

=item B<dnpgettext TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT>

Like npgettext() but retrieves the translation from the specified
textdomain instead of the default domain.

The function was introduced with libintl-perl version 1.17.

=item B<dcnpgettext TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT, CATEGORY>

Like dnpgettext() but retrieves the translation from the specified
category, instead of the default category C<LC_MESSAGES>.

The function was introduced with libintl-perl version 1.17.

=item B<textdomain TEXTDOMAIN>

Sets the default textdomain (initially 'messages').

=item B<bindtextdomain TEXTDOMAIN, DIRECTORY>

Binds B<TEXTDOMAIN> to B<DIRECTORY>.  Huh? An example:

    bindtextdomain "my-package", "./mylocale";

Say, the selected locale (actually the selected locale for category
C<LC_MESSAGES>) of the program is 'fr_CH', then the message catalog
will be expected in F<./mylocale/fr_CH/LC_MESSAGES/my-package.mo>.

=item B<bind_textdomain_codeset TEXTDOMAIN, ENCODING>

Sets the output encoding for B<TEXTDOMAIN> to B<ENCODING>.

=item B<bind_textdomain_filter TEXTDOMAN, CODEREF, DATA>

=item B<bind_textdomain_filter TEXTDOMAN, CODEREF>

By default, Locale::Messages will turn the utf-8 flag of all returned
messages off.  If you want to change this behavior, you can pass
a reference to a subroutine that does different things - for example
turn the utf-8 flag on, or leave it untouched.  The callback function
will be called with B<DATA> as the first, and the possibly
translated string as the second argument.  It should return the
possibly modified string.

If you want an object method to be called, pass the object itself
in the data parameter and write a wrapper function.  Example:

    sub wrapper {
        my ($string, $obj) = @_;

        $obj->filterMethod ($string);
    }
    my $obj = MyPackage->new;

    bind_textdomain_filter ('mydomain', \&wrapper, $obj);

The function cannot fail and always returns a true value.

B<Attention:> If you use the function for setting the utf-8 flag,
it is B<your> responsability to ensure that the output is really
utf-8.  You should only use it, if you have set the environment
variable B<OUTPUT_CHARSET> to "utf-8".  Additionally you should
call bind_textdomain_codeset() with "utf-8" as the second
argument.

This function has been introduced in libintl-perl 1.16 and it is
B<not> part of the standard gettext API.

=item B<turn_utf_8_on VARIABLE>

Returns VARIABLE but with the UTF-8 flag (only known in Perl >=5.6)
guaranteed to be turned on.  This function does not really fit into
the module, but it is often handy nevertheless.

The flag does B<not> mean that the string is in fact valid utf-8!

The function was introduced with libintl-perl version 1.16.

=item B<turn_utf_8_off VARIABLE>

Returns VARIABLE but with the UTF-8 flag (only known in Perl >=5.6)
guaranteed to be turned off.  This function does not really fit into
the module, but it is often handy nevertheless.

The function was introduced with libintl-perl version 1.07.

=item B<select_package PACKAGE>

By default, B<Locale::Messages> will try to load the XS version of
the gettext implementation, i. e. Locale::gettext_xs(3) and will fall
back to the pure Perl implementation Locale::gettext_pp(3).  You can
override this behavior by passing the string "gettext_pp" or
"gettext_xs" to the function select_package().  Passing "gettext_pp"
here, will prefer the pure Perl implementation.

You will normally want to use that in a BEGIN block of your main
script.

The function was introduced with libintl-perl version 1.03 and is not
part of the standard gettext API.

=item B<nl_putenv ENVSPEC>

Resembles the ANSI C putenv(3) function.  The sole purpose of this
function is to work around some ideosyncrasies in the environment
processing of Windows systems.  If you want to portably set or
unset environment variables, use this function instead of directly
manipulating C<%ENV>.

The argument B<ENVSPEC> may have three different forms.

=over 8

=item B<LANGUAGE=fr_CH>

This would set the environment variable C<LANGUAGE> to "fr_CH".

=item B<LANGUAGE=>

Normally, this will set the environment variable C<LANGUAGE> to an
empty string.  Under Windows, however, the environment variable will
be deleted instead (and is no longer present in C<%ENV>).  Since
within libintl-perl empty environment variables are useless, consider
this usage as deprecated.

=item B<LANGUAGE>

This will delete the environment variable B<LANGUAGE>.  If you are
familiar with the brain-damaged implementation of putenv(3) (resp.
_putenv()) in the so-called standard C library of MS-Windows, you
may suspect that this is an invalid argument.  This is not the case!
Passing a variable name not followed by an equal sign will always
delete the variable, no matter which operating system you use.

=back

The function returns true for success, and false for failure.  Possible
reasons for failure are an invalid syntax or - only under Windows -
failure to allocate space for the new environment entry ($! will be
set accordingly in this case).

Why all this hassle?  The 32-bit versions of MS-DOS (currently
Windows 95/98/ME/NT/2000/XP/CE/.NET) maintain two distinct blocks
of environment variables per process.  Which block is considered
the "correct" environment is a compile-time option of the Perl
interpreter.  Unfortunately, if you have build the XS version
Locale::gettext_xs(3) under Windows, the underlying library may use
a different environment block, and changes you make to C<%ENV> may
not be visible to the library.

The function nl_putenv() is mostly a funny way of saying

    LANGUAGE=some_value

but it does its best, to pass this information to the gettext
library.  Under other operating systems than Windows, it only
operates on C<%ENV>, under Windows it will call the C library
function _putenv() (after doing some cleanup to its arguments),
before manipulating C<%ENV>.

Please note, that you C<%ENV> is updated by nl_putenv() automatically.

The function has been introduced in libintl-perl version 1.10.

=back

=head1 CONSTANTS

You can (maybe) get the same constants from POSIX(3); see there for
a detailed description

=over 4

=item B<LC_CTYPE>

=item B<LC_NUMERIC>

=item B<LC_TIME>

=item B<LC_COLLATE>

=item B<LC_MONETARY>

=item B<LC_MESSAGES>

This locale category was the reason that these constants from POSIX(3)
were included here.  Even if it was present in your systems C include
file F<locale.h>, it was not provided by POSIX(3).  Perl 5.8 and later
seems to export the constant if available, although it is not documented
in POSIX(3).

Locale::Messages(3) makes an attempt to guess the value of this category for
all systems, and assumes the arbitrary value 1729 otherwise.

=item B<LC_ALL>

If you specify the category B<LC_ALL> as the first argument to
POSIX::setlocale(), I<all> locale categories will be affected at once.

=back

=head1 EXPORT TAGS

The module does not export anything unless explicitely requested.
You can import groups of functions via two tags:

=over 4

=item B<use Locale::Messages (':locale_h')>

Imports the functions that are normally defined in the C include
file F<locale.h>:

=over 8

=item B<gettext()>

=item B<dgettext()>

=item B<dcgettext()>

=item B<ngettext()>

=item B<dngettext()>

=item B<dcngettext()>

=item B<pgettext()>

=item B<dpgettext()>

=item B<dcpgettext()>

=item B<npgettext()>

=item B<dnpgettext()>

=item B<dcnpgettext()>

=item B<textdomain()>

=item B<bindtextdomain()>

=item B<bind_textdomain_codeset()>

=back

=item B<use Locale::Messages (':libintl_h')>

Imports the locale category constants:

=over 8

=item B<LC_CTYPE>

=item B<LC_NUMERIC>

=item B<LC_TIME>

=item B<LC_COLLATE>

=item B<LC_MONETARY>

=item B<LC_MESSAGES>

=item B<LC_ALL>

=back

=back

=head1 OTHER EXPORTS

=item B<select_package PACKAGE>

=head1 USAGE

A complete example:

    1: use Locale::Messages qw (:locale_h :libintl_h);
    2: use POSIX qw (setlocale);
    3: setlocale (LC_MESSAGES, '');
    4: textdomain ('my-package');
    5: bindtextdomain ('my-package' => '/usr/local/share/locale');
    6:
    7: print gettext ("Hello world!\n");

Step by step: Line 1 imports the necessary functions and constants.
In line 3 we set the locale for category LC_MESSAGES to the default
user settings.  For C programs you will often read that LC_ALL
is the best category here but this will also change the locale for
LC_NUMERIC and many programs will not work reliably after changing
that category in Perl; choose your own poison!

In line 4 we say that all messages (translations) without an explicit
domain specification should be retrieved from the message catalog
for the domain 'my-package'.  Line 5 has the effect that the message
catalog will be searched under the directory F</usr/local/share/locale>.

If the user has selected the locale 'fr_CH', and if the file
F</usr/local/share/locale/fr_CH/LC_MESSAGES/my-package.mo>
exists, and if it contains a GNU message object file with a translation
for the string "Hello world!\n", then line 7 will print the French
translation (for Switzerland CH) to STDOUT.

The documentation for GNU gettext explains how to extract translatable
strings from your Perl files and how to create message catalogs.

Another less portable example: If your system uses the GNU libc you
should be able to find various files with the name F<libc.mo>, the
message catalog for the library itself.  If you have found these
files under F</usr/share/locale>, then you can try the following:

    use Locale::Messages qw (:locale_h :libintl_h);
    use POSIX qw (setlocale);

    setlocale LC_MESSAGES, "";
    textdomain "libc";

    # The following is actually not needed, since this is
    # one of the default search directories.
    bindtextdomain libc => '/usr/share/locale';
    bind_textdomain_codeset libc => 'iso-8859-1';

    print gettext ("No such file or directory");

See Locale::TextDomain(3) for much simpler ways.

=head1 AUTHOR

Copyright (C) 2002-2009, Guido Flohr E<lt>guido@imperia.netE<gt>, all
rights reserved.  See the source code for details.

This software is contributed to the Perl community by Imperia
(L<http://www.imperia.net/>).

=head1 SEE ALSO

Locale::TextDomain(3pm), Locale::gettext_pp(3pm), Encode(3pm),
perllocale(3pm), POSIX(3pm), perl(1), gettext(1), gettext(3)

=cut

__END__

Local Variables:
mode: perl
perl-indent-level: 4
perl-continued-statement-offset: 4
perl-continued-brace-offset: 0
perl-brace-offset: -4
perl-brace-imaginary-offset: 0
perl-label-offset: -4
cperl-indent-level: 4
cperl-continued-statement-offset: 2
tab-width: 4
End: