summaryrefslogtreecommitdiff
path: root/ext/I18N-LangTags/t/20_locales.t
blob: ae04812ff2a53daf8d28270fc312a2e1aa753c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 5;
 # Time-stamp: "2004-10-06 23:07:06 ADT"
use strict;
use Test;
BEGIN { plan tests => 22 };
BEGIN { ok 1 }
use I18N::LangTags (':ALL');

print "# Perl v$], I18N::LangTags v$I18N::LangTags::VERSION\n";
print "#  Loaded from ", $INC{'I18N/LangTags.pm'} || "??", "\n";

ok lc locale2language_tag('en'),    'en';
ok lc locale2language_tag('en_US'),    'en-us';
ok lc locale2language_tag('en_US.ISO8859-1'),    'en-us';
ok lc(locale2language_tag('C')||''),    '';
ok lc(locale2language_tag('POSIX')||''), '';


ok lc locale2language_tag('eu_mt'),           'eu-mt';
ok lc locale2language_tag('eu'),              'eu';
ok lc locale2language_tag('it'),              'it';
ok lc locale2language_tag('it_IT'),           'it-it';
ok lc locale2language_tag('it_IT.utf8'),      'it-it';
ok lc locale2language_tag('it_IT.utf8@euro'), 'it-it';
ok lc locale2language_tag('it_IT@euro'),      'it-it';


ok lc locale2language_tag('zh_CN.gb18030'), 'zh-cn';
ok lc locale2language_tag('zh_CN.gbk'),     'zh-cn';
ok lc locale2language_tag('zh_CN.utf8'),    'zh-cn';
ok lc locale2language_tag('zh_HK'),         'zh-hk';
ok lc locale2language_tag('zh_HK.utf8'),    'zh-hk';
ok lc locale2language_tag('zh_TW'),         'zh-tw';
ok lc locale2language_tag('zh_TW.euctw'),   'zh-tw';
ok lc locale2language_tag('zh_TW.utf8'),    'zh-tw';

print "# So there!\n";
ok 1;