| 1 | #! /bin/false | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Copyright (C) 2016-2018 Guido Flohr <guido.flohr@cantanea.com>, | ||||||||||||||||||||||||||||
| 4 | # all rights reserved. | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 7 | # under the terms of the GNU Library General Public License as published | ||||||||||||||||||||||||||||
| 8 | # by the Free Software Foundation; either version 2, or (at your option) | ||||||||||||||||||||||||||||
| 9 | # any later version. | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||||
| 14 | # Library General Public License for more details. | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # You should have received a copy of the GNU Library General Public | ||||||||||||||||||||||||||||
| 17 | # License along with this program; if not, write to the Free Software | ||||||||||||||||||||||||||||
| 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||||||||||||||||||||||||||||
| 19 | # USA. | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # ABSTRACT: Gettext Support For the Template Toolkit Version 2 | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | package Template::Plugin::Gettext; | ||||||||||||||||||||||||||||
| 24 | 5 | $Template::Plugin::Gettext::VERSION = '0.8'; | |||||||||||||||||||||||||||
| 25 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 5 | ▶ | use Locale::TextDomain 1.30 qw(com.cantanea.Template-Plugin-Gettext); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 5 | ▶ | use Locale::Messages; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use Locale::Util qw(web_set_locale); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 5 | ▶ | use Encode; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 5 | ▶ | use Cwd qw(abs_path); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 5 | ▶ | use base qw(Template::Plugin); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 5 | my %bound_dirs; | |||||||||||||||||||||||||||
| 37 | my %textdomains; | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 5 | our @DEFAULT_DIRS; | |||||||||||||||||||||||||||
| 40 | 5 | our @LOCALE_DIRS; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub __find_domain($); | ||||||||||||||||||||||||||||
| 43 | sub __expand($%); | ||||||||||||||||||||||||||||
| 44 | sub __fixup; | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | BEGIN { | ||||||||||||||||||||||||||||
| 47 | 5 | ▶ | foreach my $dir (qw('/usr/share/locale /usr/local/share/locale')) { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||
| 48 | 10 | ▶ | if (-d $dir) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | push @DEFAULT_DIRS, $dir; | |||||||||||||||||||||||||||
| 50 | 0 | last; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | sub new { | ||||||||||||||||||||||||||||
| 56 | 57 | ▶ | my ($class, $ctx, $textdomain, $language, $charset, @search_dirs) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=12 SCAR=25.6
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 57 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 57 | ▶ | $textdomain = 'textdomain' unless defined $textdomain && length $textdomain; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and length $textdomain
MC/DC0%0/2
defined $textdomain and length $textdomain
defined $textdomain
length $textdomain
Truth table33%1/3
A and B
A= defined $textdomainB= length $textdomain
| |||||||||||||||||||||||||||||
| 61 | 57 | ▶ | $charset = 'utf-8' unless defined $charset && length $charset; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $charset and length $charset
MC/DC0%0/2
defined $charset and length $charset
defined $charset
length $charset
Truth table33%1/3
A and B
A= defined $charsetB= length $charset
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 57 | my $template = $ctx->stash->get('component')->name; | |||||||||||||||||||||||||||
| 64 | 57 | ▶ | if ('input text' eq $template || 'input file handle' eq $template) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
"input text" eq $template or "input file handle" eq $template
MC/DC0%0/2
"input text" eq $template or "input file handle" eq $template
"input text" eq $template
"input file handle" eq $template
Truth table33%1/3
A or B
A= "input text" eq $templateB= "input file handle" eq $template
| |||||||||||||||||||||||||||||
| 65 | 57 | my $maybe_template = $ctx->stash->get('gettext_filename'); | |||||||||||||||||||||||||||
| 66 | 57 | ▶ | $template = $maybe_template | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $maybe_template and length $maybe_template
MC/DC0%0/2
defined $maybe_template and length $maybe_template
defined $maybe_template
length $maybe_template
Truth table33%1/3
A and B
A= defined $maybe_templateB= length $maybe_template
| |||||||||||||||||||||||||||||
| 67 | if defined $maybe_template && length $maybe_template; | ||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | 57 | $textdomains{$textdomain}->{$template} = 1; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 57 | ▶ | unless (exists $bound_dirs{$textdomain}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 56 | ▶ | unless (@search_dirs) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 56 | @search_dirs = map $_ . '/LocaleData', @INC; | |||||||||||||||||||||||||||
| 74 | 56 | push @search_dirs, @DEFAULT_DIRS; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 56 | unshift @search_dirs, @LOCALE_DIRS; | |||||||||||||||||||||||||||
| 77 | 56 | $bound_dirs{$textdomain} = [@search_dirs]; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 57 | $self->{__textdomain} = $textdomain; | |||||||||||||||||||||||||||
| 81 | 57 | ▶ | $self->{__locale} = web_set_locale $language, $charset if defined $language; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | $ctx->define_filter(gettext => sub { | ||||||||||||||||||||||||||||
| 84 | 3 | ▶ | my ($context) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | return sub { | ||||||||||||||||||||||||||||
| 87 | 3 | ▶ | return __gettext($textdomain, shift); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | 3 | }; | |||||||||||||||||||||||||||
| 89 | 57 | }, 1); | |||||||||||||||||||||||||||
| 90 | $ctx->define_filter(ngettext => sub { | ||||||||||||||||||||||||||||
| 91 | 4 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 92 | 4 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 4 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 95 | return sub { | ||||||||||||||||||||||||||||
| 96 | 4 | ▶ | return __ngettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 97 | 4 | }; | |||||||||||||||||||||||||||
| 98 | 57 | }, 1); | |||||||||||||||||||||||||||
| 99 | $ctx->define_filter(pgettext => sub { | ||||||||||||||||||||||||||||
| 100 | 2 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 101 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 104 | return sub { | ||||||||||||||||||||||||||||
| 105 | 2 | ▶ | return __pgettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 2 | }; | |||||||||||||||||||||||||||
| 107 | 57 | }, 1); | |||||||||||||||||||||||||||
| 108 | $ctx->define_filter(gettextp => sub { | ||||||||||||||||||||||||||||
| 109 | 2 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 110 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 113 | return sub { | ||||||||||||||||||||||||||||
| 114 | 2 | ▶ | return __gettextp($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 115 | 2 | }; | |||||||||||||||||||||||||||
| 116 | 57 | }, 1); | |||||||||||||||||||||||||||
| 117 | $ctx->define_filter(npgettext => sub { | ||||||||||||||||||||||||||||
| 118 | 4 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 119 | 4 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 4 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 122 | return sub { | ||||||||||||||||||||||||||||
| 123 | 4 | ▶ | return __npgettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 124 | 4 | }; | |||||||||||||||||||||||||||
| 125 | 57 | }, 1); | |||||||||||||||||||||||||||
| 126 | $ctx->define_filter(ngettextp => sub { | ||||||||||||||||||||||||||||
| 127 | 4 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 128 | 4 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 4 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 131 | return sub { | ||||||||||||||||||||||||||||
| 132 | 4 | ▶ | return __ngettextp($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 133 | 4 | }; | |||||||||||||||||||||||||||
| 134 | 57 | }, 1); | |||||||||||||||||||||||||||
| 135 | $ctx->define_filter(xgettext => sub { | ||||||||||||||||||||||||||||
| 136 | 3 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 137 | 3 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 3 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 140 | return sub { | ||||||||||||||||||||||||||||
| 141 | 3 | ▶ | return __xgettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 142 | 3 | }; | |||||||||||||||||||||||||||
| 143 | 57 | }, 1); | |||||||||||||||||||||||||||
| 144 | $ctx->define_filter(nxgettext => sub { | ||||||||||||||||||||||||||||
| 145 | 4 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 146 | 4 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 4 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 149 | return sub { | ||||||||||||||||||||||||||||
| 150 | 4 | ▶ | return __nxgettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 151 | 4 | }; | |||||||||||||||||||||||||||
| 152 | 57 | }, 1); | |||||||||||||||||||||||||||
| 153 | $ctx->define_filter(pxgettext => sub { | ||||||||||||||||||||||||||||
| 154 | 2 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 155 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 158 | return sub { | ||||||||||||||||||||||||||||
| 159 | 2 | ▶ | return __pxgettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 160 | 2 | }; | |||||||||||||||||||||||||||
| 161 | 57 | }, 1); | |||||||||||||||||||||||||||
| 162 | $ctx->define_filter(xgettextp => sub { | ||||||||||||||||||||||||||||
| 163 | 2 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 164 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 167 | return sub { | ||||||||||||||||||||||||||||
| 168 | 2 | ▶ | return __xgettextp($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 169 | 2 | }; | |||||||||||||||||||||||||||
| 170 | 57 | }, 1); | |||||||||||||||||||||||||||
| 171 | $ctx->define_filter(npxgettext => sub { | ||||||||||||||||||||||||||||
| 172 | 4 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 173 | 4 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 4 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 176 | return sub { | ||||||||||||||||||||||||||||
| 177 | 4 | ▶ | return __npxgettext($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 178 | 4 | }; | |||||||||||||||||||||||||||
| 179 | 57 | }, 1); | |||||||||||||||||||||||||||
| 180 | $ctx->define_filter(nxgettextp => sub { | ||||||||||||||||||||||||||||
| 181 | 4 | ▶ | my ($context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 182 | 4 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 4 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 185 | return sub { | ||||||||||||||||||||||||||||
| 186 | 4 | ▶ | return __nxgettextp($textdomain, shift, @args); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 187 | 4 | }; | |||||||||||||||||||||||||||
| 188 | 57 | }, 1); | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 57 | return $self; | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | sub __fixup { | ||||||||||||||||||||||||||||
| 194 | 56 | ▶ | my $trans = $_[-1]; | ||||||||||||||||||||||||||
|
Subroutine
__fixup: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 56 | Encode::_utf8_on($trans); | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 56 | return $trans; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | sub __gettext { | ||||||||||||||||||||||||||||
| 202 | 4 | ▶ | my ($textdomain, $msgid) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__gettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 205 | 4 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 4 | return __fixup $msgid, Locale::Messages::dgettext($textdomain => $msgid); | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | sub gettext { | ||||||||||||||||||||||||||||
| 211 | 1 | ▶ | my ($self, $msgid) = @_; | ||||||||||||||||||||||||||
|
Subroutine
gettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 1 | return __gettext $self->{__textdomain}, $msgid; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | sub __ngettext { | ||||||||||||||||||||||||||||
| 217 | 6 | ▶ | my ($textdomain, $msgid, $msgid_plural, $count) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ngettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 220 | 6 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 6 | return __fixup $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 223 | Locale::Messages::dngettext($textdomain => $msgid, | ||||||||||||||||||||||||||||
| 224 | $msgid_plural, $count); | ||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | sub ngettext { | ||||||||||||||||||||||||||||
| 228 | 2 | ▶ | my ($self, $msgid, $msgid_plural, $count) = @_; | ||||||||||||||||||||||||||
|
Subroutine
ngettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 2 | return __ngettext $self->{__textdomain}, $msgid, $msgid_plural, $count; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | sub __pgettext { | ||||||||||||||||||||||||||||
| 234 | 3 | ▶ | my ($textdomain, $context, $msgid) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__pgettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 237 | 3 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 3 | return __fixup $msgid, | |||||||||||||||||||||||||||
| 240 | Locale::Messages::dpgettext($textdomain => $context, $msgid); | ||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | sub pgettext { | ||||||||||||||||||||||||||||
| 244 | 1 | ▶ | my ($self, $context, $msgid) = @_; | ||||||||||||||||||||||||||
|
Subroutine
pgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 1 | return __pgettext $self->{__textdomain}, $context, $msgid; | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | sub __gettextp { | ||||||||||||||||||||||||||||
| 250 | 3 | ▶ | my ($textdomain, $msgid, $context) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__gettextp: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 253 | 3 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 3 | return __fixup $msgid, | |||||||||||||||||||||||||||
| 256 | Locale::Messages::dpgettext($textdomain => $context, $msgid); | ||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | sub gettextp { | ||||||||||||||||||||||||||||
| 260 | 1 | ▶ | my ($self, $msgid, $context) = @_; | ||||||||||||||||||||||||||
|
Subroutine
gettextp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 1 | return __gettextp $self->{__textdomain}, $msgid, $context; | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | sub __npgettext { | ||||||||||||||||||||||||||||
| 266 | 6 | ▶ | my ($textdomain, $context, $msgid, $msgid_plural, $count) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__npgettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 269 | 6 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 6 | return __fixup $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 272 | Locale::Messages::dnpgettext($textdomain, $context, $msgid, | ||||||||||||||||||||||||||||
| 273 | $msgid_plural, $count); | ||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | sub npgettext { | ||||||||||||||||||||||||||||
| 277 | 2 | ▶ | my ($self, $context, $msgid, $msgid_plural, $count) = @_; | ||||||||||||||||||||||||||
|
Subroutine
npgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 2 | return __npgettext $self->{__textdomain}, $context, $msgid, $msgid_plural, | |||||||||||||||||||||||||||
| 280 | $count; | ||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | sub __ngettextp { | ||||||||||||||||||||||||||||
| 284 | 6 | ▶ | my ($textdomain, $msgid, $msgid_plural, $count, $context) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ngettextp: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 287 | 6 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | 6 | return __fixup $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 290 | Locale::Messages::dnpgettext($textdomain => $context, $msgid, | ||||||||||||||||||||||||||||
| 291 | $msgid_plural, $count); | ||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | sub ngettextp { | ||||||||||||||||||||||||||||
| 295 | 2 | ▶ | my ($self, $msgid, $msgid_plural, $count, $context) = @_; | ||||||||||||||||||||||||||
|
Subroutine
ngettextp: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 2 | return __ngettextp $self->{__textdomain}, $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 298 | $context; | ||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | sub __xgettext { | ||||||||||||||||||||||||||||
| 302 | 4 | ▶ | my ($textdomain, $msgid, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__xgettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 305 | 4 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | 4 | return __expand((__fixup $msgid, | |||||||||||||||||||||||||||
| 308 | Locale::Messages::dgettext($textdomain => $msgid)), %vars); | ||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | sub xgettext { | ||||||||||||||||||||||||||||
| 312 | 1 | ▶ | my ($self, $msgid, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
xgettext: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 1 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 1 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 1 | return __xgettext $self->{__textdomain}, $msgid, @args; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | sub __nxgettext { | ||||||||||||||||||||||||||||
| 321 | 6 | ▶ | my ($textdomain, $msgid, $msgid_plural, $count, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__nxgettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 324 | 6 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 6 | return __expand((__fixup $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 327 | Locale::Messages::dngettext($textdomain => $msgid, | ||||||||||||||||||||||||||||
| 328 | $msgid_plural, | ||||||||||||||||||||||||||||
| 329 | $count)), | ||||||||||||||||||||||||||||
| 330 | %vars); | ||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | sub nxgettext { | ||||||||||||||||||||||||||||
| 334 | 2 | ▶ | my ($self, $msgid, $msgid_plural, $count, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
nxgettext: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 337 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 2 | return __nxgettext $self->{__textdomain}, $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 340 | @args; | ||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | sub __pxgettext { | ||||||||||||||||||||||||||||
| 344 | 3 | ▶ | my ($textdomain, $context, $msgid, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__pxgettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 347 | 3 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | 3 | return __expand((__fixup $msgid, | |||||||||||||||||||||||||||
| 350 | Locale::Messages::dpgettext($textdomain => $context, | ||||||||||||||||||||||||||||
| 351 | $msgid)), | ||||||||||||||||||||||||||||
| 352 | %vars); | ||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | sub pxgettext { | ||||||||||||||||||||||||||||
| 356 | 1 | ▶ | my ($self, $context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
pxgettext: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 1 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 359 | 1 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | 1 | return __pxgettext $self->{__textdomain}, $context, @args; | |||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | sub __xgettextp { | ||||||||||||||||||||||||||||
| 365 | 3 | ▶ | my ($textdomain, $msgid, $context, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__xgettextp: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 368 | 3 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 3 | return __expand((__fixup $msgid, | |||||||||||||||||||||||||||
| 371 | Locale::Messages::dpgettext($textdomain => $context, | ||||||||||||||||||||||||||||
| 372 | $msgid)), | ||||||||||||||||||||||||||||
| 373 | %vars); | ||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | sub xgettextp { | ||||||||||||||||||||||||||||
| 377 | 1 | ▶ | my ($self, $msgid, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
xgettextp: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | 1 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 380 | 1 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | 1 | return __xgettextp $self->{__textdomain}, $msgid, @args; | |||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | sub __npxgettext { | ||||||||||||||||||||||||||||
| 386 | 6 | ▶ | my ($textdomain, $context, $msgid, $msgid_plural, $count, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__npxgettext: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 389 | 6 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 6 | return __expand((__fixup $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 392 | Locale::Messages::dnpgettext($textdomain => $context, | ||||||||||||||||||||||||||||
| 393 | $msgid, $msgid_plural, | ||||||||||||||||||||||||||||
| 394 | $count)), | ||||||||||||||||||||||||||||
| 395 | %vars); | ||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | sub npxgettext { | ||||||||||||||||||||||||||||
| 399 | 2 | ▶ | my ($self, $context, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
npxgettext: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 402 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 2 | return __npxgettext $self->{__textdomain}, $context, @args; | |||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | sub __nxgettextp { | ||||||||||||||||||||||||||||
| 408 | 6 | ▶ | my ($textdomain, $msgid, $msgid_plural, $count, $context, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__nxgettextp: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | __find_domain $textdomain | ||||||||||||||||||||||||||||
| 411 | 6 | ▶ | if defined $textdomain && exists $bound_dirs{$textdomain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $textdomain and exists $bound_dirs{$textdomain}
MC/DC0%0/2
defined $textdomain and exists $bound_dirs{$textdomain}
defined $textdomain
exists $bound_dirs{$textdomain}
Truth table33%1/3
A and B
A= defined $textdomainB= exists $bound_dirs{$textdomain}
| |||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 6 | return __expand((__fixup $msgid, $msgid_plural, $count, | |||||||||||||||||||||||||||
| 414 | Locale::Messages::dnpgettext($textdomain => $context, | ||||||||||||||||||||||||||||
| 415 | $msgid, $msgid_plural, | ||||||||||||||||||||||||||||
| 416 | $count)), | ||||||||||||||||||||||||||||
| 417 | %vars); | ||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | sub nxgettextp { | ||||||||||||||||||||||||||||
| 421 | 2 | ▶ | my ($self, $msgid, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
nxgettextp: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | 2 | ▶ | my $pairs = ref $args[-1] eq 'HASH' ? pop(@args) : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | 2 | push @args, %$pairs; | |||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 2 | return __nxgettextp $self->{__textdomain}, $msgid, @args; | |||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | sub debug_locale { | ||||||||||||||||||||||||||||
| 430 | 0 | ▶ | shift->{__locale}; | ||||||||||||||||||||||||||
|
Subroutine
debug_locale: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | sub __expand($%) { | ||||||||||||||||||||||||||||
| 434 | 28 | ▶ | my ($str, %vars) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__expand: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | 28 | my $re = join '|', map { quotemeta } keys %vars; | |||||||||||||||||||||||||||
| 437 | 28 | $str =~ s/\{($re)\}/exists $vars{$1} ? | |||||||||||||||||||||||||||
| 438 | 19 | ▶ | (defined $vars{$1} ? $vars{$1} : '') : "{$1}"/ge; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 28 | return $str; | |||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | sub __find_domain($) { | ||||||||||||||||||||||||||||
| 444 | 56 | ▶ | my ($domain) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__find_domain: called CC=7 SCAR=30.0
| |||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 56 | my $try_dirs = $bound_dirs{$domain}; | |||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | 56 | ▶ | if (defined $try_dirs) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 449 | 56 | my $found_dir = ''; | |||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 56 | TRYDIR: foreach my $dir (map {abs_path $_} grep { -d $_ } @$try_dirs) { | |||||||||||||||||||||||||||
| 452 | # Is there a message catalog? | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | 0 | local *DIR; | |||||||||||||||||||||||||||
| 455 | 0 | ▶ | if (opendir DIR, $dir) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 456 | 0 | my @files = map { "$dir/$_/LC_MESSAGES/$domain.mo" } | |||||||||||||||||||||||||||
| 457 | 0 | grep { ! /^\.\.?$/ } readdir DIR; | |||||||||||||||||||||||||||
| 458 | 0 | foreach my $file (@files) { | |||||||||||||||||||||||||||
| 459 | 0 | ▶ | if (-f $file || -l $file) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-f $file or -l $file
MC/DC0%0/2
-f $file or -l $file
-f $file
-l $file
Truth table0%0/3
A or B
A= -f $fileB= -l $file
| |||||||||||||||||||||||||||||
| 460 | 0 | $found_dir = $dir; | |||||||||||||||||||||||||||
| 461 | 0 | last TRYDIR; | |||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | # If $found_dir is undef, the default search directories are | ||||||||||||||||||||||||||||
| 468 | # used. | ||||||||||||||||||||||||||||
| 469 | 56 | Locale::Messages::bindtextdomain($domain => $found_dir); | |||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | 56 | delete $bound_dirs{$domain}; | |||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | 56 | return 1; | |||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | sub textdomains { | ||||||||||||||||||||||||||||
| 478 | 0 | ▶ | return %textdomains; | ||||||||||||||||||||||||||
|
Subroutine
textdomains: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | sub resetTextdomains { | ||||||||||||||||||||||||||||
| 482 | 0 | ▶ | undef %textdomains; | ||||||||||||||||||||||||||
|
Subroutine
resetTextdomains: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | 5 | 1; | |||||||||||||||||||||||||||