Locale/Maketext/Lexicon/CatmanduConfig.pm

filter: Statementstmt 100% 16 / 16 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 91.6% 22 / 24 CC 2 SCAR 3.0
CC
2
Cov
94%
parse
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Catmandu/I18N.pm ↑ Summary Catmandu/Fix/i18n.pm »
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
BranchTrueFalseTotal
is_hash_ref($hash) ? : 2 0 2
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
« Catmandu/I18N.pm ↑ Summary Catmandu/Fix/i18n.pm »