diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-27 13:43:38 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-27 13:43:38 +0000 |
commit | 4b053158ffba5bda82094dc0b0cd80c9d2867b97 (patch) | |
tree | 26f29f4c4566322e3a63a186067965b54af4269a /t/lib | |
parent | 62ec34bdab38578dfeaafdadbf57d3722a2f6e0c (diff) | |
download | perl-4b053158ffba5bda82094dc0b0cd80c9d2867b97.tar.gz |
Integrate I18N::LangTags from Sean Burke.
TODO: the language list from RFC 3066 needs to be integrated
and made available somehow. The list is included in the
I18N-LangTags 0.21 distribution, but it is undocumented
and unconnected to the module.
p4raw-id: //depot/perl@10228
Diffstat (limited to 't/lib')
-rw-r--r-- | t/lib/i18n-langtags.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/lib/i18n-langtags.t b/t/lib/i18n-langtags.t new file mode 100644 index 0000000000..06c178ef27 --- /dev/null +++ b/t/lib/i18n-langtags.t @@ -0,0 +1,45 @@ +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +######################### We start with some black magic to print on failure. +require 5; + +use strict; +use Test; +BEGIN { plan tests => 23 }; +BEGIN { ok 1 } +use I18N::LangTags qw(is_language_tag same_language_tag + extract_language_tags super_languages + similarity_language_tag is_dialect_of + locale2language_tag alternate_language_tags + encode_language_tag + ); + +ok !is_language_tag(''); +ok is_language_tag('fr'); +ok is_language_tag('fr-ca'); +ok is_language_tag('fr-CA'); +ok !is_language_tag('fr-CA-'); +ok !is_language_tag('fr_CA'); +ok is_language_tag('fr-ca-joual'); +ok !is_language_tag('frca'); +ok is_language_tag('nav'); +ok is_language_tag('nav-shiprock'); +ok !is_language_tag('nav-ceremonial'); # subtag too long +ok !is_language_tag('x'); +ok !is_language_tag('i'); +ok is_language_tag('i-borg'); # NB: fictitious tag +ok is_language_tag('x-borg'); +ok is_language_tag('x-borg-prot5123'); +ok same_language_tag('x-borg-prot5123', 'i-BORG-Prot5123' ); +ok !same_language_tag('en', 'en-us' ); + +ok 0 == similarity_language_tag('en-ca', 'fr-ca'); +ok 1 == similarity_language_tag('en-ca', 'en-us'); +ok 2 == similarity_language_tag('en-us-southern', 'en-us-western'); +ok 2 == similarity_language_tag('en-us-southern', 'en-us'); + +# print "So there!\n"; + |