| 1 | package Locale::Maketext::Lexicon::CatmanduConfig; | ||||||||||
| 2 | 1 | ▶ | use Catmandu::Sane; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use Catmandu; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Catmandu::Util qw(data_at :is); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Catmandu::Expander; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 8 | 2 | my ($self, $key) = @_; | |||||||||
| 9 | 2 | my $hash = Catmandu::Util::data_at( $key, Catmandu->config() ); | |||||||||
| 10 | 2 | ▶ | Catmandu::Expander->collapse_hash( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | is_hash_ref($hash) ? $hash : +{} | ||||||||||
| 12 | ); | ||||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 1 | 1; | |||||||||
| 16 | |||||||||||
| 17 | =head1 NAME | ||||||||||
| 18 | |||||||||||
| 19 | Locale::Maketext::Lexicon::CatmanduConfig - Use Catmandu config files as a Maketext lexicon | ||||||||||
| 20 | |||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||
| 22 | |||||||||||
| 23 | Catmandu->{config}->{locale} = { | ||||||||||
| 24 | en => { | ||||||||||
| 25 | hello => "Hello" | ||||||||||
| 26 | }, | ||||||||||
| 27 | _style => "gettext" | ||||||||||
| 28 | }; | ||||||||||
| 29 | |||||||||||
| 30 | package MyI18N; | ||||||||||
| 31 | use parent 'Locale::Maketext'; | ||||||||||
| 32 | use Locale::Maketext::Lexicon { | ||||||||||
| 33 | en => [ CatmanduConfig => ["locale.en"] ], | ||||||||||
| 34 | _style => "gettext" | ||||||||||
| 35 | }; | ||||||||||
| 36 | |||||||||||
| 37 | =head1 NOTES | ||||||||||
| 38 | |||||||||||
| 39 | * the value for CatmanduConfig is an array because L<Locale::Maketext::Lexicon> interprets regular strings as files (to be ignored) | ||||||||||
| 40 | |||||||||||
| 41 | * config parameter "_style" can be set to "gettext" to make use of placeholders like in L<Locale::Maketext::Lexicon::Gettext> | ||||||||||
| 42 | |||||||||||
| 43 | =cut | ||||||||||