1N/Apackage I18N::Langinfo;
1N/A
1N/Ause 5.006;
1N/Ause strict;
1N/Ause warnings;
1N/Ause Carp;
1N/A
1N/Arequire Exporter;
1N/Arequire DynaLoader;
1N/Ause AutoLoader;
1N/A
1N/Aour @ISA = qw(Exporter DynaLoader);
1N/A
1N/Aour @EXPORT = qw(langinfo);
1N/A
1N/Aour @EXPORT_OK = qw(
1N/A ABDAY_1
1N/A ABDAY_2
1N/A ABDAY_3
1N/A ABDAY_4
1N/A ABDAY_5
1N/A ABDAY_6
1N/A ABDAY_7
1N/A ABMON_1
1N/A ABMON_10
1N/A ABMON_11
1N/A ABMON_12
1N/A ABMON_2
1N/A ABMON_3
1N/A ABMON_4
1N/A ABMON_5
1N/A ABMON_6
1N/A ABMON_7
1N/A ABMON_8
1N/A ABMON_9
1N/A ALT_DIGITS
1N/A AM_STR
1N/A CODESET
1N/A CRNCYSTR
1N/A DAY_1
1N/A DAY_2
1N/A DAY_3
1N/A DAY_4
1N/A DAY_5
1N/A DAY_6
1N/A DAY_7
1N/A D_FMT
1N/A D_T_FMT
1N/A ERA
1N/A ERA_D_FMT
1N/A ERA_D_T_FMT
1N/A ERA_T_FMT
1N/A MON_1
1N/A MON_10
1N/A MON_11
1N/A MON_12
1N/A MON_2
1N/A MON_3
1N/A MON_4
1N/A MON_5
1N/A MON_6
1N/A MON_7
1N/A MON_8
1N/A MON_9
1N/A NOEXPR
1N/A NOSTR
1N/A PM_STR
1N/A RADIXCHAR
1N/A THOUSEP
1N/A T_FMT
1N/A T_FMT_AMPM
1N/A YESEXPR
1N/A YESSTR
1N/A);
1N/A
1N/Aour $VERSION = '0.02';
1N/A
1N/Asub AUTOLOAD {
1N/A # This AUTOLOAD is used to 'autoload' constants from the constant()
1N/A # XS function.
1N/A
1N/A my $constname;
1N/A our $AUTOLOAD;
1N/A ($constname = $AUTOLOAD) =~ s/.*:://;
1N/A croak "&I18N::Langinfo::constant not defined" if $constname eq 'constant';
1N/A my ($error, $val) = constant($constname);
1N/A if ($error) { croak $error; }
1N/A {
1N/A no strict 'refs';
1N/A # Fixed between 5.005_53 and 5.005_61
1N/A#XXX if ($] >= 5.00561) {
1N/A#XXX *$AUTOLOAD = sub () { $val };
1N/A#XXX }
1N/A#XXX else {
1N/A *$AUTOLOAD = sub { $val };
1N/A#XXX }
1N/A }
1N/A goto &$AUTOLOAD;
1N/A}
1N/A
1N/Abootstrap I18N::Langinfo $VERSION;
1N/A
1N/A1;
1N/A__END__
1N/A
1N/A=head1 NAME
1N/A
1N/AI18N::Langinfo - query locale information
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use I18N::Langinfo;
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThe langinfo() function queries various locale information that can be
1N/Aused to localize output and user interfaces. The langinfo() requires
1N/Aone numeric argument that identifies the locale constant to query:
1N/Aif no argument is supplied, C<$_> is used. The numeric constants
1N/Aappropriate to be used as arguments are exportable from I18N::Langinfo.
1N/A
1N/AThe following example will import the langinfo() function itself and
1N/Athree constants to be used as arguments to langinfo(): a constant for
1N/Athe abbreviated first day of the week (the numbering starts from
1N/ASunday = 1) and two more constants for the affirmative and negative
1N/Aanswers for a yes/no question in the current locale.
1N/A
1N/A use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR);
1N/A
1N/A my ($abday_1, $yesstr, $nostr) = map { langinfo } qw(ABDAY_1 YESSTR NOSTR);
1N/A
1N/A print "$abday_1? [$yesstr/$nostr] ";
1N/A
1N/AIn other words, in the "C" (or English) locale the above will probably
1N/Aprint something like:
1N/A
1N/A Sun? [yes/no]
1N/A
1N/Abut under a French locale
1N/A
1N/A dim? [oui/non]
1N/A
1N/AThe usually available constants are
1N/A
1N/A ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7
1N/A ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6
1N/A ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12
1N/A DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7
1N/A MON_1 MON_2 MON_3 MON_4 MON_5 MON_6
1N/A MON_7 MON_8 MON_9 MON_10 MON_11 MON_12
1N/A
1N/Afor abbreviated and full length days of the week and months of the year,
1N/A
1N/A D_T_FMT D_FMT T_FMT
1N/A
1N/Afor the date-time, date, and time formats used by the strftime() function
1N/A(see L<POSIX>)
1N/A
1N/A AM_STR PM_STR T_FMT_AMPM
1N/A
1N/Afor the locales for which it makes sense to have ante meridiem and post
1N/Ameridiem time formats,
1N/A
1N/A CODESET CRNCYSTR RADIXCHAR
1N/A
1N/Afor the character code set being used (such as "ISO8859-1", "cp850",
1N/A"koi8-r", "sjis", "utf8", etc.), for the currency string, for the
1N/Aradix character used between the integer and the fractional part
1N/Aof decimal numbers (yes, this is redundant with POSIX::localeconv())
1N/A
1N/A YESSTR YESEXPR NOSTR NOEXPR
1N/A
1N/Afor the affirmative and negative responses and expressions, and
1N/A
1N/A ERA ERA_D_FMT ERA_D_T_FMT ERA_T_FMT
1N/A
1N/Afor the Japanese Emperor eras (naturally only defined under Japanese locales).
1N/A
1N/ASee your L<langinfo(3)> for more information about the available
1N/Aconstants. (Often this means having to look directly at the
1N/AF<langinfo.h> C header file.)
1N/A
1N/ANote that unfortunately none of the above constants are guaranteed
1N/Ato be available on a particular platform. To be on the safe side
1N/Ayou can wrap the import in an eval like this:
1N/A
1N/A eval {
1N/A require I18N::Langinfo;
1N/A I18N::Langinfo->import(qw(langinfo CODESET));
1N/A $codeset = langinfo(CODESET()); # note the ()
1N/A };
1N/A if (!$@) { ... failed ... }
1N/A
1N/A=head2 EXPORT
1N/A
1N/ANothing is exported by default.
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/AL<perllocale>, L<POSIX/localeconv>, L<POSIX/setlocale>, L<nl_langinfo(3)>.
1N/A
1N/AThe langinfo() is just a wrapper for the C nl_langinfo() interface.
1N/A
1N/A=head1 AUTHOR
1N/A
1N/AJarkko Hietaniemi, E<lt>jhi@hut.fiE<gt>
1N/A
1N/A=head1 COPYRIGHT AND LICENSE
1N/A
1N/ACopyright 2001 by Jarkko Hietaniemi
1N/A
1N/AThis library is free software; you can redistribute it and/or modify
1N/Ait under the same terms as Perl itself.
1N/A
1N/A=cut