CLI/L10N/nl.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 24 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 100% 72 / 72 CC 13 SCAR 17.7
CC
13
Cov
100%
singularize
9.0
numerate
5.0
BEGIN
1.0
CRAP 5.8
« CLI/Argument/Number.pm ↑ Summary CLI/Role/CommandSet.pm »
1 #=============================================================================
2 #
3 # Module: Term::CLI::L10N::nl
4 # Author: Steven Bakker (SBAKKER), <sbakker@cpan.org>
5 # Created: 27/02/18
6 #
7 # Copyright (c) 2018-2022 Steven Bakker; All rights reserved.
8 #
9 # This module is free software; you can redistribute it and/or modify
10 # it under the same terms as Perl itself. See "perldoc perlartistic."
11 #
12 # This software is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 #
16 #=============================================================================
17  
18 package Term::CLI::L10N::nl 0.061000;
19  
20 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use parent 0.225 qw( Term::CLI::L10N );
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶use Locale::Maketext::Lexicon::Gettext 1.00;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 ## no critic (ProhibitPackageVars)
28 1 our %Lexicon = %{ Locale::Maketext::Lexicon::Gettext->parse(<DATA>) };
29 1 close DATA;
30  
31 # $str = $lh->singularize($num, $plural);
32 # $str = $lh->singularise($num, $plural);
33 1 ▶use subs 1.00 qw( singularise );
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 *singularise = \&singularize;
35  
36 sub singularize {
37 37 ▶ my $self = shift;
Subroutine singularize: called CC=9 SCAR=22.0
Pod documented
38  
39 37 local ($_) = shift;
40  
41 # -zen, -ven -> -s, -f
42 37 ▶ s/zen$/s/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/zen$/s/ux and return $_ 1 36 37
43 36 ▶ s/ven$/f/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/ven$/f/ux and return $_ 1 35 36
44  
45 # -eu?en, -ei?en
46 35 ▶ s/(eu|ei)([^aeiou])en$/$1$2/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/(eu|ei)([^aeiou])en$/$1$2/ux and return $_ 1 34 35
47  
48 # gelegenheden -> gelegenheid
49 34 ▶ s/heden$/heid/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/heden$/heid/ux and return $_ 1 33 34
50  
51 # musea -> museum
52 # aquaria -> aquarium
53 33 ▶ s/([ei])a$/$1um/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/([ei])a$/$1um/ux and return $_ 3 30 33
54  
55 # rijen -> rij
56 30 ▶ s/ijen$/ij/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/ijen$/ij/ux and return $_ 1 29 30
57  
58 # leraren -> leraar
59 29 ▶ s/([aeiou])([^aeiou])en$/$1$1$2/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/([aeiou])([^aeiou])en$/$1$1$2/ux and return $_ 4 25 29
60  
61 # ballen -> bal
62 25 ▶ s/([^aeiou])\1en$/$1/x and return $_;
Branch: 1 branch
BranchTrueFalseTotal
s/([^aeiou])\1en$/$1/ux and return $_ 1 24 25
63  
64 # schermen -> scherm
65 # auto's -> auto
66 # lepels -> lepel
67 24 return s/(?:'?en|'s|s)$//rx;
68 }
69  
70 # $str = $lh->numerate($num, $plural [, $singular ]);
71 #
72 # NOTE: this reverses the semantics of the
73 # plural/singular forms, because it's easier
74 # to go from plural to singular in Dutch.
75 #
76 sub numerate {
77 150 ▶ my ( $handle, $num, @forms ) = @_;
Subroutine numerate: called CC=5 SCAR=16.1
Pod documented
78  
79 150 my $is_plural = ( $num != 1 );
80  
81 150 ▶ return '' if @forms == 0;
Branch: 1 branch
BranchTrueFalseTotal
if @forms == 0 2 148 150
82  
83 148 ▶ if (@forms > 1) { # Both plural and singular are supplied
Branch: 1 branch
BranchTrueFalseTotal
if (@forms > 1) 74 74 148
84 74 ▶ return $is_plural ? $forms[0] : $forms[1];
Branch: 1 branch
BranchTrueFalseTotal
$is_plural ? : 37 37 74
85 }
86  
87 # Only plural specified
88 74 my $word = $forms[0];
89 74 ▶ if ($is_plural) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_plural) 37 37 74
90 37 return $word;
91 }
92 37 return $handle->singularize($word);
93 }
94  
95 1 1;
96  
97 __DATA__
98 #:
99 msgid ""
100 msgstr ""
101  
102 "Project-ID-Version: Term::CLI 0.01\n"
103 "MIME-Version: 1.0\n"
104 "Content-Type: text/plain; charset=utf-8\n"
105 "Content-Transfer-Encoding: 8bit\n"
106  
107 ##############################################################################
108 ### lib/Term/CLI/Argument/Bool.pm ############################################
109  
110 #: lib/Term/CLI/Argument/Bool.pm:94
111 msgid "invalid boolean value"
112 msgstr "ongeldige booleaanse waarde"
113  
114 #: lib/Term/CLI/Argument/Bool.pm:83
115 msgid "ambiguous boolean value (matches [%1] and [%2])"
116 msgstr "geen eenduidige booleaanse waarde (komt overeen met zowel [%1] als [%2])"
117  
118 ##############################################################################
119 ### lib/Term/CLI/Argument/Enum.pm ############################################
120  
121 #: lib/Term/CLI/Argument/Enum.pm:50
122 msgid "not a valid value"
123 msgstr "geen geldige waarde"
124  
125 #:
126 msgid "ambiguous value (matches: %1)"
127 msgstr "geen eenduidige waarde (komt overeen met: %1)"
128  
129 ##############################################################################
130 ### lib/Term/CLI/Argument/Number.pm ##########################################
131  
132 #: lib/Term/CLI/Argument/Number.pm
133 msgid "not a valid number"
134 msgstr "geen geldig getal"
135  
136 #: lib/Term/CLI/Argument/Number.pm
137 msgid "too small"
138 msgstr "getal te klein"
139  
140 #: lib/Term/CLI/Argument/Number.pm
141 msgid "too large"
142 msgstr "getal te groot"
143  
144 ##############################################################################
145 ### lib/Term/CLI/Argument.pm #################################################
146  
147 #: lib/Term/CLI/Argument.pm
148 msgid "value cannot be empty"
149 msgstr "waarde mag niet leeg zijn"
150  
151 ##############################################################################
152 ### lib/Term/CLI/Argument/String.pm ##########################################
153  
154 #: lib/Term/CLI/Argument/String.pm
155 msgid "value must be defined"
156 msgstr "waarde moet gedefinieerd zijn"
157  
158 #: lib/Term/CLI/Argument/String.pm
159 msgid "too short (min. length %1)"
160 msgstr "te kort (min. lengte %1)"
161  
162 #: lib/Term/CLI/Argument/String.pm
163 msgid "too long (max. length %1)"
164 msgstr "te lang (max. lengte %1)"
165  
166 ##############################################################################
167 ### lib/Term/CLI/Command/Help.pm #############################################
168  
169 #: lib/Term/CLI/Command/Help.pm
170 msgid ""
171 "Show help for any given command sequence (or a command\n"
172 "overview if no argument is given).\n\n"
173 "The C<--pod> (C<-p>) option will cause raw POD\n"
174 "to be shown.\n\n"
175 "The C<--all> (C<-a>) option will list help text for all commands."
176 msgstr ""
177 "Toon hulp voor willekeurige commando's (of een overzicht\n"
178 "van commando's als er geen argumenten worden aangeleverd).\n\n"
179 "De C<--pod> (C<-p>) optie geeft POD broncode als uitvoer.\n\n"
180 "De C<--all> (C<-a>) optie geeft uitgebreide hulp voor alle\n"
181 "commando's."
182  
183 #: lib/Term/CLI/Command/Help.pm
184 msgid "show help"
185 msgstr "toon hulp"
186  
187 #: lib/Term/CLI/Command/Help.pm
188 msgid "Commands"
189 msgstr "Commando's"
190  
191 #: lib/Term/CLI/Command/Help.pm
192 msgid "COMMANDS"
193 msgstr "COMMANDO'S"
194  
195 #: lib/Term/CLI/Command/Help.pm
196 msgid "COMMAND SUMMARY"
197 msgstr "COMMANDO OVERZICHT"
198  
199 #: lib/Term/CLI/Command/Help.pm
200 msgid "Usage"
201 msgstr "Gebruiksoverzicht"
202  
203 #: lib/Term/CLI/Command/Help.pm
204 msgid "Description"
205 msgstr "Beschrijving"
206  
207 #: lib/Term/CLI/Command/Help.pm
208 msgid "Sub-Commands"
209 msgstr "Sub-Commando's"
210  
211 #: lib/Term/CLI/Command/Help.pm
212 msgid "cannot run '%1': %2"
213 msgstr "kan programma '%1' niet starten: %2"
214  
215 ##############################################################################
216 ### lib/Term/CLI/Role/CommandSet.pm ##########################################
217  
218 #: lib/Term/CLI/Role/CommandSet.pm:138
219 msgid "unknown command '%1'"
220 msgstr "onbekende instructie '%1'"
221  
222 #: lib/Term/CLI/Role/CommandSet.pm:142
223 msgid "ambiguous command '%1' (matches: %2)"
224 msgstr "geen eenduidig commando '%1' (komt overeen met: %2)"
225  
226 ##############################################################################
227 ### lib/Term/CLI/Command.pm ##################################################
228  
229 #: lib/Term/CLI/Command.pm
230 msgid "for"
231 msgstr "voor"
232  
233 #: lib/Term/CLI/Command.pm
234 msgid "missing '%1' argument"
235 msgstr "'%1' argument is niet ingevoerd"
236  
237 #: lib/Term/CLI/Command.pm
238 msgid "need %1 '%2' %numerate(%1,argument)"
239 msgstr "er zijn %1 '%2' %numerate(%1,argumenten) nodig"
240  
241 #: lib/Term/CLI/Command.pm
242 msgid "need %1 or %2 '%3' arguments"
243 msgstr "er zijn %1 of %2 '%3' argumenten nodig"
244  
245 #: lib/Term/CLI/Command.pm
246 msgid "need between %1 and %2 '%3' arguments"
247 msgstr "er zijn %1 t/m %2 '%3' argumenten nodig"
248  
249 #: lib/Term/CLI/Command.pm
250 msgid "need at least %1 '%2' %numerate(%1,argument)"
251 msgstr "er %numerate(%1,zijn,is) tenminste %1 '%2' %numerate(%1,argumenten) nodig"
252  
253 #: lib/Term/CLI/Command.pm
254 msgid "no arguments allowed"
255 msgstr "argumenten zijn niet toegestaan"
256  
257 #: lib/Term/CLI/Command.pm
258 msgid "too many '%1' arguments (max. %2)"
259 msgstr "teveel '%1' argumenten (max. %2)"
260  
261 #: lib/Term/CLI/Command.pm
262 msgid "incomplete command: missing '%1'"
263 msgstr "commando niet compleet: verwachte '%1' niet gezien"
264  
265 #: lib/Term/CLI/Command.pm
266 msgid "missing sub-command"
267 msgstr "commando niet compleet (sub-commando verwacht)"
268  
269 #: lib/Term/CLI/Command.pm
270 msgid "expected '%1' instead of '%2'"
271 msgstr "'%1' verwacht in plaats van '%2'"
272  
273 #: lib/Term/CLI/Command.pm
274 msgid "unknown sub-command '%1'"
275 msgstr "onbekende sub-instructie '%1'"
276  
277 #############################################################################
278 ### lib/Term/CLI.pm #########################################################
279  
280 #: lib/Term/CLI.pm:146
281 msgid "ERROR"
282 msgstr "FOUT"
283  
284 #: lib/Term/CLI.pm:171
285 msgid "unbalanced quotes in input"
286 msgstr "invoer bevat ongebalanceerde aanhalingstekens"
287  
288 #: lib/Term/CLI.pm:372
289 msgid "missing command"
290 msgstr "commando ontbreekt"
291  
292 __END__
293  
294 =pod
295  
296 =head1 NAME
297  
298 Term::CLI::L10N::nl - Dutch localizations for Term::CLI
299  
300 =head1 VERSION
301  
302 version 0.061000
303  
304 =head1 SYNOPSIS
305  
306 use Term::CLI::L10N qw( loc );
307  
308 Term::CLI::L10N->set_language('nl');
309  
310 say loc("ERROR"); # -> FOUT
311  
312 say Term::CLI::L10N->quant(1, 'dingen'); # -> 1 ding
313 say Term::CLI::L10N->quant(1, 'leraren'); # -> 1 leraar
314  
315 =head1 DESCRIPTION
316  
317 The C<Term::CLI::L10N::nl> module is derived from the
318 L<Term::CLI::L10N>(3p) class to provide Dutch translations for
319 the messages of the L<Term::CLI>(3p) library.
320  
321 It implements its own C<numerate> method that reverses the
322 meaning of its "form" arguments (because it's easier to derive
323 the singular noun from the plural in Dutch).
324  
325 It defines its lexicon using L<Locale::Maketext::Lexicon::Gettext>(3p)
326 and the C<__DATA__> block.
327  
328 =head1 CONSTRUCTORS
329  
330 Inherits its constructor from L<Term::CLI::L10N>, though it should
331 not be called directly.
332  
333 =head1 METHODS
334  
335 =over
336  
337 =item B<singularise> ( I<Str> )
338  
339 =item B<singularize> ( I<Str> )
340  
341 Take I<Str> as a plural noun and return its singular form.
342  
343 =item B<numerate> ( I<$num>, I<$plural> [, I<$singular>] )
344  
345 Overrides the parent's C<numerate> method, see L<Locale::Maketext>(3p).
346  
347 Note that the I<$plural> and I<$singular> forms are reversed here, and
348 that there is no C<$negative> (or, if given, it will be ignored).
349  
350 =back
351  
352 =head1 SEE ALSO
353  
354 L<Term::CLI::L10N>(3p),
355 L<Term::CLI>(3p),
356 L<perl>(1).
357  
358 =head1 AUTHOR
359  
360 Steven Bakker E<lt>sbakker@cpan.orgE<gt>.
361  
362 =head1 COPYRIGHT AND LICENSE
363  
364 Copyright (c) 2018 Steven Bakker; All rights reserved.
365  
366 This module is free software; you can redistribute it and/or modify
367 it under the same terms as Perl itself. See "perldoc perlartistic."
368  
369 This software is distributed in the hope that it will be useful,
370 but WITHOUT ANY WARRANTY; without even the implied warranty of
371 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
372  
373 =cut
« CLI/Argument/Number.pm ↑ Summary CLI/Role/CommandSet.pm »