Locale::Handle::Pluggable - L<MooseX::Types::VariantTable> based plugins for



NAME

Locale::Handle::Pluggable - the MooseX::Types::VariantTable manpage based plugins for the Locale::Maketext manpage.


VERSION

This code WILL change in the future.

Role support is still not available for the MooseX::Types::VariantTable manpage, and when that will be added (kinda tricky) everything will change from class based to role based.

Once that is in this shouldn't involve much more than s/extends/with/, but be aware that your code may break.


SYNOPSIS

    # create the localization factory class
    # see Locale::Maketext for details
        package MyProgram::L10N;
            use Moose;
    # define the factory class normally
    extends qw(Locale::Maketext);
    # or
    use Locale::Maketext::Lexicon { ... };
    # load some additional roles... uh i mean classes with variants for the loc() method
    extends qw(
        Locale::Maktext
    
        Locale::Maketext::Pluggable
        Locale::Maketext::Pluggable::DateTime
        Locale::Maketext::Pluggable::Foo
    );
    # in your language definitions, use Locale::Maketext's syntax for entries
    # For instance, to create a localized greeting with a date, the entries
    # might look like the following example. the second argument to %loc() is
    # the DateTime::Locale format symbolic format name
    # English:
    'Hello, it is now [loc, _1, "full_time"]'
    # in gettext style:
    'Hello, it is now %loc(%1, "full_time")'
    # Hebrew:
    'שלום, השעה [loc, _1, "medium_time"]'
    # And then use it like this:
    $handle->loc( $message_id, $datetime_object ); # the datetime object is in %1
    # this also works, since %loc is a method call on the language handle:
    $handle->loc( $datetime_object, "short_date" );
    
    =head1 DESCRIPTION
    

This class extends the the Locale::Maketext manpage api to provide a loc method, that attempts to be able to localize "anything", where "anything" is defined in the various plugin methods loaded.

The dispatch table for the various types is constructed using the MooseX::Types::VariantTable::Declare manpage, and each plugin can provide additional the Moose::Util::TypeConstraints manpage based extensions.


METHODS

loc $thing, @args

The variant table method.

Has an entry for Str.

loc_string $msgid, @args

Calls maketext.


TODO

This makes a lot more sense as roles, but the Moose::Meta::Role manpage is unable to support custom role merging of the MooseX::Types::VariantTable manpage yet.


AUTHOR

Yuval Kogman <nothingmuch@woobling.org>


COPYRIGHT

        Copyright (c) 2008 Infinity Interactive, Yuval Kogman. All rights
    reserved This program is free software; you can redistribute
        it and/or modify it under the same terms as Perl itself.
 Locale::Handle::Pluggable - L<MooseX::Types::VariantTable> based plugins for