1
#! /usr/local/bin/perl -w
10
use constant NUM_TESTS => 85;
12
use Locale::Messages qw (nl_putenv bindtextdomain textdomain gettext);
18
if ($0 =~ /_pp\.t$/) {
19
$package = 'gettext_pp';
21
$package = 'gettext_xs';
24
my $selected = Locale::Messages->select_package ($package);
25
if ($selected ne $package && 'gettext_xs' eq $package) {
26
print "1..0 # Skip: Locale::$package not available here.\n";
30
plan tests => NUM_TESTS;
33
# Clean environment first.
34
foreach my $var (keys %ENV) {
35
if ('LC_' eq substr $var, 0, 3) {
40
nl_putenv "LC_ALL=de_DE";
41
nl_putenv "LC_MESSAGES=de_DE";
42
my $missing_locale = POSIX::setlocale (POSIX::LC_ALL() => '') ?
43
'' : 'locale de_DE missing';
44
POSIX::setlocale (POSIX::LC_ALL() => 'C');
47
$locale_dir =~ s,[^\\/]+$,, or $locale_dir = '.';
48
$locale_dir .= '/LocaleData';
50
my $textdomain = 'existing';
51
my $bound_dir = bindtextdomain $textdomain => $locale_dir;
53
ok defined $bound_dir;
54
ok (File::Spec->catdir ($bound_dir), File::Spec->catdir ($locale_dir));
56
my $bound_domain = textdomain $textdomain;
58
ok defined $bound_domain;
59
ok $bound_domain, $textdomain;
63
nl_putenv 'LC_MESSAGES';
65
POSIX::setlocale (POSIX::LC_ALL(), '');
66
skip $missing_locale, gettext ('May'), 'May';
70
nl_putenv 'LC_MESSAGES';
72
POSIX::setlocale (POSIX::LC_ALL(), '');
73
skip $missing_locale, gettext ('May'), 'May';
77
nl_putenv 'LC_MESSAGES';
78
nl_putenv 'LC_ALL=de_DE';
79
POSIX::setlocale (POSIX::LC_ALL(), '');
80
skip $missing_locale, gettext ('May'), 'Mai';
84
nl_putenv 'LC_MESSAGES=C';
86
POSIX::setlocale (POSIX::LC_ALL(), '');
87
skip $missing_locale, gettext ('May'), 'May';
91
nl_putenv 'LC_MESSAGES=C';
93
POSIX::setlocale (POSIX::LC_ALL(), '');
94
skip $missing_locale, gettext ('May'), 'May';
98
nl_putenv 'LC_MESSAGES=C';
99
nl_putenv 'LC_ALL=de_DE';
100
POSIX::setlocale (POSIX::LC_ALL(), '');
101
skip $missing_locale, gettext ('May'), 'Mai';
103
nl_putenv 'LANGUAGE';
105
nl_putenv 'LC_MESSAGES=de_DE';
107
POSIX::setlocale (POSIX::LC_ALL(), '');
108
skip $missing_locale, gettext ('May'), 'Mai';
110
nl_putenv 'LANGUAGE';
112
nl_putenv 'LC_MESSAGES=de_DE';
113
nl_putenv 'LC_ALL=C';
114
POSIX::setlocale (POSIX::LC_ALL(), '');
115
skip $missing_locale, gettext ('May'), 'May';
117
nl_putenv 'LANGUAGE';
119
nl_putenv 'LC_MESSAGES=de_DE';
120
nl_putenv 'LC_ALL=de_DE';
121
POSIX::setlocale (POSIX::LC_ALL(), '');
122
skip $missing_locale, gettext ('May'), 'Mai';
124
nl_putenv 'LANGUAGE';
126
nl_putenv 'LC_MESSAGES';
128
POSIX::setlocale (POSIX::LC_ALL(), '');
129
skip $missing_locale, gettext ('May'), 'May';
131
nl_putenv 'LANGUAGE';
133
nl_putenv 'LC_MESSAGES';
134
nl_putenv 'LC_ALL=C';
135
POSIX::setlocale (POSIX::LC_ALL(), '');
136
skip $missing_locale, gettext ('May'), 'May';
138
nl_putenv 'LANGUAGE';
140
nl_putenv 'LC_MESSAGES';
141
nl_putenv 'LC_ALL=de_DE';
142
POSIX::setlocale (POSIX::LC_ALL(), '');
143
skip $missing_locale, gettext ('May'), 'Mai';
145
nl_putenv 'LANGUAGE';
147
nl_putenv 'LC_MESSAGES=C';
149
POSIX::setlocale (POSIX::LC_ALL(), '');
150
skip $missing_locale, gettext ('May'), 'May';
152
nl_putenv 'LANGUAGE';
154
nl_putenv 'LC_MESSAGES=C';
155
nl_putenv 'LC_ALL=C';
156
POSIX::setlocale (POSIX::LC_ALL(), '');
157
skip $missing_locale, gettext ('May'), 'May';
159
nl_putenv 'LANGUAGE';
161
nl_putenv 'LC_MESSAGES=C';
162
nl_putenv 'LC_ALL=de_DE';
163
POSIX::setlocale (POSIX::LC_ALL(), '');
164
skip $missing_locale, gettext ('May'), 'Mai';
166
nl_putenv 'LANGUAGE';
168
nl_putenv 'LC_MESSAGES=de_DE';
170
POSIX::setlocale (POSIX::LC_ALL(), '');
171
skip $missing_locale, gettext ('May'), 'Mai';
173
nl_putenv 'LANGUAGE';
175
nl_putenv 'LC_MESSAGES=de_DE';
176
nl_putenv 'LC_ALL=C';
177
POSIX::setlocale (POSIX::LC_ALL(), '');
178
skip $missing_locale, gettext ('May'), 'May';
180
nl_putenv 'LANGUAGE';
182
nl_putenv 'LC_MESSAGES=de_DE';
183
nl_putenv 'LC_ALL=de_DE';
184
POSIX::setlocale (POSIX::LC_ALL(), '');
185
skip $missing_locale, gettext ('May'), 'Mai';
187
nl_putenv 'LANGUAGE';
188
nl_putenv 'LANG=de_DE';
189
nl_putenv 'LC_MESSAGES';
191
POSIX::setlocale (POSIX::LC_ALL(), '');
192
skip $missing_locale, gettext ('May'), 'Mai';
194
nl_putenv 'LANGUAGE';
195
nl_putenv 'LANG=de_DE';
196
nl_putenv 'LC_MESSAGES';
197
nl_putenv 'LC_ALL=C';
198
POSIX::setlocale (POSIX::LC_ALL(), '');
199
skip $missing_locale, gettext ('May'), 'May';
201
nl_putenv 'LANGUAGE';
202
nl_putenv 'LANG=de_DE';
203
nl_putenv 'LC_MESSAGES';
204
nl_putenv 'LC_ALL=de_DE';
205
POSIX::setlocale (POSIX::LC_ALL(), '');
206
skip $missing_locale, gettext ('May'), 'Mai';
208
nl_putenv 'LANGUAGE';
209
nl_putenv 'LANG=de_DE';
210
nl_putenv 'LC_MESSAGES=C';
212
POSIX::setlocale (POSIX::LC_ALL(), '');
213
skip $missing_locale, gettext ('May'), 'May';
215
nl_putenv 'LANGUAGE';
216
nl_putenv 'LANG=de_DE';
217
nl_putenv 'LC_MESSAGES=C';
218
nl_putenv 'LC_ALL=C';
219
POSIX::setlocale (POSIX::LC_ALL(), '');
220
skip $missing_locale, gettext ('May'), 'May';
222
nl_putenv 'LANGUAGE';
223
nl_putenv 'LANG=de_DE';
224
nl_putenv 'LC_MESSAGES=C';
225
nl_putenv 'LC_ALL=de_DE';
226
POSIX::setlocale (POSIX::LC_ALL(), '');
227
skip $missing_locale, gettext ('May'), 'Mai';
229
nl_putenv 'LANGUAGE';
230
nl_putenv 'LANG=de_DE';
231
nl_putenv 'LC_MESSAGES=de_DE';
233
POSIX::setlocale (POSIX::LC_ALL(), '');
234
skip $missing_locale, gettext ('May'), 'Mai';
236
nl_putenv 'LANGUAGE';
237
nl_putenv 'LANG=de_DE';
238
nl_putenv 'LC_MESSAGES=de_DE';
239
nl_putenv 'LC_ALL=C';
240
POSIX::setlocale (POSIX::LC_ALL(), '');
241
skip $missing_locale, gettext ('May'), 'May';
243
nl_putenv 'LANGUAGE';
244
nl_putenv 'LANG=de_DE';
245
nl_putenv 'LC_MESSAGES=de_DE';
246
nl_putenv 'LC_ALL=de_DE';
247
POSIX::setlocale (POSIX::LC_ALL(), '');
248
skip $missing_locale, gettext ('May'), 'Mai';
250
nl_putenv 'LANGUAGE=C';
252
nl_putenv 'LC_MESSAGES';
254
POSIX::setlocale (POSIX::LC_ALL(), '');
255
skip $missing_locale, gettext ('May'), 'May';
257
nl_putenv 'LANGUAGE=C';
259
nl_putenv 'LC_MESSAGES';
260
nl_putenv 'LC_ALL=C';
261
POSIX::setlocale (POSIX::LC_ALL(), '');
262
skip $missing_locale, gettext ('May'), 'May';
264
nl_putenv 'LANGUAGE=C';
266
nl_putenv 'LC_MESSAGES';
267
nl_putenv 'LC_ALL=de_DE';
268
POSIX::setlocale (POSIX::LC_ALL(), '');
269
skip $missing_locale, gettext ('May'), 'May';
271
nl_putenv 'LANGUAGE=C';
273
nl_putenv 'LC_MESSAGES=C';
275
POSIX::setlocale (POSIX::LC_ALL(), '');
276
skip $missing_locale, gettext ('May'), 'May';
278
nl_putenv 'LANGUAGE=C';
280
nl_putenv 'LC_MESSAGES=C';
281
nl_putenv 'LC_ALL=C';
282
POSIX::setlocale (POSIX::LC_ALL(), '');
283
skip $missing_locale, gettext ('May'), 'May';
285
nl_putenv 'LANGUAGE=C';
287
nl_putenv 'LC_MESSAGES=C';
288
nl_putenv 'LC_ALL=de_DE';
289
POSIX::setlocale (POSIX::LC_ALL(), '');
290
skip $missing_locale, gettext ('May'), 'May';
292
nl_putenv 'LANGUAGE=C';
294
nl_putenv 'LC_MESSAGES=de_DE';
296
POSIX::setlocale (POSIX::LC_ALL(), '');
297
skip $missing_locale, gettext ('May'), 'May';
299
nl_putenv 'LANGUAGE=C';
301
nl_putenv 'LC_MESSAGES=de_DE';
302
nl_putenv 'LC_ALL=C';
303
POSIX::setlocale (POSIX::LC_ALL(), '');
304
skip $missing_locale, gettext ('May'), 'May';
306
nl_putenv 'LANGUAGE=C';
308
nl_putenv 'LC_MESSAGES=de_DE';
309
nl_putenv 'LC_ALL=de_DE';
310
POSIX::setlocale (POSIX::LC_ALL(), '');
311
skip $missing_locale, gettext ('May'), 'May';
313
nl_putenv 'LANGUAGE=C';
315
nl_putenv 'LC_MESSAGES';
317
POSIX::setlocale (POSIX::LC_ALL(), '');
318
skip $missing_locale, gettext ('May'), 'May';
320
nl_putenv 'LANGUAGE=C';
322
nl_putenv 'LC_MESSAGES';
323
nl_putenv 'LC_ALL=C';
324
POSIX::setlocale (POSIX::LC_ALL(), '');
325
skip $missing_locale, gettext ('May'), 'May';
327
nl_putenv 'LANGUAGE=C';
329
nl_putenv 'LC_MESSAGES';
330
nl_putenv 'LC_ALL=de_DE';
331
POSIX::setlocale (POSIX::LC_ALL(), '');
332
skip $missing_locale, gettext ('May'), 'May';
334
nl_putenv 'LANGUAGE=C';
336
nl_putenv 'LC_MESSAGES=C';
338
POSIX::setlocale (POSIX::LC_ALL(), '');
339
skip $missing_locale, gettext ('May'), 'May';
341
nl_putenv 'LANGUAGE=C';
343
nl_putenv 'LC_MESSAGES=C';
344
nl_putenv 'LC_ALL=C';
345
POSIX::setlocale (POSIX::LC_ALL(), '');
346
skip $missing_locale, gettext ('May'), 'May';
348
nl_putenv 'LANGUAGE=C';
350
nl_putenv 'LC_MESSAGES=C';
351
nl_putenv 'LC_ALL=de_DE';
352
POSIX::setlocale (POSIX::LC_ALL(), '');
353
skip $missing_locale, gettext ('May'), 'May';
355
nl_putenv 'LANGUAGE=C';
357
nl_putenv 'LC_MESSAGES=de_DE';
359
POSIX::setlocale (POSIX::LC_ALL(), '');
360
skip $missing_locale, gettext ('May'), 'May';
362
nl_putenv 'LANGUAGE=C';
364
nl_putenv 'LC_MESSAGES=de_DE';
365
nl_putenv 'LC_ALL=C';
366
POSIX::setlocale (POSIX::LC_ALL(), '');
367
skip $missing_locale, gettext ('May'), 'May';
369
nl_putenv 'LANGUAGE=C';
371
nl_putenv 'LC_MESSAGES=de_DE';
372
nl_putenv 'LC_ALL=de_DE';
373
POSIX::setlocale (POSIX::LC_ALL(), '');
374
skip $missing_locale, gettext ('May'), 'May';
376
nl_putenv 'LANGUAGE=C';
377
nl_putenv 'LANG=de_DE';
378
nl_putenv 'LC_MESSAGES';
380
POSIX::setlocale (POSIX::LC_ALL(), '');
381
skip $missing_locale, gettext ('May'), 'May';
383
nl_putenv 'LANGUAGE=C';
384
nl_putenv 'LANG=de_DE';
385
nl_putenv 'LC_MESSAGES';
386
nl_putenv 'LC_ALL=C';
387
POSIX::setlocale (POSIX::LC_ALL(), '');
388
skip $missing_locale, gettext ('May'), 'May';
390
nl_putenv 'LANGUAGE=C';
391
nl_putenv 'LANG=de_DE';
392
nl_putenv 'LC_MESSAGES';
393
nl_putenv 'LC_ALL=de_DE';
394
POSIX::setlocale (POSIX::LC_ALL(), '');
395
skip $missing_locale, gettext ('May'), 'May';
397
nl_putenv 'LANGUAGE=C';
398
nl_putenv 'LANG=de_DE';
399
nl_putenv 'LC_MESSAGES=C';
401
POSIX::setlocale (POSIX::LC_ALL(), '');
402
skip $missing_locale, gettext ('May'), 'May';
404
nl_putenv 'LANGUAGE=C';
405
nl_putenv 'LANG=de_DE';
406
nl_putenv 'LC_MESSAGES=C';
407
nl_putenv 'LC_ALL=C';
408
POSIX::setlocale (POSIX::LC_ALL(), '');
409
skip $missing_locale, gettext ('May'), 'May';
411
nl_putenv 'LANGUAGE=C';
412
nl_putenv 'LANG=de_DE';
413
nl_putenv 'LC_MESSAGES=C';
414
nl_putenv 'LC_ALL=de_DE';
415
POSIX::setlocale (POSIX::LC_ALL(), '');
416
skip $missing_locale, gettext ('May'), 'May';
418
nl_putenv 'LANGUAGE=C';
419
nl_putenv 'LANG=de_DE';
420
nl_putenv 'LC_MESSAGES=de_DE';
422
POSIX::setlocale (POSIX::LC_ALL(), '');
423
skip $missing_locale, gettext ('May'), 'May';
425
nl_putenv 'LANGUAGE=C';
426
nl_putenv 'LANG=de_DE';
427
nl_putenv 'LC_MESSAGES=de_DE';
428
nl_putenv 'LC_ALL=C';
429
POSIX::setlocale (POSIX::LC_ALL(), '');
430
skip $missing_locale, gettext ('May'), 'May';
432
nl_putenv 'LANGUAGE=C';
433
nl_putenv 'LANG=de_DE';
434
nl_putenv 'LC_MESSAGES=de_DE';
435
nl_putenv 'LC_ALL=de_DE';
436
POSIX::setlocale (POSIX::LC_ALL(), '');
437
skip $missing_locale, gettext ('May'), 'May';
439
nl_putenv 'LANGUAGE=de_DE';
441
nl_putenv 'LC_MESSAGES';
443
POSIX::setlocale (POSIX::LC_ALL(), '');
444
skip $missing_locale, gettext ('May'), 'May';
446
nl_putenv 'LANGUAGE=de_DE';
448
nl_putenv 'LC_MESSAGES';
449
nl_putenv 'LC_ALL=C';
450
POSIX::setlocale (POSIX::LC_ALL(), '');
451
skip $missing_locale, gettext ('May'), 'May';
453
nl_putenv 'LANGUAGE=de_DE';
455
nl_putenv 'LC_MESSAGES';
456
nl_putenv 'LC_ALL=de_DE';
457
POSIX::setlocale (POSIX::LC_ALL(), '');
458
skip $missing_locale, gettext ('May'), 'Mai';
460
nl_putenv 'LANGUAGE=de_DE';
462
nl_putenv 'LC_MESSAGES=C';
464
POSIX::setlocale (POSIX::LC_ALL(), '');
465
skip $missing_locale, gettext ('May'), 'May';
467
nl_putenv 'LANGUAGE=de_DE';
469
nl_putenv 'LC_MESSAGES=C';
470
nl_putenv 'LC_ALL=C';
471
POSIX::setlocale (POSIX::LC_ALL(), '');
472
skip $missing_locale, gettext ('May'), 'May';
474
nl_putenv 'LANGUAGE=de_DE';
476
nl_putenv 'LC_MESSAGES=C';
477
nl_putenv 'LC_ALL=de_DE';
478
POSIX::setlocale (POSIX::LC_ALL(), '');
479
skip $missing_locale, gettext ('May'), 'Mai';
481
nl_putenv 'LANGUAGE=de_DE';
483
nl_putenv 'LC_MESSAGES=de_DE';
485
POSIX::setlocale (POSIX::LC_ALL(), '');
486
skip $missing_locale, gettext ('May'), 'Mai';
488
nl_putenv 'LANGUAGE=de_DE';
490
nl_putenv 'LC_MESSAGES=de_DE';
491
nl_putenv 'LC_ALL=C';
492
POSIX::setlocale (POSIX::LC_ALL(), '');
493
skip $missing_locale, gettext ('May'), 'May';
495
nl_putenv 'LANGUAGE=de_DE';
497
nl_putenv 'LC_MESSAGES=de_DE';
498
nl_putenv 'LC_ALL=de_DE';
499
POSIX::setlocale (POSIX::LC_ALL(), '');
500
skip $missing_locale, gettext ('May'), 'Mai';
502
nl_putenv 'LANGUAGE=de_DE';
504
nl_putenv 'LC_MESSAGES';
506
POSIX::setlocale (POSIX::LC_ALL(), '');
507
skip $missing_locale, gettext ('May'), 'May';
509
nl_putenv 'LANGUAGE=de_DE';
511
nl_putenv 'LC_MESSAGES';
512
nl_putenv 'LC_ALL=C';
513
POSIX::setlocale (POSIX::LC_ALL(), '');
514
skip $missing_locale, gettext ('May'), 'May';
516
nl_putenv 'LANGUAGE=de_DE';
518
nl_putenv 'LC_MESSAGES';
519
nl_putenv 'LC_ALL=de_DE';
520
POSIX::setlocale (POSIX::LC_ALL(), '');
521
skip $missing_locale, gettext ('May'), 'Mai';
523
nl_putenv 'LANGUAGE=de_DE';
525
nl_putenv 'LC_MESSAGES=C';
527
POSIX::setlocale (POSIX::LC_ALL(), '');
528
skip $missing_locale, gettext ('May'), 'May';
530
nl_putenv 'LANGUAGE=de_DE';
532
nl_putenv 'LC_MESSAGES=C';
533
nl_putenv 'LC_ALL=C';
534
POSIX::setlocale (POSIX::LC_ALL(), '');
535
skip $missing_locale, gettext ('May'), 'May';
537
nl_putenv 'LANGUAGE=de_DE';
539
nl_putenv 'LC_MESSAGES=C';
540
nl_putenv 'LC_ALL=de_DE';
541
POSIX::setlocale (POSIX::LC_ALL(), '');
542
skip $missing_locale, gettext ('May'), 'Mai';
544
nl_putenv 'LANGUAGE=de_DE';
546
nl_putenv 'LC_MESSAGES=de_DE';
548
POSIX::setlocale (POSIX::LC_ALL(), '');
549
skip $missing_locale, gettext ('May'), 'Mai';
551
nl_putenv 'LANGUAGE=de_DE';
553
nl_putenv 'LC_MESSAGES=de_DE';
554
nl_putenv 'LC_ALL=C';
555
POSIX::setlocale (POSIX::LC_ALL(), '');
556
skip $missing_locale, gettext ('May'), 'May';
558
nl_putenv 'LANGUAGE=de_DE';
560
nl_putenv 'LC_MESSAGES=de_DE';
561
nl_putenv 'LC_ALL=de_DE';
562
POSIX::setlocale (POSIX::LC_ALL(), '');
563
skip $missing_locale, gettext ('May'), 'Mai';
565
nl_putenv 'LANGUAGE=de_DE';
566
nl_putenv 'LANG=de_DE';
567
nl_putenv 'LC_MESSAGES';
569
POSIX::setlocale (POSIX::LC_ALL(), '');
570
skip $missing_locale, gettext ('May'), 'Mai';
572
nl_putenv 'LANGUAGE=de_DE';
573
nl_putenv 'LANG=de_DE';
574
nl_putenv 'LC_MESSAGES';
575
nl_putenv 'LC_ALL=C';
576
POSIX::setlocale (POSIX::LC_ALL(), '');
577
skip $missing_locale, gettext ('May'), 'May';
579
nl_putenv 'LANGUAGE=de_DE';
580
nl_putenv 'LANG=de_DE';
581
nl_putenv 'LC_MESSAGES';
582
nl_putenv 'LC_ALL=de_DE';
583
POSIX::setlocale (POSIX::LC_ALL(), '');
584
skip $missing_locale, gettext ('May'), 'Mai';
586
nl_putenv 'LANGUAGE=de_DE';
587
nl_putenv 'LANG=de_DE';
588
nl_putenv 'LC_MESSAGES=C';
590
POSIX::setlocale (POSIX::LC_ALL(), '');
591
skip $missing_locale, gettext ('May'), 'May';
593
nl_putenv 'LANGUAGE=de_DE';
594
nl_putenv 'LANG=de_DE';
595
nl_putenv 'LC_MESSAGES=C';
596
nl_putenv 'LC_ALL=C';
597
POSIX::setlocale (POSIX::LC_ALL(), '');
598
skip $missing_locale, gettext ('May'), 'May';
600
nl_putenv 'LANGUAGE=de_DE';
601
nl_putenv 'LANG=de_DE';
602
nl_putenv 'LC_MESSAGES=C';
603
nl_putenv 'LC_ALL=de_DE';
604
POSIX::setlocale (POSIX::LC_ALL(), '');
605
skip $missing_locale, gettext ('May'), 'Mai';
607
nl_putenv 'LANGUAGE=de_DE';
608
nl_putenv 'LANG=de_DE';
609
nl_putenv 'LC_MESSAGES=de_DE';
611
POSIX::setlocale (POSIX::LC_ALL(), '');
612
skip $missing_locale, gettext ('May'), 'Mai';
614
nl_putenv 'LANGUAGE=de_DE';
615
nl_putenv 'LANG=de_DE';
616
nl_putenv 'LC_MESSAGES=de_DE';
617
nl_putenv 'LC_ALL=C';
618
POSIX::setlocale (POSIX::LC_ALL(), '');
619
skip $missing_locale, gettext ('May'), 'May';
621
nl_putenv 'LANGUAGE=de_DE';
622
nl_putenv 'LANG=de_DE';
623
nl_putenv 'LC_MESSAGES=de_DE';
624
nl_putenv 'LC_ALL=de_DE';
625
POSIX::setlocale (POSIX::LC_ALL(), '');
626
skip $missing_locale, gettext ('May'), 'Mai';
633
perl-continued-statement-offset: 4
634
perl-continued-brace-offset: 0
635
perl-brace-offset: -4
636
perl-brace-imaginary-offset: 0
637
perl-label-offset: -4
638
cperl-indent-level: 4
639
cperl-continued-statement-offset: 2