-# Time-stamp: "2001-05-25 07:50:08 MDT"
+# Time-stamp: "2004-01-11 18:35:34 AST"
=head1 NAME
-Locale::Maketext -- framework for localization
+Locale::Maketext - framework for localization
=head1 SYNOPSIS
YourProjClass->fallback_language_classes(). Then in the (probably
quite unlikely) event that that fails, we just return undef.
-=item *
+=item *
$lh = YourProjClass->get_handleB<()> || die "lg-handle?";
Otherwise (i.e., if not a CGI), this tries various OS-specific ways
to get the language-tags for the current locale/language, and then
-pretends that those were the value(s) passed to C<cet_handle>.
+pretends that those were the value(s) passed to C<get_handle>.
Currently this OS-specific stuff consists of looking in the environment
variables "LANG" and "LANGUAGE"; and on MSWin machines (where those
return $lh;
}
-=item $lh = YourProjClass::langname->new();
+=item *
+
+$lh = YourProjClass::langname->new();
This constructs a language handle. You usually B<don't> call this
directly, but instead let C<get_handle> find a language class to C<use>
and to then call ->new on.
-=item $lh->init();
+=item *
+
+$lh->init();
This is called by ->new to initialize newly-constructed language handles.
If you define an init method in your class, remember that it's usually
beginning), so that all classes get a chance to initialize a new object
however they see fit.
-=item YourProjClass->fallback_languages()
+=item *
+
+YourProjClass->fallback_languages()
C<get_handle> appends the return value of this to the end of
whatever list of languages you pass C<get_handle>. Unless
handle (assuming your language classes are in an appropriate
@INC directory). Or you can use the next method:
-=item YourProjClass->fallback_language_classes()
+=item *
+
+YourProjClass->fallback_language_classes()
C<get_handle> appends the return value of this to the end
of the list of classes it will try using. Unless
"Your search matched [quant,_1,document]!"
It's for I<quantifying> a noun (i.e., saying how much of it there is,
-while giving the currect form of it). The behavior of this method is
+while giving the correct form of it). The behavior of this method is
handy for English and a few other Western European languages, and you
should override it for languages where it's not suitable. You can feel
free to read the source, but the current implementation is basically
C<"...[quant,_1,file]..."> is fine (for 0 it returns "0 files",
for 1 it returns "1 file", and for more it returns "2 files", etc.)
-But for "directory", you'd want C<"[quant,_1,direcory,directories]">
+But for "directory", you'd want C<"[quant,_1,directory,directories]">
so that our elementary C<quant> method doesn't think that the
plural of "directory" is "directorys". And you might find that the
output may sound better if you specify a negative form, as in:
While the key must be a string value (since that's a basic
restriction that Perl places on hash keys), the value in
-the lexicon can currenly be of several types:
+the lexicon can currently be of several types:
a defined scalar, scalarref, or coderef. The use of these is
explained above, in the section 'The "maketext" Method', and
Bracket Notation for strings is discussed in the next section.
I often just use a key "_USAGE_MESSAGE". At that point I then go
and immediately to define that lexicon entry in the
ProjectClass::L10N::en lexicon (since English is always my "project
-lanuage"):
+language"):
'_USAGE_MESSAGE' => <<'EOSTUFF',
...long long message...
=item *
+If the first item in a bracket group is "*", it's taken as shorthand
+for the so commonly called "quant" method. Similarly, if the first
+item in a bracket group is "#", it's taken to be shorthand for
+"numf".
+
+=item *
+
If the first item in a bracket group is empty-string, or "_*"
or "_I<digits>" or "_-I<digits>", then that group is interpreted
as just the interpolation of all its items:
),
Examples: "[_1]" and "[,_1]", which are synonymous; and
-"[,ID-(,_4,-,_2,)]", which compiles as
+"C<[,ID-(,_4,-,_2,)]>", which compiles as
C<join "", "ID-(", $_[4], "-", $_[2], ")">.
=item *
Currently, an unescaped "~" before a character
other than a bracket or a comma is taken to mean just a "~" and that
-charecter. I.e., "~X" means the same as "~~X" -- i.e., one literal tilde,
+character. I.e., "~X" means the same as "~~X" -- i.e., one literal tilde,
and then one literal "X". However, by using "~X", you are assuming that
no future version of Maketext will use "~X" as a magic escape sequence.
In practice this is not a great problem, since first off you can just
S<eval { }>. However, I want programmers to reserve the right (via
the "fail" attribute) to treat lookup failure as something other than
an exception of the same level of severity as a config file being
-unreadable, or some essential resource being inaccessable.
+unreadable, or some essential resource being inaccessible.
One possibly useful value for the "fail" attribute is the method name
"failure_handler_auto". This is a method defined in class
language, so that you can override the C<numf> method as
appropriate. Typical variables in number formatting are: what to
use as a decimal point (comma? period?); what to use as a thousands
-separator (space? nonbreakinng space? comma? period? small
+separator (space? nonbreaking space? comma? period? small
middot? prime? apostrophe?); and even whether the so-called "thousands
separator" is actually for every third digit -- I've heard reports of
-two hundred thousand being expressable as "2,00,000" for some Indian
+two hundred thousand being expressible as "2,00,000" for some Indian
(Subcontinental) languages, besides the less surprising "S<200 000>",
"200.000", "200,000", and "200'000". Also, using a set of numeral
glyphs other than the usual ASCII "0"-"9" might be appreciated, as via
message catalogs that are just databases of sprintf formats.
L<File::Findgrep|File::Findgrep> is a sample application/module
-that uses Locale::Maketext to localize its messages.
+that uses Locale::Maketext to localize its messages. For a larger
+internationalized system, see also L<Apache::MP3>.
L<I18N::LangTags|I18N::LangTags>.
=head1 COPYRIGHT AND DISCLAIMER
-Copyright (c) 1999-2001 Sean M. Burke. All rights reserved.
+Copyright (c) 1999-2004 Sean M. Burke. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Sean M. Burke C<sburke@cpan.org>
=cut
-
-# Zing!