our @ISA = qw(Exporter DynaLoader);
+our @EXPORT = qw(langinfo);
+
our @EXPORT_OK = qw(
- langinfo
ABDAY_1
ABDAY_2
ABDAY_3
=head1 DESCRIPTION
-The langinfo() function queries various locale information that
-can be used to localize output and user interfaces.
+The langinfo() function queries various locale information that can be
+used to localize output and user interfaces. The langinfo() requires
+one numeric argument that identifies the locale constant to query:
+if no argument is supplied, C<$_> is used. The numeric constants
+appropriate to be used as arguments are exportable from I18N::Langinfo.
-The following example will import the langinfo() function itself
-(implicitly) and (explicitly) three constants to be used as arguments
-to langinfo(): a constant for the abbreviated first day of the week (the
-numbering starts from Sunday 1) and two more constant for the affirmative
-and negative answers for a yes/no question in the current locale.
+The following example will import the langinfo() function itself and
+three constants to be used as arguments to langinfo(): a constant for
+the abbreviated first day of the week (the numbering starts from
+Sunday = 1) and two more constants for the affirmative and negative
+answers for a yes/no question in the current locale.
use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR);
print "$abday_1? [$yesstr/$nostr] ";
-In other words, in the "C" (or English) locale the above will probably print:
+In other words, in the "C" (or English) locale the above will probably
+print something like:
- Sun? [y/n]
+ Sun? [yes/no]
The usually available constants are
for the affirmative and negative responses and expressions, and
- ERA ERA_D_FMT ERA_D_T_FMT ETA_T_FMT
+ ERA ERA_D_FMT ERA_D_T_FMT ERA_T_FMT
for the Japanese Emperor eras (naturally only defined under Japanese locales).
}
print "\n";
-=head2 I18::Langinfo
+=head2 I18N::Langinfo
Another interface for querying locale-dependent information is the
I18N::Langinfo::langinfo() function, available at least in UNIX-like
systems and VMS.
-The following example will import the langinfo() function itself
-(implicitly) and (explicitly) three string constants: a string for the
-abbreviated first day of the week (the numbering starts from Sunday =
-1) and two strings for the affirmative and negative answers for a
-yes/no question in the current locale.
+The following example will import the langinfo() function itself and
+three constants to be used as arguments to langinfo(): a constant for
+the abbreviated first day of the week (the numbering starts from
+Sunday = 1) and two more constants for the affirmative and negative
+answers for a yes/no question in the current locale.
- use I18N::Langinfo qw(ABDAY_1 YESSTR NOSTR);
+ use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR);
- print ABDAY_1, "? [", YESSTR, "/", NOSTR, "] ";
+ my ($abday_1, $yesstr, $nostr) = map { langinfo } qw(ABDAY_1 YESSTR NOSTR);
-In other words, in the "C" (or English) locale the above will print:
+ print "$abday_1? [$yesstr/$nostr] ";
- Sun? [y/n]
+In other words, in the "C" (or English) locale the above will probably
+print something like:
+
+ Sun? [yes/no]
See L<I18N::Langinfo> for more information.