[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Fri Aug 5 19:23:38 EDT 2016
raeburn Fri Aug 5 23:23:38 2016 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface loncommon.pm
Log:
- For 2.11
- Backport 1.1241
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.101 loncom/interface/loncommon.pm:1.1075.2.102
--- loncom/interface/loncommon.pm:1.1075.2.101 Fri Aug 5 22:24:31 2016
+++ loncom/interface/loncommon.pm Fri Aug 5 23:23:37 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1075.2.101 2016/08/05 22:24:31 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.102 2016/08/05 23:23:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -72,7 +72,7 @@
use Apache::courseclassifier();
use LONCAPA qw(:DEFAULT :match);
use DateTime::TimeZone;
-use DateTime::Locale::Catalog;
+use DateTime::Locale;
use Encode();
use Authen::Captcha;
use Captcha::reCAPTCHA;
@@ -965,15 +965,16 @@
}
$output .= '> </option>';
}
+ my @languages = &Apache::lonlocal::preferred_languages();
my (@possibles,%locale_names);
- my @locales = DateTime::Locale::Catalog::Locales;
- foreach my $locale (@locales) {
- if (ref($locale) eq 'HASH') {
- my $id = $locale->{'id'};
- if ($id ne '') {
- my $en_terr = $locale->{'en_territory'};
- my $native_terr = $locale->{'native_territory'};
- my @languages = &Apache::lonlocal::preferred_languages();
+ my @locales = DateTime::Locale->ids();
+ foreach my $id (@locales) {
+ if ($id ne '') {
+ my ($en_terr,$native_terr);
+ my $loc = DateTime::Locale->load($id);
+ if (ref($loc)) {
+ $en_terr = $loc->name();
+ $native_terr = $loc->native_name();
if (grep(/^en$/, at languages) || !@languages) {
if ($en_terr ne '') {
$locale_names{$id} = '('.$en_terr.')';
@@ -988,7 +989,7 @@
}
}
$locale_names{$id} = Encode::encode('UTF-8',$locale_names{$id});
- push (@possibles,$id);
+ push(@possibles,$id);
}
}
}
More information about the LON-CAPA-cvs
mailing list