Locale::Maketext

Locale::Maketext is a Perl framework for localization.
Download

Locale::Maketext Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sean M. Burke
  • Publisher web site:
  • http://search.cpan.org/~sburke/

Locale::Maketext Tags


Locale::Maketext Description

Locale::Maketext is a Perl framework for localization. Locale::Maketext is a Perl framework for localization.SYNOPSIS package MyProgram; use strict; use MyProgram::L10N; # ...which inherits from Locale::Maketext my $lh = MyProgram::L10N->get_handle() || die "What language?"; ... # And then any messages your program emits, like: warn $lh->maketext( "Can't open file : n", $f, $! ); ...It is a common feature of applications (whether run directly, or via the Web) for them to be "localized" -- i.e., for them to a present an English interface to an English-speaker, a German interface to a German-speaker, and so on for all languages it's programmed with. Locale::Maketext is a framework for software localization; it provides you with the tools for organizing and accessing the bits of text and text-processing code that you need for producing localized applications.In order to make sense of Maketext and how all its components fit together, you should probably go read Locale::Maketext::TPJ13, and then read the following documentation.You may also want to read over the source for File::Findgrep and its constituent modules -- they are a complete (if small) example application that uses Maketext.QUICK OVERVIEWThe basic design of Locale::Maketext is object-oriented, and Locale::Maketext is an abstract base class, from which you derive a "project class". The project class (with a name like "TkBocciBall::Localize", which you then use in your module) is in turn the base class for all the "language classes" for your project (with names "TkBocciBall::Localize::it", "TkBocciBall::Localize::en", "TkBocciBall::Localize::fr", etc.).A language class is a class containing a lexicon of phrases as class data, and possibly also some methods that are of use in interpreting phrases in the lexicon, or otherwise dealing with text in that language.An object belonging to a language class is called a "language handle"; it's typically a flyweight object.The normal course of action is to call: use TkBocciBall::Localize; # the localization project class $lh = TkBocciBall::Localize->get_handle(); # Depending on the user's locale, etc., this will # make a language handle from among the classes available, # and any defaults that you declare. die "Couldn't make a language handle??" unless $lh;From then on, you use the maketext function to access entries in whatever lexicon(s) belong to the language handle you got. So, this: print $lh->maketext("You won!"), "n";...emits the right text for this language. If the object in $lh belongs to class "TkBocciBall::Localize::fr" and %TkBocciBall::Localize::fr::Lexicon contains ("You won!" => "Tu as gagn!"), then the above code happily tells the user "Tu as gagn!". Requirements: · Perl


Locale::Maketext Related Software