Linux SoftwareProgrammingLibrariesLocale::KeyedText 1.73.0

Locale::KeyedText 1.73.0


Locale::KeyedText is a Perl module that refers to user messages in programs by keys. It also describes the same-number versions of
Developer:   Darren R. Duncan
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   34K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


Locale::KeyedText is a Perl module that refers to user messages in programs by keys.

It also describes the same-number versions of Locale::KeyedText::Message ("Message") and Locale::KeyedText::Translator ("Translator").

Note that the "Locale::KeyedText" package serves only as the name-sake representative for this whole file, which can be referenced as a unit by documentation or 'use' statements or Perl archive indexes. Aside from 'use' statements, you should never refer directly to "Locale::KeyedText" in your code; instead refer to other above-named packages in this file.

SYNOPSIS

use Locale::KeyedText;

main();

sub main {
# Create a translator.
my $translator = Locale::KeyedText::Translator->new({
'set_names' => ['MyLib::Lang::', 'MyApp::Lang::'],
# set package prefixes for localized app components
'member_names' => ['Eng', 'Fr', 'De', 'Esp'],
# set list of available languages in order of preference
});

# This will print 'Enter 2 Numbers' in the first of the four
# languages that has a matching template available.
print $translator->translate_message(
Locale::KeyedText::Message->new({
'msg_key' => 'MYAPP_PROMPT' }) );

# Read two numbers from the user.
my ($first, $second) = ;

# Print a statement giving the operands and their sum.
MyLib->add_two( $first, $second, $translator );
}

package MyLib; # module

sub add_two {
my (undef, $first, $second, $translator) = @_;
my $sum = $first + $second;

# This will print ' plus equals ' in
# the first possible language. For example, if the user
# inputs '3' and '4', it the output will be '3 plus 4 equals 7'.
print $translator->translate_message(
Locale::KeyedText::Message->new({ 'msg_key' => 'MYLIB_RESULT',
'msg_vars' => { 'FIRST' => $first, 'SECOND' => $second,
'RESULT' => $sum } }) );
}

Many times during a program's operation, the program (or a package it uses) will need to display a message to the user, or generate a message to be shown to the user. Sometimes this is an error message of some kind, but it could also be a prompt or response message for interactive systems.

If the program or any of its components are intended for widespread use then it needs to account for a variance of needs between its different users, such as their preferred language of communication, or their privileges regarding access to information details, or their technical skills. For example, a native French or Chinese speaker often prefers to communicate in those languages. Or, when viewing an error message, the application's developer should see more details than joe public would.

Alternately, sometimes a program will raise a condition or error that, while resembling a message that would be shown to a user, is in fact meant to be interpreted by the machine itself and not any human user. In some situations, a shared program component may raise such a condition, and one application may handle it internally, while another one displays it to the user instead.

Locale::KeyedText provides a simple but effective mechanism for applications and packages that empowers single binaries to support N locales or user types simultaneously, and that allows any end users to add support for new languages easily and without a recompile (such as by simply copying files), often even while the program is executing.

Locale::KeyedText gives your application the maximum amount of control as to what the user sees; it never outputs anything by itself to the user, but rather returns its results for calling code to output as it sees fit. It also does not make direct use of environment variables, which can aid in portability.

Practically speaking, Locale::KeyedText doesn't actually do a lot internally; it exists mainly to document a certain localization methodology in an easily accessable manner, such that would not be possible if its functionality was subsumed into a larger package that would otherwise use it. Hereafter, if any other package or application says that it uses Locale::KeyedText, that is a terse way of saying that it subscribes to the localization methodology that is described here, and hence provides these benefits to developers and users alike.

For some practical examples of Locale::KeyedText in use, see the /examples directory of this distribution. Or, see my dependent CPAN packages whose problem domain is databases and/or SQL.

Requirements:
  • Perl
    tags locale keyedtext  the user  first second  the program  that would  keyedtext message  add two  localization methodology  second translator  msg key  for example  error message  message locale  

    Download Locale::KeyedText 1.73.0


     http://ftp.casaafacerilor.ro/mirrors/CPAN/authors/id/D/DU/DUNCAND/Locale-KeyedText-v1.73.0.tar.gz


    Authors software

    CGI::Portable 0.51 (by Darren R. Duncan)
    CGI::Portable is a framework for server-generic web apps.

    SYNOPSIS

    Content of thin shell "startup_cgi.pl" for CGI or Apache::Re

    SQL::Routine::Language 0.70.3 (by Darren R. Duncan)
    SQL::Routine::Language is a Perl module for what language or grammar SQL::Routine speaks.

    SQL::Routine contains SQL schemas and qu

    Locale::KeyedText 1.73.0 (by Darren R. Duncan)
    Locale::KeyedText is a Perl module that refers to user messages in programs by keys.

    It also describes the same-number versions of

    Rosetta::TODO 0.724.0 (by Darren R. Duncan)
    Rosetta::TODO document maps out a rough development plan the Rosetta DBMS framework, so you know in roughly what order I plan to impl


    Similar software

    Locale::KeyedText 1.73.0 (by Darren R. Duncan)
    Locale::KeyedText is a Perl module that refers to user messages in programs by keys.

    It also describes the same-number versions of

    Locale::Object::Currency::Converter 0.74 (by ^Earle Martin)

    libintl-perl 1.16 (by Guido Flohr)
    libintl-perl is a library that supports message translation for Perl, written in pure Perl (version 5.004 or better)

    Locale Switcher 2.0 for Firefox (by Benjamin Smedberg)
    Locale Switcher extension provides simple way to switch between languages through a menu.

    The default UI for Firefox does not prov

    SQL::Translator::Producer::GraphViz 0.07 (by Ken Y. Clark)
    SQL::Translator::Producer::GraphViz is a GraphViz producer for SQL::Translator.

    SYNOPSIS

    use SQL::Translator;

    my $trans

    FLP-i18n 2.1b2 (by flaimo)
    i18n is a collection of PHP classes for managing multilanguage webpages

    Locale files for South Africa 0.3 (by Dwayne Bailey)
    Locale files for South Africa are scripts to aid in localization of software

    Locale::SubCountry 1.37 (by Kim Ryan)
    Locale::SubCountry is a Perl module that can convert state, province, county etc

    Locale::RecodeData::IBM918 1.16 (by Guido Flohr)
    Locale::RecodeData::IBM918 are conversion routines for IBM918.

    SYNOPSIS

    This module is internal to libintl

    SQL::Translator::Manual 0.07 (by Ken Y. Clark)
    SQL::Translator::Manual is a Perl module that contains a manual for SQL translator.

    SYNOPSIS

    SQL::Translator (AKA "SQLFairy") i


    Other software in this category

    zlib 1.2.3 (by Jean-loup Gailly)
    zlib is designed to be a free, general-purpose, legally unencumbered, lossless data-compression library for use on virtually any comp

    libjpeg v6b (by Independent JPEG Group)
    libjpeg is a library for handling the JPEG (JFIF) image format

    OpenSSL 0.9.7c (by The OpenSSL Project Team)
    The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implement

    libxml2 2.6.27 (by DV)
    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), libxml2 library i

    GNU C library 2.4 (by Andreas Jaeger)
    GNU C library (glibc) is one of the most important components of GNU Hurd and most modern Linux distributions.

    GNU C library is us

  •     search


    Featured Software

    jEdit 4.3 pre8
    jEdit is an Open Source text editor written in Java

    Opera 9.02
    Surf the Internet in a safer, faster, and easier way with Opera browser

    GNU Aspell 0.60.4
    GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


    Subscribe in Rojo
    Google Reader
    Add to My Yahoo!

    Add to My AOL
    Subscribe with Bloglines
    Subscribe in NewsGator Online
    Add 'nixbit linux software' to Newsburst from CNET News.com
    del.icio.us nixbit linux software


    Top tags