From e5983985587cbb1652063de700dbb7585bb36ed8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 19 Nov 2013 14:21:38 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 11263: locale setting is not user friendly The locales list for subscriptions should not be retrieve from the locales of the system. This patch retrieves the locales list from the Koha DB (in the same way as pref language and opaclanguages). Test plan: Edit a subscription (or a numbering pattern) and verify the list of languages is the same as languages available in Koha. Note: with this patch we loose the saeson translation, it is normal. See report linked. Signed-off-by: Bernardo Gonzalez Kriegel Work as described. No koha-qa errors. New locale is retrieved from installed languages. I wonder if that list can be restricted to 'enabled' ones (parsing syspref language value). --- .../prog/en/modules/serials/subscription-add.tt | 8 ++++---- .../modules/serials/subscription-numberpatterns.tt | 2 +- serials/subscription-add.pl | 17 ++++++++--------- serials/subscription-numberpatterns.pl | 13 +++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index 713b3b1..57c0b59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -707,14 +707,14 @@ $(document).ready(function() { - If empty, system locale is used + If empty, English is used
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt index 686cdc8..932b54f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt @@ -231,7 +231,7 @@ function show_blocking_subs() { [% END %] - If empty, system locale is used + If empty, English is used
    diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 552b65b..2761dfc 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -215,15 +215,14 @@ if ($op eq 'addsubscription') { } $template->param(numberpatterns => \@numberpatternloop); - # Get installed locales - # FIXME this will not work with all environments. - # If call to locale fails, @locales will be an empty array, which is fine. - my @locales = map { - chomp; - # we don't want POSIX and C locales - /^C|^POSIX$/ ? () : $_ - } `locale -a`; - $template->param(locales => \@locales); + my $languages = [ map { + { + language => $_->{language}, + description => $_->{native_description} || $_->{language} + } + } @{ C4::Languages::getTranslatedLanguages() } ]; + + $template->param( locales => $languages ); output_html_with_http_headers $query, $cookie, $template->output; } diff --git a/serials/subscription-numberpatterns.pl b/serials/subscription-numberpatterns.pl index c2a9800..065ab01 100755 --- a/serials/subscription-numberpatterns.pl +++ b/serials/subscription-numberpatterns.pl @@ -105,17 +105,18 @@ if($op && ($op eq 'new' || $op eq 'modify')) { my @frequencies = GetSubscriptionFrequencies(); my @subtypes; push @subtypes, { value => $_ } for (qw/ issues weeks months /); - my @locales = map { - chomp; - /^C|^POSIX$/ ? () : $_ - } `locale -a`; + my $languages = [ map { + { + language => $_->{language}, + description => $_->{native_description} || $_->{language} + } + } @{ C4::Languages::getTranslatedLanguages() } ]; $template->param( $op => 1, frequencies_loop => \@frequencies, subtypes_loop => \@subtypes, - locales => \@locales, - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + locales => $languages, ); output_html_with_http_headers $input, $cookie, $template->output; exit; -- 1.7.9.5