Locale::TextDomain::OO::Singleton::Lexicon - Provides singleton lexicon access
$Id: Lexicon.pm 698 2017-09-28 05:21:05Z steffenw $
$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Singleton/Lexicon.pm $
1.031
This module provides the singleton lexicon access for Locale::TextDomain:OO.
use Locale::TextDomain::OO::Singleton::Lexicon; $lexicon_data = Locale::TextDomain::OO::Singleton::Lexicon->instance->data;
exists but makes no sense
see SYNOPSIS
Get back the lexicon hash reference to fill the lexicon or to read from lexicon.
$lexicon_data = Locale::TextDomain::OO::Singleton::Lexicon->instance->data;
Merge ist mostly used to join data of a language to create data for a region with some region different data.
The example means: Take 'de::' and overwrite with specials of 'de-at::' and store as 'de-at::'.
$instance->merge_lexicon('de::', 'de-at::', 'de-at::');
Maybe more clear writing:
$instance->merge_lexicon('de::', 'de-at::' => 'de-at::');
Copy a lexicon is a special case. It is like merge without the 2nd parameter.
$instance->copy_lexicon('i-default::', 'i-default:LC_MESSAGES:domain');
$instance->copy_lexicon('i-default::' => 'i-default:LC_MESSAGES:domain');
Move is typical used to move the "i-default::" lexicon into your domain and category. Using a lexicon without messages you are able to translate because the header with plural forms is set. With no lexicon you would get a missing "plural forms"-error during translation.
$instance->move_lexicon('i-default::', 'i-default:LC_MESSAGES:domain');
$instance->move_lexicon('i-default::' => 'i-default:LC_MESSAGES:domain');
Delete a lexicon from data.
$deleted_lexicon = $instance->delete_lexicon('de::');
Set the logger and get back them
$lexicon_hash->logger( sub { my ($message, $arg_ref) = @_; my $type = $arg_ref->{type}; $log->$type($message); return; }, ); $logger = $lexicon_hash->logger;
$arg_ref contains
object => $lexicon_hash, # the object itself type => 'debug', event => 'lexicon,merge', # or 'lexicon,copy' # or 'lexicon,move' # or 'lexicon,delete'
Inside of this distribution is a directory named example. Run this *.pl files.
confess
none
Carp
Moo
MooX::StrictConstructor
namespace::autoclean
Locale::TextDomain::OO::Role::Logger
MooX::Singleton
not known
Locale::TextDoamin::OO
Steffen Winkler
Copyright (c) 2013 - 2017, Steffen Winkler <steffenw at cpan.org>. All rights reserved.
<steffenw at cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Locale::TextDomain::OO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Locale::TextDomain::OO
CPAN shell
perl -MCPAN -e shell install Locale::TextDomain::OO
For more information on module installation, please visit the detailed CPAN module installation guide.