The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Locale::Maketext::Pseudo - give localized code a pseudo language obj if a real one does not exist.

VERSION

This document describes Locale::Maketext::Pseudo version 0.6

SYNOPSIS

    use Locale::Maketext::Pseudo;

    # localized Class::Std based object

    my %lang;
    
    sub BUILD {
        my ($self, $ident, $arg_ref) = @_;
        $lang{ $ident } = ref $arg_ref->{'lang_obj'} && $arg_ref->{'lang_obj'}->can('maketext') 
            ? $arg_ref->{'lang_obj'} : Locale::Maketext::Pseudo->new();
            ...
    }

Or in your main app so you can get on with writing it and have $lang available and functioning

   # TODO: setup Locale::Maketext::Utils based Lexicon and make $lang out of it but for now:
   my $lang = Locale::Maketext::Pseudo->new(); 

DESCRIPTION

Localized software is more useable by more people. You should localize your code. Locale::Maketext has the easiest and best localization framework available IMHO, Local::Maketext::Utils adds more useablility utility methods (for example, it adds say(), get(), print(), and fetch() to name just a few) and should be used in software of any size.

In a perfect world your main program would make a language object and pass it as part of an object constructor so that output the module might have is localized too.

What is your excellently localized module to do if no valid langauge object is passed? Or what can you do while you're setting up your Lexicon and what not?

You fallback to a Pseudo object so that the calls to maketext() (or say(), get(), print(), or fetch() if you'll be using a Locale::Maketext::Utils obj) can be used and still get interpolated properly.

INTERFACE

FUNCTIONS

All are exportable, each takes the same args as the method of the same name (sans 'env_') and each uses $ENV{'maketext_obj'} if valid or it uses a Local::Maketext::Pseudo object.

env_maketext()

This will use $ENV{'maketext_obj'} if it can maketext, otherwise it uses the Pseudo method.

This is useful for languagifying, say, a module's carp()'ed errors without the module needing to know anythgin about the callers' langauge situation.

    local $ENV{'maketext_obj'} = MyLocale::Maketext::Utils->get_handle(@whatever) || '';
    use Locale::Maketext::Pseudo qw(env_maketext);
    
    my $obj = Fiddle->new({'lang_obj' => $ENV{'maketext_obj'} }); # now object uses same thing as function, see "OBJECT ORIENTED" below...  
    carp env_maketext('....', @whatever) if !$whatever;
env_fetch()
env_print()
env_get()
env_say()

OBJECT ORIENTED

new()

Take no arguments, just returns an object with access to the methods below.

The "Pseudo" idea is from the fact that the arguments are the same as the "pseudo"-ified method, the return value is the same as "pseudo"-ified method but no actual Lexicon magic is done. (IE it acts as a funtioning pseudo placeholder for a real language object.)

maketext()

Pseudo Locale::Maketext's maketext()

say()

Pseudo Locale::Maketext::Utils's say()

get()

Pseudo Locale::Maketext::Utils's get()

print()

Pseudo Locale::Maketext::Utils's print()

fetch()

Pseudo Locale::Maketext::Utils's fetch()

DIAGNOSTICS

Throws no warnings or exceptions of its own.

CONFIGURATION AND ENVIRONMENT

Locale::Maketext::Pseudo requires no configuration files and the foloowing environment variables:

$ENV{'maketext_obj'} gets set to the language object on initialization ( for functions to use, see "FUNCTIONS" above ) unless the 'skip_env' key is tru in new()'s hashref argument.

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

Special bracket notation for methods like '[quant,_1,file,files,No files] matched your query.' are simply left as is.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-locale-maketext-pseudo@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Daniel Muey <http://drmuey.com/cpan_contact.pl>

LICENCE AND COPYRIGHT

Copyright (c) 2007, Daniel Muey <http://drmuey.com/cpan_contact.pl>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.