[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/lib/5.10.0/Locale/ -> Language.pm (source)

   1  #
   2  # Locale::Language - ISO two letter codes for language identification (ISO 639)
   3  #
   4  # $Id: Language.pm,v 2.7 2004/06/10 21:19:34 neilb Exp $
   5  #
   6  
   7  package Locale::Language;
   8  use strict;
   9  require 5.002;
  10  
  11  require Exporter;
  12  
  13  #-----------------------------------------------------------------------
  14  #    Public Global Variables
  15  #-----------------------------------------------------------------------
  16  use vars qw($VERSION @ISA @EXPORT);
  17  $VERSION      = sprintf("%d.%02d", q$Revision: 2.7 $ =~ /(\d+)\.(\d+)/);
  18  @ISA          = qw(Exporter);
  19  @EXPORT       = qw(&code2language &language2code
  20                     &all_language_codes &all_language_names );
  21  
  22  #-----------------------------------------------------------------------
  23  #    Private Global Variables
  24  #-----------------------------------------------------------------------
  25  my %CODES     = ();
  26  my %LANGUAGES = ();
  27  
  28  
  29  #=======================================================================
  30  #
  31  # code2language ( CODE )
  32  #
  33  #=======================================================================
  34  sub code2language
  35  {
  36      my $code = shift;
  37  
  38  
  39      return undef unless defined $code;
  40      $code = lc($code);
  41      if (exists $CODES{$code})
  42      {
  43          return $CODES{$code};
  44      }
  45      else
  46      {
  47          #---------------------------------------------------------------
  48          # no such language code!
  49          #---------------------------------------------------------------
  50          return undef;
  51      }
  52  }
  53  
  54  
  55  #=======================================================================
  56  #
  57  # language2code ( LANGUAGE )
  58  #
  59  #=======================================================================
  60  sub language2code
  61  {
  62      my $lang = shift;
  63  
  64  
  65      return undef unless defined $lang;
  66      $lang = lc($lang);
  67      if (exists $LANGUAGES{$lang})
  68      {
  69          return $LANGUAGES{$lang};
  70      }
  71      else
  72      {
  73          #---------------------------------------------------------------
  74          # no such language!
  75          #---------------------------------------------------------------
  76          return undef;
  77      }
  78  }
  79  
  80  
  81  #=======================================================================
  82  #
  83  # all_language_codes()
  84  #
  85  #=======================================================================
  86  sub all_language_codes
  87  {
  88      return keys %CODES;
  89  }
  90  
  91  
  92  #=======================================================================
  93  #
  94  # all_language_names()
  95  #
  96  #=======================================================================
  97  sub all_language_names
  98  {
  99      return values %CODES;
 100  }
 101  
 102  
 103  #=======================================================================
 104  # initialisation code - stuff the DATA into the CODES hash
 105  #=======================================================================
 106  {
 107      my    $code;
 108      my    $language;
 109      local $_;
 110  
 111  
 112      while (<DATA>)
 113      {
 114          next unless /\S/;
 115          chop;
 116          ($code, $language) = split(/:/, $_, 2);
 117          $CODES{$code} = $language;
 118          $LANGUAGES{"\L$language"} = $code;
 119      }
 120  
 121      close(DATA);
 122  }
 123  
 124  1;
 125  
 126  __DATA__
 127  aa:Afar
 128  ab:Abkhazian
 129  ae:Avestan
 130  af:Afrikaans
 131  am:Amharic
 132  ar:Arabic
 133  as:Assamese
 134  ay:Aymara
 135  az:Azerbaijani
 136  
 137  ba:Bashkir
 138  be:Belarusian
 139  bg:Bulgarian
 140  bh:Bihari
 141  bi:Bislama
 142  bn:Bengali
 143  bo:Tibetan
 144  br:Breton
 145  bs:Bosnian
 146  
 147  ca:Catalan
 148  ce:Chechen
 149  ch:Chamorro
 150  co:Corsican
 151  cs:Czech
 152  cu:Church Slavic
 153  cv:Chuvash
 154  cy:Welsh
 155  
 156  da:Danish
 157  de:German
 158  dz:Dzongkha
 159  
 160  el:Greek
 161  en:English
 162  eo:Esperanto
 163  es:Spanish
 164  et:Estonian
 165  eu:Basque
 166  
 167  fa:Persian
 168  fi:Finnish
 169  fj:Fijian
 170  fo:Faeroese
 171  fr:French
 172  fy:Frisian
 173  
 174  ga:Irish
 175  gd:Gaelic (Scots)
 176  gl:Gallegan
 177  gn:Guarani
 178  gu:Gujarati
 179  gv:Manx
 180  
 181  ha:Hausa
 182  he:Hebrew
 183  hi:Hindi
 184  ho:Hiri Motu
 185  hr:Croatian
 186  hu:Hungarian
 187  hy:Armenian
 188  hz:Herero
 189  
 190  ia:Interlingua
 191  id:Indonesian
 192  ie:Interlingue
 193  ik:Inupiaq
 194  is:Icelandic
 195  it:Italian
 196  iu:Inuktitut
 197  
 198  ja:Japanese
 199  jw:Javanese
 200  
 201  ka:Georgian
 202  ki:Kikuyu
 203  kj:Kuanyama
 204  kk:Kazakh
 205  kl:Kalaallisut
 206  km:Khmer
 207  kn:Kannada
 208  ko:Korean
 209  ks:Kashmiri
 210  ku:Kurdish
 211  kv:Komi
 212  kw:Cornish
 213  ky:Kirghiz
 214  
 215  la:Latin
 216  lb:Letzeburgesch
 217  ln:Lingala
 218  lo:Lao
 219  lt:Lithuanian
 220  lv:Latvian
 221  
 222  mg:Malagasy
 223  mh:Marshall
 224  mi:Maori
 225  mk:Macedonian
 226  ml:Malayalam
 227  mn:Mongolian
 228  mo:Moldavian
 229  mr:Marathi
 230  ms:Malay
 231  mt:Maltese
 232  my:Burmese
 233  
 234  na:Nauru
 235  nb:Norwegian Bokmal
 236  nd:Ndebele, North
 237  ne:Nepali
 238  ng:Ndonga
 239  nl:Dutch
 240  nn:Norwegian Nynorsk
 241  no:Norwegian
 242  nr:Ndebele, South
 243  nv:Navajo
 244  ny:Chichewa; Nyanja
 245  
 246  oc:Occitan (post 1500)
 247  om:Oromo
 248  or:Oriya
 249  os:Ossetian; Ossetic
 250  
 251  pa:Panjabi
 252  pi:Pali
 253  pl:Polish
 254  ps:Pushto
 255  pt:Portuguese
 256  
 257  qu:Quechua
 258  
 259  rm:Rhaeto-Romance
 260  rn:Rundi
 261  ro:Romanian
 262  ru:Russian
 263  rw:Kinyarwanda
 264  
 265  sa:Sanskrit
 266  sc:Sardinian
 267  sd:Sindhi
 268  se:Sami
 269  sg:Sango
 270  si:Sinhalese
 271  sk:Slovak
 272  sl:Slovenian
 273  sm:Samoan
 274  sn:Shona
 275  so:Somali
 276  sq:Albanian
 277  sr:Serbian
 278  ss:Swati
 279  st:Sotho
 280  su:Sundanese
 281  sv:Swedish
 282  sw:Swahili
 283  
 284  ta:Tamil
 285  te:Telugu
 286  tg:Tajik
 287  th:Thai
 288  ti:Tigrinya
 289  tk:Turkmen
 290  tl:Tagalog
 291  tn:Tswana
 292  to:Tonga
 293  tr:Turkish
 294  ts:Tsonga
 295  tt:Tatar
 296  tw:Twi
 297  
 298  ug:Uighur
 299  uk:Ukrainian
 300  ur:Urdu
 301  uz:Uzbek
 302  
 303  vi:Vietnamese
 304  vo:Volapuk
 305  
 306  wo:Wolof
 307  
 308  xh:Xhosa
 309  
 310  yi:Yiddish
 311  yo:Yoruba
 312  
 313  za:Zhuang
 314  zh:Chinese
 315  zu:Zulu


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1