Show
Ignore:
Timestamp:
06/18/08 02:03:47 (18 months ago)
Author:
fumiakiy
Message:

Updating I18N::LangTags to version 0.35 and Locale::MakeText to version 1.13 for better support of Perl 5.10. BugId:80126

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-40/extlib/I18N/LangTags/List.pm

    r1098 r2594  
    22require 5; 
    33package I18N::LangTags::List; 
    4 #  Time-stamp: "2002-02-02 20:13:58 MST" 
     4#  Time-stamp: "2004-10-06 23:26:21 ADT" 
    55use strict; 
    6 use vars qw(%Name $Debug $VERSION); 
    7 $VERSION = '0.25'; 
     6use vars qw(%Name %Is_Disrec $Debug $VERSION); 
     7$VERSION = '0.35'; 
    88# POD at the end. 
    99 
     
    1313  my $seeking = 1; 
    1414  my $count = 0; 
    15   my($tag,$name); 
     15  my($disrec,$tag,$name); 
     16  my $last_name = ''; 
    1617  while(<I18N::LangTags::List::DATA>) { 
    1718    if($seeking) { 
    1819      $seeking = 0 if m/=for woohah/; 
    19     } else { 
    20       next unless ($tag, $name) = 
    21        m/\{([-0-9a-zA-Z]+)\}(?:\s*:)?\s*([^\[\]]+)/; 
     20    } elsif( ($disrec, $tag, $name) = 
     21          m/(\[?)\{([-0-9a-zA-Z]+)\}(?:\s*:)?\s*([^\[\]]+)/ 
     22    ) { 
    2223      $name =~ s/\s*[;\.]*\s*$//g; 
    2324      next unless $name; 
    2425      ++$count; 
    2526      print "<$tag> <$name>\n" if $Debug; 
    26       $Name{$tag} = $name; 
     27      $last_name = $Name{$tag} = $name; 
     28      $Is_Disrec{$tag} = 1 if $disrec; 
     29    } elsif (m/[Ff]ormerly \"([-a-z0-9]+)\"/) { 
     30      $Name{$1} = "$last_name (old tag)" if $last_name; 
     31      $Is_Disrec{$1} = 1; 
    2732    } 
    2833  } 
     
    7277} 
    7378 
     79#-------------------------------------------------------------------------- 
     80 
     81sub is_decent { 
     82  my $tag = lc($_[0] || return 0); 
     83  #require I18N::LangTags; 
     84 
     85  return 0 unless 
     86    $tag =~  
     87    /^(?:  # First subtag 
     88         [xi] | [a-z]{2,3} 
     89      ) 
     90      (?:  # Subtags thereafter 
     91         -           # separator 
     92         [a-z0-9]{1,8}  # subtag   
     93      )* 
     94    $/xs; 
     95 
     96  my @supers = (); 
     97  foreach my $bit (split('-', $tag)) { 
     98    push @supers,  
     99      scalar(@supers) ? ($supers[-1] . '-' . $bit) : $bit; 
     100  } 
     101  return 0 unless @supers; 
     102  shift @supers if $supers[0] =~ m<^(i|x|sgn)$>s; 
     103  return 0 unless @supers; 
     104 
     105  foreach my $f ($tag, @supers) { 
     106    return 0 if $Is_Disrec{$f}; 
     107    return 2 if $Name{$f}; 
     108     # so that decent subforms of indecent tags are decent 
     109  } 
     110  return 2 if $Name{$tag}; # not only is it decent, it's known! 
     111  return 1; 
     112} 
     113 
     114#-------------------------------------------------------------------------- 
    741151; 
    75116 
     
    103144 
    104145The function I18N::LangTags::List::name(...) is not exported. 
     146 
     147This module also provides a function 
     148C<I18N::LangTags::List::is_decent( I<langtag> )> that returns true iff 
     149the language tag is syntactically valid and is for general use (like 
     150"fr" or "fr-ca", below).  That is, it returns false for tags that are 
     151syntactically invalid and for tags, like "aus", that are listed in 
     152brackets below.  This function is not exported. 
    105153 
    106154The map of tags-to-names that it uses is accessable as 
     
    196244=item {ada} : Adangme 
    197245 
     246=item {ady} : Adyghe 
     247 
     248eq Adygei 
     249 
    198250=item {aa} : Afar 
    199251 
     
    206258=item [{afa} : Afro-Asiatic (Other)] 
    207259 
    208 =item {aka} : Akan 
     260=item {ak} : Akan 
     261 
     262(Formerly "aka".) 
    209263 
    210264=item {akk} : Akkadian 
     
    265319=item {hy} : Armenian 
    266320 
     321=item {an} : Aragonese 
     322 
    267323=item [{art} : Artificial (Other)] 
    268324 
     325=item {ast} : Asturian 
     326 
     327eq Bable. 
     328 
    269329=item {as} : Assamese 
    270330 
     
    277337=item [{map} : Austronesian (Other)] 
    278338 
    279 =item {ava} : Avaric 
     339=item {av} : Avaric 
     340 
     341(Formerly "ava".) 
    280342 
    281343=item {ae} : Avestan 
     
    291353eq Azeri 
    292354 
     355Notable forms: 
     356{az-Arab} Azerbaijani in Arabic script; 
     357{az-Cyrl} Azerbaijani in Cyrillic script; 
     358{az-Latn} Azerbaijani in Latin script. 
     359 
    293360=item {ban} : Balinese 
    294361 
     
    297364=item {bal} : Baluchi 
    298365 
    299 =item {bam} : Bambara 
     366=item {bm} : Bambara 
     367 
     368(Formerly "bam".) 
    300369 
    301370=item [{bai} : Bamileke languages] 
     
    404473 
    405474Many forms are mutually un-intelligible in spoken media. 
    406 Notable subforms: 
     475Notable forms: 
     476{zh-Hans} Chinese, in simplified script; 
     477{zh-Hant} Chinese, in traditional script; 
     478{zh-tw} Taiwan Chinese; 
    407479{zh-cn} PRC Chinese; 
     480{zh-sg} Singapore Chinese; 
     481{zh-mo} Macau Chinese; 
    408482{zh-hk} Hong Kong Chinese; 
    409 {zh-mo} Macau Chinese; 
    410 {zh-sg} Singapore Chinese; 
    411 {zh-tw} Taiwan Chinese; 
    412483{zh-guoyu} Mandarin [Putonghua/Guoyu]; 
    413 {zh-hakka} Hakka [formerly i-hakka]; 
     484{zh-hakka} Hakka [formerly "i-hakka"]; 
    414485{zh-min} Hokkien; 
    415486{zh-min-nan} Southern Hokkien; 
     
    448519eq Corse. 
    449520 
    450 =item {cre} : Cree 
    451  
    452 NOT Creek! 
     521=item {cr} : Cree 
     522 
     523NOT Creek!  (Formerly "cre".) 
    453524 
    454525=item {mus} : Creek 
     
    477548 
    478549=item {da} : Danish 
     550 
     551=item {dar} : Dargwa 
    479552 
    480553=item {day} : Dayak 
     
    492565=item {din} : Dinka 
    493566 
    494 =item {div} : Divehi 
     567=item {dv} : Divehi 
     568 
     569eq Maldivian.  (Formerly "div".) 
    495570 
    496571=item {doi} : Dogri 
     
    556631eq Anglo-Saxon.  (Historical) 
    557632 
     633=item {i-enochian} : Enochian (Artificial) 
     634 
     635=item {myv} : Erzya 
     636 
    558637=item {eo} : Esperanto 
    559638 
     
    562641=item {et} : Estonian 
    563642 
    564 =item {ewe} : Ewe 
     643=item {ee} : Ewe 
     644 
     645(Formerly "ewe".) 
    565646 
    566647=item {ewo} : Ewondo 
     
    604685=item {fur} : Friulian 
    605686 
    606 =item {ful} : Fulah 
     687=item {ff} : Fulah 
     688 
     689(Formerly "ful".) 
    607690 
    608691=item {gaa} : Ga 
     
    616699eq Galician 
    617700 
    618 =item {lug} : Ganda 
     701=item {lg} : Ganda 
     702 
     703(Formerly "lug".) 
    619704 
    620705=item {gay} : Gayo 
     
    680765=item {hai} : Haida 
    681766 
     767=item {ht} : Haitian 
     768 
     769eq Haitian Creole 
     770 
    682771=item {ha} : Hausa 
    683772 
     
    717806=item {is} : Icelandic 
    718807 
    719 =item {ibo} : Igbo 
     808=item {io} : Ido 
     809 
     810(Artificial) 
     811 
     812=item {ig} : Igbo 
     813 
     814(Formerly "ibo".) 
    720815 
    721816=item {ijo} : Ijo 
     
    733828=for etc 
    734829{in} Indonesian (old tag) 
     830 
     831=item {inh} : Ingush 
    735832 
    736833=item {ia} : Interlingua (International Auxiliary Language Association) 
     
    774871(NOT "jp"!) 
    775872 
    776 =item {jw} : Javanese 
     873=item {jv} : Javanese 
     874 
     875(Formerly "jw" because of a typo.) 
    777876 
    778877=item {jrb} : Judeo-Arabic 
     
    780879=item {jpr} : Judeo-Persian 
    781880 
     881=item {kbd} : Kabardian 
     882 
    782883=item {kab} : Kabyle 
    783884 
     
    788889eq Greenlandic "Eskimo" 
    789890 
     891=item {xal} : Kalmyk 
     892 
    790893=item {kam} : Kamba 
    791894 
     
    794897eq Kanarese.  NOT Canadian! 
    795898 
    796 =item {kau} : Kanuri 
     899=item {kr} : Kanuri 
     900 
     901(Formerly "kau".) 
     902 
     903=item {krc} : Karachay-Balkar 
    797904 
    798905=item {kaa} : Kara-Kalpak 
     
    802909=item {ks} : Kashmiri 
    803910 
     911=item {csb} : Kashubian 
     912 
     913eq Kashub 
     914 
    804915=item {kaw} : Kawi 
    805916 
     
    830941=item {kv} : Komi 
    831942 
    832 =item {kon} : Kongo 
     943=item {kg} : Kongo 
     944 
     945(Formerly "kon".) 
    833946 
    834947=item {kok} : Konkani 
     
    878991=item {lb} : Letzeburgesch 
    879992 
    880 eq Luxemburgian, eq Luxemburger.  (Formerly i-lux.) 
     993eq Luxemburgian, eq Luxemburger.  (Formerly "i-lux".) 
    881994 
    882995=for etc 
     
    885998=item {lez} : Lezghian 
    886999 
     1000=item {li} : Limburgish 
     1001 
     1002eq Limburger, eq Limburgan.  NOT Letzeburgesch! 
     1003 
    8871004=item {ln} : Lingala 
    8881005 
     
    8931010eq Low Saxon.  eq Low German.  eq Low Saxon. 
    8941011 
     1012=item {art-lojban} : Lojban (Artificial) 
     1013 
    8951014=item {loz} : Lozi 
    8961015 
    897 =item {lub} : Luba-Katanga 
     1016=item {lu} : Luba-Katanga 
     1017 
     1018(Formerly "lub".) 
    8981019 
    8991020=item {lua} : Luba-Lulua 
     
    9861107=item {moh} : Mohawk 
    9871108 
     1109=item {mdf} : Moksha 
     1110 
    9881111=item {mo} : Moldavian 
    9891112 
     
    10081131=item {nah} : Nahuatl 
    10091132 
     1133=item {nap} : Neapolitan 
     1134 
    10101135=item {na} : Nauru 
    10111136 
    10121137=item {nv} : Navajo 
    10131138 
    1014 eq Navaho.  (Formerly i-navajo.) 
     1139eq Navaho.  (Formerly "i-navajo".) 
    10151140 
    10161141=for etc 
     
    10391164=item {niu} : Niuean 
    10401165 
     1166=item {nog} : Nogai 
     1167 
    10411168=item {non} : Old Norse 
    10421169 
     
    10471174Do not use this. 
    10481175 
    1049 =item {se} : Northern Sami 
    1050  
    1051 eq Lappish.  eq Lapp.  eq (Northern) Saami. 
    1052  
    10531176=item {no} : Norwegian 
    10541177 
     
    10571180=item {nb} : Norwegian Bokmal 
    10581181 
    1059 eq BokmE<aring>l, (A form of Norwegian.)  (Formerly no-bok.) 
     1182eq BokmE<aring>l, (A form of Norwegian.)  (Formerly "no-bok".) 
    10601183 
    10611184=for etc 
     
    10641187=item {nn} : Norwegian Nynorsk 
    10651188 
    1066 (A form of Norwegian.)  (Formerly no-nyn.) 
     1189(A form of Norwegian.)  (Formerly "no-nyn".) 
    10671190 
    10681191=for etc 
     
    10831206eq ProvenE<ccedil>al, eq Provencal 
    10841207 
    1085 =item {oji} : Ojibwa 
    1086  
    1087 eq Ojibwe. 
     1208=item {oj} : Ojibwa 
     1209 
     1210eq Ojibwe.  (Formerly "oji".) 
    10881211 
    10891212=item {or} : Oriya 
     
    12031326NOT Aramaic! 
    12041327 
     1328=item {se} : Northern Sami 
     1329 
     1330eq Lappish.  eq Lapp.  eq (Northern) Saami. 
     1331 
     1332=item {sma} : Southern Sami 
     1333 
     1334=item {smn} : Inari Sami 
     1335 
     1336=item {smj} : Lule Sami 
     1337 
     1338=item {sms} : Skolt Sami 
     1339 
    12051340=item [{smi} : Sami languages (Other)] 
    12061341 
     
    12341369 
    12351370eq Serb.  NOT Sorbian. 
     1371 
     1372Notable forms: 
     1373{sr-Cyrl} : Serbian in Cyrillic script; 
     1374{sr-Latn} : Serbian in Latin script. 
    12361375 
    12371376=item {srr} : Serer 
     
    12501389{sgn-ni} Nicaraguan Sign Language (ISN); 
    12511390{sgn-us} American Sign Language (ASL). 
     1391 
     1392(And so on with other country codes as the subtag.) 
    12521393 
    12531394=item {bla} : Siksika 
     
    14231564=item {tum} : Tumbuka 
    14241565 
     1566=item [{tup} : Tupi languages] 
     1567 
    14251568=item {tr} : Turkish 
    14261569 
     
    14311574(Typically in Arabic script)  (Historical) 
    14321575 
     1576=item {crh} : Crimean Turkish 
     1577 
     1578eq Crimean Tatar 
     1579 
    14331580=item {tk} : Turkmen 
    14341581 
     
    14431590=item {tw} : Twi 
    14441591 
     1592=item {udm} : Udmurt 
     1593 
    14451594=item {uga} : Ugaritic 
    14461595 
     
    14631612eq E<Ouml>zbek 
    14641613 
     1614Notable forms: 
     1615{uz-Cyrl} Uzbek in Cyrillic script; 
     1616{uz-Latn} Uzbek in Latin script. 
     1617 
    14651618=item {vai} : Vai 
    14661619 
    1467 =item {ven} : Venda 
    1468  
    1469 NOT Wendish!  NOT Wend!  NOT Avestan! 
     1620=item {ve} : Venda 
     1621 
     1622NOT Wendish!  NOT Wend!  NOT Avestan!  (Formerly "ven".) 
    14701623 
    14711624=item {vi} : Vietnamese 
     
    14821635 
    14831636=item [{wak} : Wakashan languages] 
     1637 
     1638=item {wa} : Walloon 
    14841639 
    14851640=item {wal} : Walamo 
     
    15181673eq Yap 
    15191674 
     1675=item {ii} : Sichuan Yi 
     1676 
    15201677=item {yi} : Yiddish 
    15211678 
    1522 Formerly "ji".  Sometimes in Roman script, sometimes in Hebrew script. 
    1523  
    1524 =for etc 
    1525 {ji} Yiddish (old tag) 
     1679Formerly "ji".  Usually in Hebrew script. 
     1680 
     1681Notable forms: 
     1682{yi-latn} Yiddish in Latin script 
    15261683 
    15271684=item {yo} : Yoruba 
     
    15591716=head1 COPYRIGHT AND DISCLAIMER 
    15601717 
    1561 Copyright (c) 2001,2002 Sean M. Burke. All rights reserved. 
     1718Copyright (c) 2001+ Sean M. Burke. All rights reserved. 
    15621719 
    15631720You can redistribute and/or