summaryrefslogtreecommitdiff
path: root/cpan/Locale-Codes/lib/Locale/Language.pm
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-06-28 23:26:29 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-06-28 23:26:29 +0100
commitc69a30ecf5c7ac44ba9c86d2c814516e6045b60a (patch)
treec59c57a68793c00c6dffd23eff6488d57e89c0f7 /cpan/Locale-Codes/lib/Locale/Language.pm
parent3b36395d31cf0a2f3a017505cd0ea857a7acb5d1 (diff)
downloadperl-c69a30ecf5c7ac44ba9c86d2c814516e6045b60a.tar.gz
Updated Locale-Codes to CPAN version 3.17
[DELTA] VERSION 3.17 (2011-06-28) NEW CODE(s) Added new types of codes Added Language Extension codes (langext) and Language Variation codes (langvar) as defined in the IANA language registry. Added new codeset(s) Added language codes from ISO 639-5 Added language/script codes from the IANA language subtag registry Bug fixes Fixed an uninitialized value warning. RT 67438 Fixed the return value for the all_XXX_codes and all_XXX_names functions. RT 69100 Reorganized code Reorganized modules to move Locale::MODULE to Locale::Codes::MODULE to allow for cleaner future additions. The original four modules (Locale::Language, Locale::Currency, Locale::Country, Locale::Script) will continue to work, but all new sets of codes will be added in the Locale::Codes namespace.
Diffstat (limited to 'cpan/Locale-Codes/lib/Locale/Language.pm')
-rw-r--r--cpan/Locale-Codes/lib/Locale/Language.pm274
1 files changed, 19 insertions, 255 deletions
diff --git a/cpan/Locale-Codes/lib/Locale/Language.pm b/cpan/Locale-Codes/lib/Locale/Language.pm
index c30ff8840c..ca5863533f 100644
--- a/cpan/Locale-Codes/lib/Locale/Language.pm
+++ b/cpan/Locale-Codes/lib/Locale/Language.pm
@@ -7,269 +7,33 @@ package Locale::Language;
use strict;
use warnings;
-require 5.002;
+use Exporter;
-require Exporter;
-use Carp;
-use Locale::Codes;
-use Locale::Constants;
-use Locale::Codes::Language;
+our $VERSION;
+$VERSION='3.17';
-#=======================================================================
-# Public Global Variables
-#=======================================================================
+our (@ISA,@EXPORT);
-our($VERSION,@ISA,@EXPORT,@EXPORT_OK);
+my $backend = 'Locale::Codes::Language';
+my $backend_exp = $backend . "::EXPORT";
-$VERSION='3.16';
-@ISA = qw(Exporter);
-@EXPORT = qw(code2language
- language2code
- all_language_codes
- all_language_names
- language_code2code
- LOCALE_LANG_ALPHA_2
- LOCALE_LANG_ALPHA_3
- LOCALE_LANG_TERM
- );
+eval "require $backend; $backend->import(); return 1;";
-sub _code {
- my($code,$codeset) = @_;
- $code = "" if (! $code);
-
- $codeset = LOCALE_LANG_DEFAULT if (! defined($codeset) || $codeset eq "");
-
- if ($codeset =~ /^\d+$/) {
- if ($codeset == LOCALE_LANG_ALPHA_2) {
- $codeset = "alpha2";
- } elsif ($codeset == LOCALE_LANG_ALPHA_3) {
- $codeset = "alpha3";
- } elsif ($codeset == LOCALE_LANG_TERM) {
- $codeset = "term";
- } else {
- return (1);
- }
- }
-
- if ($codeset eq "alpha2" ||
- $codeset eq "alpha3" ||
- $codeset eq "term") {
- $code = lc($code);
- } else {
- return (1);
- }
-
- return (0,$code,$codeset);
-}
-
-#=======================================================================
-#
-# code2language ( CODE [,CODESET] )
-#
-#=======================================================================
-
-sub code2language {
- my($err,$code,$codeset) = _code(@_);
- return undef if ($err ||
- ! defined $code);
-
- return Locale::Codes::_code2name("language",$code,$codeset);
-}
-
-#=======================================================================
-#
-# language2code ( LANGUAGE [,CODESET] )
-#
-#=======================================================================
-
-sub language2code {
- my($language,$codeset) = @_;
- my($err,$tmp);
- ($err,$tmp,$codeset) = _code("",$codeset);
- return undef if ($err ||
- ! defined $language);
-
- return Locale::Codes::_name2code("language",$language,$codeset);
-}
-
-#=======================================================================
-#
-# language_code2code ( CODE,CODESET_IN,CODESET_OUT )
-#
-#=======================================================================
-
-sub language_code2code {
- (@_ == 3) or croak "language_code2code() takes 3 arguments!";
- my($code,$inset,$outset) = @_;
- my($err,$tmp);
- ($err,$code,$inset) = _code($code,$inset);
- return undef if ($err);
- ($err,$tmp,$outset) = _code("",$outset);
- return undef if ($err);
-
- return Locale::Codes::_code2code("language",$code,$inset,$outset);
-}
-
-#=======================================================================
-#
-# all_language_codes ( [CODESET] )
-#
-#=======================================================================
-
-sub all_language_codes {
- my($codeset) = @_;
- my($err,$tmp);
- ($err,$tmp,$codeset) = _code("",$codeset);
- return undef if ($err);
-
- return Locale::Codes::_all_codes("language",$codeset);
-}
-
-
-#=======================================================================
-#
-# all_language_names ( [CODESET] )
-#
-#=======================================================================
-
-sub all_language_names {
- my($codeset) = @_;
- my($err,$tmp);
- ($err,$tmp,$codeset) = _code("",$codeset);
- return undef if ($err);
-
- return Locale::Codes::_all_names("language",$codeset);
+{
+ no strict 'refs';
+ @EXPORT = @{ $backend_exp };
}
-#=======================================================================
-#
-# rename_language ( CODE,NAME [,CODESET] )
-#
-#=======================================================================
-
-sub rename_language {
- my($code,$new_name,@args) = @_;
- my $nowarn = 0;
- $nowarn = 1, pop(@args) if ($args[$#args] eq "nowarn");
- my $codeset = shift(@args);
- my $err;
- ($err,$code,$codeset) = _code($code,$codeset);
-
- return Locale::Codes::_rename("language",$code,$new_name,$codeset,$nowarn);
-}
+unshift (@ISA, $backend);
-#=======================================================================
-#
-# add_language ( CODE,NAME [,CODESET] )
-#
-#=======================================================================
-
-sub add_language {
- my($code,$name,@args) = @_;
- my $nowarn = 0;
- $nowarn = 1, pop(@args) if ($args[$#args] eq "nowarn");
- my $codeset = shift(@args);
- my $err;
- ($err,$code,$codeset) = _code($code,$codeset);
-
- return Locale::Codes::_add_code("language",$code,$name,$codeset,$nowarn);
-}
-
-#=======================================================================
-#
-# delete_language ( CODE [,CODESET] )
-#
-#=======================================================================
-
-sub delete_language {
- my($code,@args) = @_;
- my $nowarn = 0;
- $nowarn = 1, pop(@args) if ($args[$#args] eq "nowarn");
- my $codeset = shift(@args);
- my $err;
- ($err,$code,$codeset) = _code($code,$codeset);
-
- return Locale::Codes::_delete_code("language",$code,$codeset,$nowarn);
-}
-
-#=======================================================================
-#
-# add_language_alias ( NAME,NEW_NAME )
-#
-#=======================================================================
-
-sub add_language_alias {
- my($name,$new_name,$nowarn) = @_;
- $nowarn = (defined($nowarn) && $nowarn eq "nowarn" ? 1 : 0);
-
- return Locale::Codes::_add_alias("language",$name,$new_name,$nowarn);
-}
-
-#=======================================================================
-#
-# delete_language_alias ( NAME )
-#
-#=======================================================================
-
-sub delete_language_alias {
- my($name,$nowarn) = @_;
- $nowarn = (defined($nowarn) && $nowarn eq "nowarn" ? 1 : 0);
-
- return Locale::Codes::_delete_alias("language",$name,$nowarn);
-}
-
-#=======================================================================
-#
-# rename_language_code ( CODE,NEW_CODE [,CODESET] )
-#
-#=======================================================================
-
-sub rename_language_code {
- my($code,$new_code,@args) = @_;
- my $nowarn = 0;
- $nowarn = 1, pop(@args) if ($args[$#args] eq "nowarn");
- my $codeset = shift(@args);
- my $err;
- ($err,$code,$codeset) = _code($code,$codeset);
- ($err,$new_code,$codeset) = _code($new_code,$codeset) if (! $err);
-
- return Locale::Codes::_rename_code("language",$code,$new_code,$codeset,$nowarn);
-}
-
-#=======================================================================
-#
-# add_language_code_alias ( CODE,NEW_CODE [,CODESET] )
-#
-#=======================================================================
-
-sub add_language_code_alias {
- my($code,$new_code,@args) = @_;
- my $nowarn = 0;
- $nowarn = 1, pop(@args) if ($args[$#args] eq "nowarn");
- my $codeset = shift(@args);
- my $err;
- ($err,$code,$codeset) = _code($code,$codeset);
- ($err,$new_code,$codeset) = _code($new_code,$codeset) if (! $err);
-
- return Locale::Codes::_add_code_alias("language",$code,$new_code,$codeset,$nowarn);
-}
-
-#=======================================================================
-#
-# delete_language_code_alias ( CODE [,CODESET] )
-#
-#=======================================================================
-
-sub delete_language_code_alias {
- my($code,@args) = @_;
- my $nowarn = 0;
- $nowarn = 1, pop(@args) if ($args[$#args] eq "nowarn");
- my $codeset = shift(@args);
- my $err;
- ($err,$code,$codeset) = _code($code,$codeset);
-
- return Locale::Codes::_delete_code_alias("language",$code,$codeset,$nowarn);
-}
+sub rename_language { Locale::Codes::Language::rename_language(@_) }
+sub add_language { Locale::Codes::Language::add_language(@_) }
+sub delete_language { Locale::Codes::Language::delete_language(@_) }
+sub add_language_alias { Locale::Codes::Language::add_language_alias(@_) }
+sub delete_language_alias { Locale::Codes::Language::delete_language_alias(@_) }
+sub rename_language_code { Locale::Codes::Language::rename_language_code(@_) }
+sub add_language_code_alias { Locale::Codes::Language::add_language_code_alias(@_) }
+sub delete_language_code_alias { Locale::Codes::Language::delete_language_code_alias(@_) }
1;
# Local Variables: