Softpedia
 


LINUX CATEGORIES:



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

    Locale::MakePhrase::BackingStore 0.5

    Download button

    No screenshots available
    Downloads: 310  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.6/5)
    3 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Mathew Robertson | More programs
    Perl Artistic License / FREE
    October 13th, 2007, 03:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Locale::MakePhrase::BackingStore description

    Locale::MakePhrase::BackingStore is a base-class of the backing store functionality.

    Locale::MakePhrase::BackingStore is a base-class of the backing store functionality.

    This is a base-class, of storage-specific implementations for the Locale::MakePhrase module.

    The backing-store may choose to implement seperate files for each language, or a single file for all languages. It may choose to implement database lookup... and so on.

    This base class implements a generic implementation, which can be used as a starting point. You should also look at Locale::MakePhrase::BackingStore:: for more examples.

    Locale::MakePhrase implements the following backing stores:
    Single file for all languages (see backing store: File)
    Files stored within a directory (see backing store: Directory)

    Generic database table (see backing store: Database)
    PostgreSQL database table (see backing store: Database::PostgreSQL)

    Alternatively, you could implement an application specific backing store by doing the following:

    Make a package which derives from this class.

    Implement the init() method, retrieving any options that may have been supplied to the constructor.

    Overload the get_rules() method, returning a list-reference of Locale::MakePhrase::LanguageRule objects, from the translations available from your backing store.

    For an implementation which uses a text file, this could mean that you would load the text file if it has changed, constructing the rule objects during the load, then return a list-reference of objects which match the request.

    For a database implementation, you would need to query the database for translations which match the request, then construct rule objects from those translations.

    API

    The following methods are implemented:

    new()

    Construct a backing store instance; arguments are passed to the init() method.

    $self init([...])

    Allow sub-class to control construction. The sub-class must return itself, so as to make construction succeed.

    @rule_objs get_rules($context,$key,@languages)

    Returns a list-reference of rule objects which have just been retrieved from the storage mechanism. The objects will have been based on the values of the $context (which is a stringified version of whatever get passed to context_translate or a value of undef), the $key (which is your application text string) and the language tags that Locale::MakePhrase determined for this instance.

    Since this is a base class, you need to supply a real implementation, although you can still use Locale::MakePhrase with this minimal implementation, so as to allow you to continue application development.

    $rule_obj make_rule()

    This is a helper routine for making a LanguageRule object. ie: you would use it like this, within your get_rules() method:

    sub get_rules {
    ...
    my $rule_obj = $self->make_rule(
    key => $key,
    language => $lang,
    expression => $expression,
    priority => $priority,
    translation => $translation,
    );
    ...
    }

    Thus, it takes a hash or hash_ref with the options: key, language, expression, priority and translation

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    backing store | MakePhrase locale | Perl module | backing | store | MakePhrase

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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