| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! /bin/false |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# vim: tabstop=4 |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Perl XS implementation of Uniforum message translation. |
|
6
|
|
|
|
|
|
|
# Copyright (C) 2002-2017 Guido Flohr , |
|
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 . |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Locale::gettext_xs; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
require DynaLoader; |
|
25
|
|
|
|
|
|
|
require Exporter; |
|
26
|
|
|
|
|
|
|
|
|
27
|
25
|
|
|
25
|
|
172
|
use vars qw (%EXPORT_TAGS @EXPORT_OK @ISA); |
|
|
25
|
|
|
|
|
51
|
|
|
|
25
|
|
|
|
|
22344
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
%EXPORT_TAGS = (locale_h => [ qw ( |
|
30
|
|
|
|
|
|
|
gettext |
|
31
|
|
|
|
|
|
|
dgettext |
|
32
|
|
|
|
|
|
|
dcgettext |
|
33
|
|
|
|
|
|
|
ngettext |
|
34
|
|
|
|
|
|
|
dngettext |
|
35
|
|
|
|
|
|
|
dcngettext |
|
36
|
|
|
|
|
|
|
pgettext |
|
37
|
|
|
|
|
|
|
dpgettext |
|
38
|
|
|
|
|
|
|
dcpgettext |
|
39
|
|
|
|
|
|
|
npgettext |
|
40
|
|
|
|
|
|
|
dnpgettext |
|
41
|
|
|
|
|
|
|
dcnpgettext |
|
42
|
|
|
|
|
|
|
textdomain |
|
43
|
|
|
|
|
|
|
bindtextdomain |
|
44
|
|
|
|
|
|
|
bind_textdomain_codeset |
|
45
|
|
|
|
|
|
|
) |
|
46
|
|
|
|
|
|
|
], |
|
47
|
|
|
|
|
|
|
libintl_h => [ qw (LC_CTYPE |
|
48
|
|
|
|
|
|
|
LC_NUMERIC |
|
49
|
|
|
|
|
|
|
LC_TIME |
|
50
|
|
|
|
|
|
|
LC_COLLATE |
|
51
|
|
|
|
|
|
|
LC_MONETARY |
|
52
|
|
|
|
|
|
|
LC_MESSAGES |
|
53
|
|
|
|
|
|
|
LC_ALL) |
|
54
|
|
|
|
|
|
|
], |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
@EXPORT_OK = qw (gettext |
|
58
|
|
|
|
|
|
|
dgettext |
|
59
|
|
|
|
|
|
|
dcgettext |
|
60
|
|
|
|
|
|
|
ngettext |
|
61
|
|
|
|
|
|
|
dngettext |
|
62
|
|
|
|
|
|
|
dcngettext |
|
63
|
|
|
|
|
|
|
pgettext |
|
64
|
|
|
|
|
|
|
dpgettext |
|
65
|
|
|
|
|
|
|
dcpgettext |
|
66
|
|
|
|
|
|
|
npgettext |
|
67
|
|
|
|
|
|
|
dnpgettext |
|
68
|
|
|
|
|
|
|
dcnpgettext |
|
69
|
|
|
|
|
|
|
textdomain |
|
70
|
|
|
|
|
|
|
bindtextdomain |
|
71
|
|
|
|
|
|
|
bind_textdomain_codeset |
|
72
|
|
|
|
|
|
|
nl_putenv |
|
73
|
|
|
|
|
|
|
setlocale |
|
74
|
|
|
|
|
|
|
LC_CTYPE |
|
75
|
|
|
|
|
|
|
LC_NUMERIC |
|
76
|
|
|
|
|
|
|
LC_TIME |
|
77
|
|
|
|
|
|
|
LC_COLLATE |
|
78
|
|
|
|
|
|
|
LC_MONETARY |
|
79
|
|
|
|
|
|
|
LC_MESSAGES |
|
80
|
|
|
|
|
|
|
LC_ALL); |
|
81
|
|
|
|
|
|
|
@ISA = qw (Exporter DynaLoader); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
bootstrap Locale::gettext_xs; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
require File::Spec; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Reimplement pgettext functions |
|
88
|
|
|
|
|
|
|
sub pgettext ($$) { |
|
89
|
0
|
|
|
0
|
0
|
0
|
my ($msgctxt, $msgid) = @_; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
my $msg_ctxt_id = join("\004", $msgctxt, $msgid); |
|
92
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_pgettext_aux |
|
93
|
|
|
|
|
|
|
("", $msg_ctxt_id, $msgid, Locale::gettext_xs::LC_MESSAGES()); |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
sub dpgettext ($$$) { |
|
96
|
0
|
|
|
0
|
0
|
0
|
my ($domain, $msgctxt, $msgid) = @_; |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
my $msg_ctxt_id = join("\004", $msgctxt, $msgid); |
|
99
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_pgettext_aux |
|
100
|
|
|
|
|
|
|
($domain, $msg_ctxt_id, $msgid, Locale::gettext_xs::LC_MESSAGES()); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
sub dcpgettext ($$$$) { |
|
103
|
0
|
|
|
0
|
0
|
0
|
my ($domain, $msgctxt, $msgid, $category) = @_; |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
0
|
my $msg_ctxt_id = join("\004", $msgctxt, $msgid); |
|
106
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_pgettext_aux |
|
107
|
|
|
|
|
|
|
($domain, $msg_ctxt_id, $msgid, $category); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Reimplement npgettext functions |
|
111
|
|
|
|
|
|
|
sub npgettext ($$$$) { |
|
112
|
0
|
|
|
0
|
0
|
0
|
my ($msgctxt, $msgid1, $msgid2, $n) = @_; |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
0
|
my $msg_ctxt_id = join("\004", $msgctxt, $msgid1); |
|
115
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_npgettext_aux |
|
116
|
|
|
|
|
|
|
("", $msg_ctxt_id, $msgid1, $msgid2, $n, Locale::gettext_xs::LC_MESSAGES()); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
sub dnpgettext ($$$$$) { |
|
119
|
0
|
|
|
0
|
0
|
0
|
my ($domain, $msgctxt, $msgid1, $msgid2, $n) = @_; |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
my $msg_ctxt_id = join("\004", $msgctxt, $msgid1); |
|
122
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_npgettext_aux |
|
123
|
|
|
|
|
|
|
($domain, $msg_ctxt_id, $msgid1, $msgid2, $n, Locale::gettext_xs::LC_MESSAGES()); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
sub dcnpgettext ($$$$$$) { |
|
126
|
0
|
|
|
0
|
0
|
0
|
my ($domain, $msgctxt, $msgid1, $msgid2, $n, $category) = @_; |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
0
|
my $msg_ctxt_id = join("\004", $msgctxt, $msgid1); |
|
129
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_npgettext_aux |
|
130
|
|
|
|
|
|
|
($domain, $msg_ctxt_id, $msgid1, $msgid2, $n, $category); |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# Wrapper function that converts Perl paths to OS paths. |
|
134
|
|
|
|
|
|
|
sub bindtextdomain ($;$) { |
|
135
|
0
|
|
|
0
|
0
|
0
|
my ($domain, $directory) = @_; |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
0
|
0
|
|
|
0
|
if (defined $domain && length $domain && |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
138
|
|
|
|
|
|
|
defined $directory && length $directory) { |
|
139
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_bindtextdomain |
|
140
|
|
|
|
|
|
|
($domain, File::Spec->catdir ($directory)); |
|
141
|
|
|
|
|
|
|
} else { |
|
142
|
0
|
|
|
|
|
0
|
return &Locale::gettext_xs::_bindtextdomain; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# In the XS version, making the prototype optional, does not work. |
|
147
|
|
|
|
|
|
|
sub textdomain (;$) { |
|
148
|
1
|
|
|
1
|
0
|
2
|
my $domain = shift; |
|
149
|
|
|
|
|
|
|
|
|
150
|
1
|
50
|
|
|
|
4
|
if (defined $domain) { |
|
151
|
0
|
|
|
|
|
0
|
return Locale::gettext_xs::_textdomain ($domain); |
|
152
|
|
|
|
|
|
|
} else { |
|
153
|
1
|
|
|
|
|
6
|
return Locale::gettext_xs::_textdomain (""); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub nl_putenv ($) { |
|
158
|
5
|
|
|
5
|
0
|
9
|
my ($envspec) = @_; |
|
159
|
|
|
|
|
|
|
|
|
160
|
5
|
50
|
|
|
|
10
|
return unless defined $envspec; |
|
161
|
5
|
50
|
|
|
|
10
|
return unless length $envspec; |
|
162
|
5
|
50
|
|
|
|
12
|
return if substr ($envspec, 0, 1) eq '='; |
|
163
|
|
|
|
|
|
|
|
|
164
|
5
|
|
|
|
|
11
|
my ($var, $value) = split /=/, $envspec, 2; |
|
165
|
|
|
|
|
|
|
|
|
166
|
5
|
50
|
|
|
|
14
|
if ($^O eq 'MSWin32') { |
|
167
|
0
|
0
|
|
|
|
0
|
$value = '' unless defined $value; |
|
168
|
0
|
0
|
|
|
|
0
|
return unless Locale::gettext_xs::_nl_putenv ("$var=$value") == 0; |
|
169
|
0
|
0
|
|
|
|
0
|
if (length $value) { |
|
170
|
0
|
|
|
|
|
0
|
$ENV{$var} = $value; |
|
171
|
|
|
|
|
|
|
} else { |
|
172
|
0
|
|
|
|
|
0
|
delete $ENV{$var}; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
} else { |
|
175
|
5
|
50
|
|
|
|
7
|
if (defined $value) { |
|
176
|
5
|
|
|
|
|
23
|
$ENV{$var} = $value; |
|
177
|
|
|
|
|
|
|
} else { |
|
178
|
0
|
|
|
|
|
0
|
delete $ENV{$var}; |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
5
|
|
|
|
|
9
|
return 1; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
1; |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
__END__ |