All pastes #963686 Raw Edit

Miscellany

public text v1 · immutable
#963686 ·published 2008-03-30 19:12 UTC
rendered paste body
#!/usr/bin/perl

use strict;
use POSIX qw(setlocale);
use Locale::gettext;
use utf8;

setlocale(LC_MESSAGES, "");
textdomain("test");
bindtextdomain("test", '/tmp/locale');

print "1: ", gettext("Hello"), "\n";

$ENV{LC_MESSAGES} = 'it';
print "2: ", gettext("Hello"), "\n";
$ENV{LC_MESSAGES} = "C";
print "3: ", gettext("Hello"), "\n";
$ENV{LC_MESSAGES} = '';
print "4: ", gettext("Hello"), "\n";

# EOF

# ./testgettext.pl
1: Hello
2: Saluto
3: Saluto
4: Saulto

# Why in 3 and 4 I get "Saluto" instead of "Hello"?