| 1 | #! /bin/false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # vim: set autoindent shiftwidth=4 tabstop=4: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Pure Perl implementation of Uniforum message translation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Copyright (C) 2002-2026 Guido Flohr <guido.flohr@cantanea.com>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # the Free Software Foundation; either version 3 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | package Locale::gettext_pp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 22 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 22 | require 5.004; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 22 | ▶ | use vars qw ($__gettext_pp_default_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | $__gettext_pp_textdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | $__gettext_pp_domain_bindings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | $__gettext_pp_domain_codeset_bindings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | $__gettext_pp_domains | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | $__gettext_pp_recoders | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | $__gettext_pp_unavailable_dirs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $__gettext_pp_domain_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | $__gettext_pp_alias_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 22 | $__gettext_pp_context_glue); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 22 | ▶ | use locale; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 22 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 22 | ▶ | use Locale::Messages; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 22 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 22 | $__gettext_pp_textdomain = 'messages'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 22 | $__gettext_pp_domain_bindings = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 22 | $__gettext_pp_domain_codeset_bindings = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 22 | $__gettext_pp_domains = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 22 | $__gettext_pp_recoders = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 22 | $__gettext_pp_unavailable_dirs = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 22 | $__gettext_pp_domain_cache = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 22 | $__gettext_pp_alias_cache = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # The separator between msgctxt and msgid in a .mo file. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 22 | $__gettext_pp_context_glue = "\004"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 22 | $__gettext_pp_default_dir = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 22 | for my $dir (qw (/usr/share/locale /usr/local/share/locale)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 22 | ▶ | if (-d $dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 22 | $__gettext_pp_default_dir = $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 22 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 22 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=8 SCAR=28.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 22 | require POSIX; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 22 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 22 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 22 | require Locale::Recode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 22 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 22 | my ($has_messages, $five_ok); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 22 | $has_messages = eval '&POSIX::LC_MESSAGES'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 22 | ▶ | unless (defined $has_messages && length $has_messages) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $has_messages and length $has_messages
MC/DC0%0/2
defined $has_messages and length $has_messages
defined $has_messages
length $has_messages
Truth table33%1/3
A and B
A= defined $has_messagesB= length $has_messages
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $five_ok = ! grep {my $x = eval "&POSIX::$_" || 0; $x eq '5';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
eval "&POSIX::$_" || 0
MC/DC0%0/1
eval "&POSIX::$_" || 0
eval "&POSIX::$_"
Truth table0%0/2
A
A= eval "&POSIX::$_"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | qw (LC_CTYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | LC_NUMERIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | LC_TIME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | LC_COLLATE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | LC_MONETARY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | LC_ALL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if ($five_ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $five_ok = POSIX::setlocale (5, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 22 | ▶ | if (defined $has_messages && length $has_messages) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $has_messages and length $has_messages
MC/DC0%0/2
defined $has_messages and length $has_messages
defined $has_messages
length $has_messages
Truth table33%1/3
A and B
A= defined $has_messagesB= length $has_messages
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 22 | ▶ | eval <<'EOF'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_MESSAGES: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | sub LC_MESSAGES() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | local $!; # Do not clobber errno! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | return &POSIX::LC_MESSAGES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } elsif ($five_ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | eval <<'EOF'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | sub LC_MESSAGES() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | local $!; # Do not clobber errno! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # Hack: POSIX.pm deems LC_MESSAGES an invalid macro until | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # Perl 5.8.0. However, on LC_MESSAGES should be 5 ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | return 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | eval <<'EOF'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | sub LC_MESSAGES() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | local $!; # Do not clobber errno! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # This fallback value is widely used, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # when LC_MESSAGES is not available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | return 1729; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 22 | ▶ | use vars qw (%EXPORT_TAGS @EXPORT_OK @ISA $VERSION); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 22 | %EXPORT_TAGS = (locale_h => [ qw ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | gettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | dgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | dcgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ngettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | dngettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | dcngettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | pgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | dpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | dcpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | npgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | dnpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | dcnpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | textdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | bindtextdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | bind_textdomain_codeset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | libintl_h => [ qw (LC_CTYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | LC_NUMERIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | LC_TIME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | LC_COLLATE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | LC_MONETARY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | LC_MESSAGES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | LC_ALL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 22 | @EXPORT_OK = qw (gettext | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | dgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | dcgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ngettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | dngettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | dcngettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | pgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | dpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | dcpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | npgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | dnpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | dcnpgettext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | textdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | bindtextdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | bind_textdomain_codeset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | nl_putenv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | setlocale | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | LC_CTYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | LC_NUMERIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | LC_TIME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | LC_COLLATE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | LC_MONETARY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | LC_MESSAGES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | LC_ALL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 22 | @ISA = qw (Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 22 | my $has_nl_langinfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | sub __load_catalog; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | sub __load_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | sub __locale_category; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | sub __untaint_plural_header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | sub __compile_plural_function; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | sub LC_NUMERIC() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_NUMERIC: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 2 | &POSIX::LC_NUMERIC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | sub LC_CTYPE() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_CTYPE: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | &POSIX::LC_CTYPE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | sub LC_TIME() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_TIME: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 2 | &POSIX::LC_TIME; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | sub LC_COLLATE() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_COLLATE: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | &POSIX::LC_COLLATE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | sub LC_MONETARY() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_MONETARY: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | &POSIX::LC_MONETARY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | sub LC_ALL() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LC_ALL: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | &POSIX::LC_ALL; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | sub textdomain(;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 208 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
textdomain: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 208 | my $new_domain = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 208 | ▶ | $__gettext_pp_textdomain = $new_domain if defined $new_domain && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $new_domain and length $new_domain
MC/DC100%2/2
defined $new_domain and length $new_domain
defined $new_domain
length $new_domain
Truth table100%3/3
A and B
A= defined $new_domainB= length $new_domain
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | length $new_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 208 | return $__gettext_pp_textdomain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | sub bindtextdomain($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 665 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bindtextdomain: called CC=8 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 665 | my ($domain, $directory) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 665 | my $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 665 | ▶ | if (defined $domain && length $domain) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $domain and length $domain
MC/DC0%0/2
defined $domain and length $domain
defined $domain
length $domain
Truth table33%1/3
A and B
A= defined $domainB= length $domain
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 665 | ▶ | if (defined $directory && length $directory) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
defined $directory and length $directory
MC/DC100%2/2
defined $directory and length $directory
defined $directory
length $directory
Truth table100%3/3
A and B
A= defined $directoryB= length $directory
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 37 | $retval = $__gettext_pp_domain_bindings->{$domain} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | = $directory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } elsif (exists $__gettext_pp_domain_bindings->{$domain}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 626 | $retval = $__gettext_pp_domain_bindings->{$domain}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | $retval = $__gettext_pp_default_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 665 | ▶ | $retval = '/usr/share/locale' unless defined $retval && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $retval and length $retval
MC/DC0%0/2
defined $retval and length $retval
defined $retval
length $retval
Truth table33%1/3
A and B
A= defined $retvalB= length $retval
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | length $retval; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 665 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | sub bind_textdomain_codeset($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bind_textdomain_codeset: called CC=6 SCAR=25.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | my ($domain, $codeset) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | ▶ | if (defined $domain && length $domain) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $domain and length $domain
MC/DC0%0/2
defined $domain and length $domain
defined $domain
length $domain
Truth table33%1/3
A and B
A= defined $domainB= length $domain
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | ▶ | if (defined $codeset && length $codeset) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $codeset and length $codeset
MC/DC0%0/2
defined $codeset and length $codeset
defined $codeset
length $codeset
Truth table33%1/3
A and B
A= defined $codesetB= length $codeset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | return $__gettext_pp_domain_codeset_bindings->{$domain} = $codeset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } elsif (exists $__gettext_pp_domain_codeset_bindings->{$domain}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | return $__gettext_pp_domain_codeset_bindings->{$domain}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | sub gettext($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 97 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 97 | my ($msgid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 97 | return dcnpgettext ('', undef, $msgid, undef, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | sub dgettext($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 12 | my ($domainname, $msgid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 12 | return dcnpgettext ($domainname, undef, $msgid, undef, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | sub dcgettext($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dcgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 12 | my ($domainname, $msgid, $category) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 12 | return dcnpgettext ($domainname, undef, $msgid, undef, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | sub ngettext($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 83 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ngettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 83 | my ($msgid, $msgid_plural, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 83 | return dcnpgettext ('', undef, $msgid, $msgid_plural, $n, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | sub dngettext($$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 83 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dngettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 83 | my ($domainname, $msgid, $msgid_plural, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 83 | return dcnpgettext ($domainname, undef, $msgid, $msgid_plural, $n, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | sub dcngettext($$$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 83 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dcngettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 83 | my ($domainname, $msgid, $msgid_plural, $n, $category) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 83 | return dcnpgettext ($domainname, undef, $msgid, $msgid_plural, $n, , $category); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | sub pgettext($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 3 | my ($msgctxt, $msgid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 3 | return dcnpgettext ('', $msgctxt, $msgid, undef, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | sub dpgettext($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dpgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 4 | my ($domainname, $msgctxt, $msgid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 4 | return dcnpgettext ($domainname, $msgctxt, $msgid, undef, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | sub dcpgettext($$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dcpgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 5 | my ($domainname, $msgctxt, $msgid, $category) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 5 | return dcnpgettext ($domainname, $msgctxt, $msgid, undef, undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | sub npgettext($$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 91 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
npgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 91 | my ($msgctxt, $msgid, $msgid_plural, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 91 | return dcnpgettext ('', $msgctxt, $msgid, $msgid_plural, $n, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | sub dnpgettext($$$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 91 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dnpgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 91 | my ($domainname, $msgctxt, $msgid, $msgid_plural, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 91 | return dcnpgettext ($domainname, $msgctxt, $msgid, $msgid_plural, $n, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # This is the actual implementation of dncpgettext. It is also used by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # corresponding function in Locale::gettext_dumb. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 664 | ▶ | sub _dcnpgettext_impl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dcnpgettext_impl: called CC=29 SCAR=55.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 664 | my ($domainname, $msgctxt, $msgid, $msgid_plural, $n, $category, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | $locale) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 664 | ▶ | return unless defined $msgid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 664 | my $plural = defined $msgid_plural; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 664 | Locale::Messages::turn_utf_8_off($msgid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 664 | ▶ | Locale::Messages::turn_utf_8_off($msgctxt) if defined $msgctxt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 664 | ▶ | my $msg_ctxt_id = defined $msgctxt ? join($__gettext_pp_context_glue, ($msgctxt, $msgid)) : $msgid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 664 | local $!; # Do not clobber errno! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # This is also done in __load_domain but we need a proper value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 664 | ▶ | $domainname = $__gettext_pp_textdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $domainname and length $domainname
MC/DC50%1/2
defined $domainname and length $domainname
defined $domainname
length $domainname
Truth table66%2/3
A and B
A= defined $domainnameB= length $domainname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | unless defined $domainname && length $domainname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | # Category is always LC_MESSAGES (other categories are ignored). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 664 | my $category_name = 'LC_MESSAGES'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 664 | $category = LC_MESSAGES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 664 | my $domains = __load_domain ($domainname, $category, $category_name, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | $locale); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 664 | my @trans = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 664 | my $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | my $found; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 664 | foreach my $this_domain (@$domains) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | if ($this_domain && defined $this_domain->{messages}->{$msg_ctxt_id}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$this_domain and defined $this_domain->{"messages"}{$msg_ctxt_id}
MC/DC0%0/2
$this_domain and defined $this_domain->{"messages"}{$msg_ctxt_id}
$this_domain
defined $this_domain->{"messages"}{$msg_ctxt_id}
Truth table0%0/3
A and B
A= $this_domainB= defined $this_domain->{"messages"}{$msg_ctxt_id}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | @trans = @{$this_domain->{messages}->{$msg_ctxt_id}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | shift @trans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $domain = $this_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $found = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 664 | ▶ | @trans = ($msgid, $msgid_plural) unless @trans; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 664 | my $trans = $trans[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 664 | ▶ | if ($plural) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 522 | ▶ | if ($domain) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my $nplurals = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ($nplurals, $plural) = &{$domain->{plural_func}} ($n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | $plural = 0 unless defined $plural; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | $nplurals = 0 unless defined $nplurals; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | $plural = 0 if $nplurals <= $plural; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 522 | ▶ | $plural = $n != 1 || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$n != 1 || 0
MC/DC100%1/1
$n != 1 || 0
$n != 1
Truth table100%2/2
A
A= $n != 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 522 | ▶ | $trans = $trans[$plural] if defined $trans[$plural]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 664 | ▶ | if ($found && defined $domain->{po_header}->{charset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$found and defined $domain->{"po_header"}{"charset"}
MC/DC0%0/2
$found and defined $domain->{"po_header"}{"charset"}
$found
defined $domain->{"po_header"}{"charset"}
Truth table33%1/3
A and B
A= $foundB= defined $domain->{"po_header"}{"charset"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $input_codeset = $domain->{po_header}->{charset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # Convert into output charset. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $output_codeset = $__gettext_pp_domain_codeset_bindings->{$domainname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | $output_codeset = $ENV{OUTPUT_CHARSET} unless defined $output_codeset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | $output_codeset = __get_codeset ($category, $category_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | $domain->{locale_id}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | unless defined $output_codeset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | unless (defined $output_codeset) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # Still no point. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $lc_ctype = __locale_category (POSIX::LC_CTYPE(), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 'LC_CTYPE'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | $output_codeset = $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | if $lc_ctype =~ /^[a-z]{2}(?:_[A-Z]{2})?\.([^@]+)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | # No point. :-( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | $output_codeset = $domain->{po_header}->{charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | unless defined $output_codeset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if (exists $__gettext_pp_domain_cache->{$output_codeset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $output_codeset = $__gettext_pp_domain_cache->{$output_codeset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | $output_codeset = 'utf-8' if lc $output_codeset eq 'utf8'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | $output_codeset = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $__gettext_pp_domain_cache->{$output_codeset} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | Locale::Recode->resolveAlias ($output_codeset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | if (defined $output_codeset && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $output_codeset and $output_codeset ne $domain->{"po_header"}{"charset"}
MC/DC0%0/2
defined $output_codeset and $output_codeset ne $domain->{"po_header"}{"charset"}
defined $output_codeset
$output_codeset ne $domain->{"po_header"}{"charset"}
Truth table0%0/3
A and B
A= defined $output_codesetB= $output_codeset ne $domain->{"po_header"}{"charset"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | $output_codeset ne $domain->{po_header}->{charset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # We have to convert. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $recoder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if (exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $__gettext_pp_recoders->{$input_codeset}->{$output_codeset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | $recoder = $__gettext_pp_recoders->{$input_codeset}->{$output_codeset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | $recoder = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | $__gettext_pp_recoders->{$input_codeset}->{$output_codeset} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | Locale::Recode->new (from => $input_codeset, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | to => $output_codeset, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | $recoder->recode ($trans); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 664 | return $trans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 655 | ▶ | sub dcnpgettext ($$$$$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dcnpgettext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 655 | return &_dcnpgettext_impl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | sub nl_putenv ($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 525 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nl_putenv: called CC=8 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 525 | my ($envspec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 525 | ▶ | return unless defined $envspec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 525 | ▶ | return unless length $envspec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 525 | ▶ | return if substr ($envspec, 0, 1) eq '='; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 525 | my ($var, $value) = split /=/, $envspec, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # In Perl we *could* set empty environment variables even under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # MS-DOS, but for compatibility reasons, we implement the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # brain-damaged behavior of the Microsoft putenv(). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 525 | ▶ | if ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | $value = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | if (length $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $ENV{$var} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | delete $ENV{$var}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 525 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 407 | $ENV{$var} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 118 | delete $ENV{$var}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 525 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 126 | ▶ | sub setlocale($;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setlocale: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 126 | require POSIX; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 126 | &POSIX::setlocale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 624 | ▶ | sub __selected_locales { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__selected_locales: called CC=12 SCAR=37.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 624 | my ($locale, $category, $category_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 624 | ▶ | if ($ENV{DEBUGME}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $DB::single = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 624 | my @locales; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | my $cache_key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 624 | my $locale_category = __locale_category $category, $category_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 624 | ▶ | my $language_preference = !defined $locale_category || !length $locale_category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
!(defined $locale_category && length $locale_category) || $locale_category ne 'C' && $locale_category ne 'POSIX'
defined $locale_category && length $locale_category
$locale_category ne "C" and $locale_category ne "POSIX"
MC/DC0%0/4
!(defined $locale_category && length $locale_category) || $locale_category ne 'C' && $locale_category ne 'POSIX'
defined $locale_category
length $locale_category
$locale_category ne "C"
$locale_category ne "POSIX"
Truth table20%1/5
not(A && B) || C and D
A= defined $locale_categoryB= length $locale_categoryC= $locale_category ne "C"D= $locale_category ne "POSIX"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | || ($locale_category ne 'C' && $locale_category ne 'POSIX'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 624 | my $language = $ENV{LANGUAGE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 624 | ▶ | $language = '' if !defined $language; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 624 | ▶ | if (!$language_preference || $language eq 'C' || $language eq 'POSIX') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $language_preference or $language eq "C" or $language eq "POSIX"
not $language_preference or $language eq "C"
MC/DC0%0/3
not $language_preference or $language eq "C" or $language eq "POSIX"
not $language_preference
$language eq "C"
$language eq "POSIX"
Truth table25%1/4
not(A) or B or C
A= not $language_preferenceB= $language eq "C"C= $language eq "POSIX"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 624 | return 'C', 'C'; # No translations desired. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if (defined $language && length $language) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $language and length $language
MC/DC0%0/2
defined $language and length $language
defined $language
length $language
Truth table0%0/3
A and B
A= defined $languageB= length $language
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | @locales = split /:/, $language; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $cache_key = $language; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } elsif (!defined $locale) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # The system does not have LC_MESSAGES. Guess the value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | @locales = $cache_key = $locale_category; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | @locales = $cache_key = $locale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | return $cache_key, @locales; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 35 | ▶ | sub __extend_locales { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__extend_locales: called CC=8 SCAR=34.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 35 | my (@locales) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 35 | my @tries = @locales; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 35 | my %locale_lookup = map { $_ => $_ } @tries; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 35 | foreach my $locale (@locales) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 35 | ▶ | if ($locale =~ /^([a-z][a-z]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | (?:(_[A-Z][A-Z])? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | (\.[-_A-Za-z0-9]+)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | (\@[-_A-Za-z0-9]+)?$/x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if (defined $3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | defined $2 ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | push @tries, $1 . $2 . $3 : push @tries, $1 . $3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $locale_lookup{$tries[-1]} = $locale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | if (defined $2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | push @tries, $1 . $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $locale_lookup{$1 . $2} = $locale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if (defined $1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | push @tries, $1 if defined $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $locale_lookup{$1} = $locale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 35 | return \@tries, \%locale_lookup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 664 | ▶ | sub __load_domain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__load_domain: called CC=28 SCAR=42.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 664 | my ($domainname, $category, $category_name, $locale) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | # If no locale was selected for the requested locale category, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | # l10n is disabled completely. This matches the behavior of GNU | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # gettext. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 664 | ▶ | if ($category != LC_MESSAGES) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # Not supported. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 664 | ▶ | if (!defined $locale && $category != 1729 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
not defined $locale and $category != 1729 and not defined $ENV{"LANGUAGE"} and not length $ENV{"LANGUAGE"}
not defined $locale and $category != 1729 and not defined $ENV{"LANGUAGE"}
not defined $locale and $category != 1729
MC/DC50%2/4
not defined $locale and $category != 1729 and not defined $ENV{"LANGUAGE"} and not length $ENV{"LANGUAGE"}
not defined $locale
$category != 1729
not defined $ENV{"LANGUAGE"}
not length $ENV{"LANGUAGE"}
Truth table60%3/5
not(A) and B and not(C) and not(D)
A= not defined $localeB= $category != 1729C= not defined $ENV{"LANGUAGE"}D= not length $ENV{"LANGUAGE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | && !defined $ENV{LANGUAGE} && !length $ENV{LANGUAGE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 40 | $locale = POSIX::setlocale ($category); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 40 | ▶ | if (!defined $locale || 'C' eq $locale || 'POSIX' eq $locale) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $locale or "C" eq $locale or "POSIX" eq $locale
not defined $locale or "C" eq $locale
MC/DC0%0/3
not defined $locale or "C" eq $locale or "POSIX" eq $locale
not defined $locale
"C" eq $locale
"POSIX" eq $locale
Truth table25%1/4
not(A) or B or C
A= not defined $localeB= "C" eq $localeC= "POSIX" eq $locale
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 40 | return []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 624 | ▶ | $domainname = $__gettext_pp_textdomain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $domainname and length $domainname
MC/DC0%0/2
defined $domainname and length $domainname
defined $domainname
length $domainname
Truth table33%1/3
A and B
A= defined $domainnameB= length $domainname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | unless defined $domainname && length $domainname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 624 | my $dir = bindtextdomain ($domainname, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 624 | ▶ | $dir = $__gettext_pp_default_dir unless defined $dir && length $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $dir and length $dir
MC/DC0%0/2
defined $dir and length $dir
defined $dir
length $dir
Truth table33%1/3
A and B
A= defined $dirB= length $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 624 | ▶ | return [] unless defined $dir && length $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $dir and length $dir
MC/DC0%0/2
defined $dir and length $dir
defined $dir
length $dir
Truth table33%1/3
A and B
A= defined $dirB= length $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 624 | my ($cache_key, @locales) = __selected_locales $locale, $category, $category_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | # Have we looked that one up already? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 624 | my $domains = $__gettext_pp_domain_cache->{$dir}->{$cache_key}->{$category_name}->{$domainname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 624 | ▶ | return $domains if defined $domains; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 35 | ▶ | return [] unless @locales; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 35 | my @dirs = ($dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 35 | my ($tries, $lookup) = __extend_locales @locales; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 35 | ▶ | push @dirs, $__gettext_pp_default_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$Locale::gettext_pp::__gettext_pp_default_dir and $dir ne $Locale::gettext_pp::__gettext_pp_default_dir
MC/DC0%0/2
$Locale::gettext_pp::__gettext_pp_default_dir and $dir ne $Locale::gettext_pp::__gettext_pp_default_dir
$Locale::gettext_pp::__gettext_pp_default_dir
$dir ne $Locale::gettext_pp::__gettext_pp_default_dir
Truth table33%1/3
A and B
A= $Locale::gettext_pp::__gettext_pp_default_dirB= $dir ne $Locale::gettext_pp::__gettext_pp_default_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | if $__gettext_pp_default_dir && $dir ne $__gettext_pp_default_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 35 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | my %loaded; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 35 | foreach my $basedir (@dirs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 70 | foreach my $try (@$tries) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # If we had already found a catalog for "xy_XY", do not try it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 70 | ▶ | next if $loaded{$try}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 70 | my $fulldir = File::Spec->catfile($basedir, $try, $category_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 70 | ▶ | next if $seen{$fulldir}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | # If the cache for unavailable directories is removed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | # the three lines below should be replaced by: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # 'next unless -d $fulldir;' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 70 | ▶ | next if $__gettext_pp_unavailable_dirs->{$fulldir}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 37 | ▶ | ++$__gettext_pp_unavailable_dirs->{$fulldir} and next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
-d $fulldir || ++$Locale::gettext_pp::__gettext_pp_unavailable_dirs->{$fulldir} && (next)
++$Locale::gettext_pp::__gettext_pp_unavailable_dirs->{$fulldir} and next
MC/DC0%0/2
-d $fulldir || ++$Locale::gettext_pp::__gettext_pp_unavailable_dirs->{$fulldir} && (next)
-d $fulldir
++$Locale::gettext_pp::__gettext_pp_unavailable_dirs->{$fulldir}
Truth table33%1/3
A || B
A= -d $fulldirB= ++$Locale::gettext_pp::__gettext_pp_unavailable_dirs->{$fulldir}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | unless -d $fulldir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | my $filename = File::Spec->catfile($fulldir, "$domainname.mo"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | my $domain = __load_catalog $filename, $try; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | next unless $domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | $loaded{$try} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $domain->{locale_id} = $lookup->{$try}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | push @$domains, $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 35 | ▶ | $domains = [] unless defined $domains; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | $__gettext_pp_domain_cache->{$dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | ->{$cache_key} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | ->{$category_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 35 | ->{$domainname} = $domains; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 35 | return $domains; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | sub __load_catalog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__load_catalog: not called CC=25 SCAR=64.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my ($filename, $locale) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | # Alternatively we could check the filename for evil characters ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # (Important for CGIs). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | return unless -f $filename && -r $filename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-f $filename and -r $filename
MC/DC0%0/2
-f $filename and -r $filename
-f $filename
-r $filename
Truth table0%0/3
A and B
A= -f $filenameB= -r $filename
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | local *HANDLE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | open HANDLE, "<$filename" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | binmode HANDLE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | my $raw = <HANDLE>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | close HANDLE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | # Corrupted? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | ▶ | return if ! defined $raw || length $raw < 28; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $raw or length $raw < 28
MC/DC0%0/2
not defined $raw or length $raw < 28
not defined $raw
length $raw < 28
Truth table0%0/3
not(A) or B
A= not defined $rawB= length $raw < 28
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | my $filesize = length $raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # Read the magic number in order to determine the byte order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | my $domain = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | filename => $filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | my $unpack = 'N'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $domain->{magic} = unpack $unpack, substr $raw, 0, 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | if ($domain->{magic} == 0xde120495) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | $unpack = 'V'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } elsif ($domain->{magic} != 0x950412de) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my $domain_unpack = $unpack x 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | my ($revision, $num_strings, $msgids_off, $msgstrs_off, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | $hash_size, $hash_off) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | unpack (($unpack x 6), substr $raw, 4, 24); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | my $major = $revision >> 16; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | return if $major != 0; # Invalid revision number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | $domain->{revision} = $revision; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | $domain->{num_strings} = $num_strings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | $domain->{msgids_off} = $msgids_off; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | $domain->{msgstrs_off} = $msgstrs_off; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | $domain->{hash_size} = $hash_size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $domain->{hash_off} = $hash_off; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | return if $msgids_off + 4 * $num_strings > $filesize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | return if $msgstrs_off + 4 * $num_strings > $filesize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my @orig_tab = unpack (($unpack x (2 * $num_strings)), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | substr $raw, $msgids_off, 8 * $num_strings); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | my @trans_tab = unpack (($unpack x (2 * $num_strings)), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | substr $raw, $msgstrs_off, 8 * $num_strings); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | my $messages = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | for (my $count = 0; $count < 2 * $num_strings; $count += 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $orig_length = $orig_tab[$count]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my $orig_offset = $orig_tab[$count + 1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | my $trans_length = $trans_tab[$count]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | my $trans_offset = $trans_tab[$count + 1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | return if $orig_offset + $orig_length > $filesize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | return if $trans_offset + $trans_length > $filesize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | my @origs = split /\000/, substr $raw, $orig_offset, $orig_length; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | my @trans = split /\000/, substr $raw, $trans_offset, $trans_length; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | # The singular is the key, the plural plus all translations is the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | # value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | my $msgid = $origs[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | $msgid = '' unless defined $msgid && length $msgid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $msgid and length $msgid
MC/DC0%0/2
defined $msgid and length $msgid
defined $msgid
length $msgid
Truth table0%0/3
A and B
A= defined $msgidB= length $msgid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | my $msgstr = [ $origs[1], @trans ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $messages->{$msgid} = $msgstr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | $domain->{messages} = $messages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # Try to find po header information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | my $po_header = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | my $null_entry = $messages->{''}->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | ▶ | if ($null_entry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | my @lines = split /\n/, $null_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | foreach my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | my ($key, $value) = split /:/, $line, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | $key =~ s/-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | $po_header->{lc $key} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $domain->{po_header} = $po_header; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | ▶ | if (exists $domain->{po_header}->{content_type}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | my $content_type = $domain->{po_header}->{content_type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | if ($content_type =~ s/.*=//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | $domain->{po_header}->{charset} = $content_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | my $code = $domain->{po_header}->{plural_forms} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$domain->{'po_header'}{'plural_forms'} || ''
MC/DC0%0/1
$domain->{'po_header'}{'plural_forms'} || ''
$domain->{'po_header'}{'plural_forms'}
Truth table0%0/2
A
A= $domain->{'po_header'}{'plural_forms'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | # Whitespace, locale-independent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | my $s = '[ \011-\015]'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | # Untaint the plural header. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | # Keep line breaks as is (Perl 5_005 compatibility). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | $code = $domain->{po_header}->{plural_forms} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | = __untaint_plural_header $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $domain->{plural_func} = __compile_plural_function $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | unless (defined $domain->{po_header}->{charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $domain->{"po_header"}{"charset"} and length $domain->{"po_header"}{"charset"} and $locale =~ /^(?:[a-z][a-z])
(?:(?:_[A-Z][A-Z])?
(\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
defined $domain->{"po_header"}{"charset"} and length $domain->{"po_header"}{"charset"}
MC/DC0%0/3
defined $domain->{"po_header"}{"charset"} and length $domain->{"po_header"}{"charset"} and $locale =~ /^(?:[a-z][a-z])
(?:(?:_[A-Z][A-Z])?
(\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
defined $domain->{"po_header"}{"charset"}
length $domain->{"po_header"}{"charset"}
$locale =~ /^(?:[a-z][a-z])
(?:(?:_[A-Z][A-Z])?
(\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
Truth table0%0/4
A and B and C
A= defined $domain->{"po_header"}{"charset"}B= length $domain->{"po_header"}{"charset"}C= $locale =~ /^(?:[a-z][a-z])
(?:(?:_[A-Z][A-Z])?
(\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | && length $domain->{po_header}->{charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | && $locale =~ /^(?:[a-z][a-z]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | (?:(?:_[A-Z][A-Z])? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | (\.[-_A-Za-z0-9]+)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | (?:\@[-_A-Za-z0-9]+)?$/x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | $domain->{po_header}->{charset} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | if (defined $domain->{po_header}->{charset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | $domain->{po_header}->{charset} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | Locale::Recode->resolveAlias ($domain->{po_header}->{charset}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | return $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | sub __locale_category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 624 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__locale_category: called CC=12 SCAR=39.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 624 | my ($category, $category_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 624 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | # See https://github.com/gflohr/libintl-perl/issues/14! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 22 | ▶ | no if $] >= 5.022, warnings => 'locale'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 624 | my $value = eval {POSIX::setlocale ($category)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | # We support only XPG syntax, i. e. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | # language[_territory[.codeset]][@modifier]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 624 | ▶ | if (defined $value && $value ne 'C' && $value ne 'POSIX' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $value and $value ne "C" and $value ne "POSIX" and not $value =~ /^[a-z][a-z]
(?:_[A-Z][A-Z]
(?:\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
defined $value and $value ne "C" and $value ne "POSIX"
defined $value and $value ne "C"
MC/DC0%0/4
defined $value and $value ne "C" and $value ne "POSIX" and not $value =~ /^[a-z][a-z]
(?:_[A-Z][A-Z]
(?:\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
defined $value
$value ne "C"
$value ne "POSIX"
not $value =~ /^[a-z][a-z]
(?:_[A-Z][A-Z]
(?:\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
Truth table20%1/5
A and B and C and not(D)
A= defined $valueB= $value ne "C"C= $value ne "POSIX"D= not $value =~ /^[a-z][a-z]
(?:_[A-Z][A-Z]
(?:\.[-_A-Za-z0-9]+)?
)?
(?:\@[-_A-Za-z0-9]+)?$/lx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | && $value !~ /^[a-z][a-z] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | (?:_[A-Z][A-Z] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | (?:\.[-_A-Za-z0-9]+)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | (?:\@[-_A-Za-z0-9]+)?$/x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | undef $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 624 | ▶ | unless ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | $value = $ENV{LC_ALL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | $value = $ENV{$category_name} unless defined $value && length $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and length $value
MC/DC0%0/2
defined $value and length $value
defined $value
length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | $value = $ENV{LANG} unless defined $value && length $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and length $value
MC/DC0%0/2
defined $value and length $value
defined $value
length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | ▶ | return 'C' unless defined $value && length $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and length $value
MC/DC0%0/2
defined $value and length $value
defined $value
length $value
Truth table0%0/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 624 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | sub __get_codeset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__get_codeset: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | my ($category, $category_name, $locale_id) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | unless (defined $has_nl_langinfo) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | require I18N::Langinfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | $has_nl_langinfo = !$@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | if ($has_nl_langinfo) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | # Try to set the locale via the specified id. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | my $saved_locale = eval { POSIX::setlocale (LC_ALL) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my $had_lc_all = exists $ENV{LC_ALL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | my $saved_lc_all = $ENV{LC_ALL} if $had_lc_all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # Now try to set the locale via the environment. There is no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # point in calling the langinfo routines if this fails. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $ENV{LC_ALL} = $locale_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | my $codeset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | my $lc_all = eval { POSIX::setlocale (LC_ALL, $locale_id); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | $codeset = I18N::Langinfo::langinfo (I18N::Langinfo::CODESET()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | if defined $lc_all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | # Restore environment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | if ($saved_locale) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | eval { POSIX::setlocale (LC_ALL, $saved_locale); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | if ($had_lc_all) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | ▶ | $ENV{LC_ALL} = $saved_lc_all if $had_lc_all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | delete $ENV{LC_ALL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | return $codeset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 1 | ▶ | sub __untaint_plural_header { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__untaint_plural_header: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 1 | my ($code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | # Whitespace, locale-independent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 1 | my $s = '[ \t\r\n\013\014]'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 1 | ▶ | if ($code =~ m{^($s* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | nplurals$s*=$s*[0-9]+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | $s*;$s* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | plural$s*=$s*(?:$s|[-\?\|\&=!<>+*/\%:;a-zA-Z0-9_\(\)])+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | )}xms) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 1 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 1 | ▶ | sub __compile_plural_function { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__compile_plural_function: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 1 | my ($code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | # The leading and trailing space is necessary to be able to match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # against word boundaries. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 1 | my $plural_func; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 1 | ▶ | if (length $code) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 1 | my $code = ' ' . $code . ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 1 | $code =~ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | s/(?<=[^_a-zA-Z0-9])[_a-z][_A-Za-z0-9]*(?=[^_a-zA-Z0-9])/\$$&/gs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 1 | $code = "sub { my \$n = shift || 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | my (\$plural, \$nplurals); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | return (\$nplurals, \$plural ? \$plural : 0); }"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | # Now try to evaluate the code. There is no need to run the code in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | # a Safe compartment. The above substitutions should have destroyed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | # all evil code. Corrections are welcome! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | #warn $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 1 | $plural_func = eval $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | #warn $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 1 | ▶ | undef $plural_func if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | # Default is Germanic plural (which is incorrect for French). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 1 | ▶ | $plural_func = eval "sub { (2, 1 != shift || 0) }" unless $plural_func; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 1 | return $plural_func; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 22 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||