Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Locale::Maketext 1.22

    Download button

    No screenshots available
    Downloads: 305  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Sean M. Burke | More programs
    Perl Artistic License / FREE
    January 19th, 2012, 06:57 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Locale::Maketext description

    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 [_1]: [_2]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 OVERVIEW

    The 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�!".

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Perl framework | localization class | Perl module | Perl | framework | localization

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM