1 #!/usr/bin/perl -w 2 3 # Exercise Program for localization and internationalization 4 5 use strict; 6 use lib qw(/home/xpathun/perl.d/language.d/); 7 use locale; 8 use POSIX qw(locale_h); 9 use Locale::TextDomain; 10 11 my $current_locale; 12 13 my $lang_var = `env | grep -m 1 [a-z][a-z]_[A-Z][A-Z]`; # looking for a variable which contains a valid language value 14 15 chomp $lang_var; 16 my @lang_set = split('=' , $lang_var); # extracting the value 17 18 my $lang = $lang_set[1]; 19 chomp $lang; 20 21 $current_locale = setlocale(LC_ALL , $lang) || die "Had trouble with the language $lang\n"; 22 23 my $string =__"Hello"; 24 25 print "$string\n"; 26 27 my $number = 1.23; 28 print "$number\n";