From c3c7068709177408af59fb4e9538f623ba945a18 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Sun, 6 Jul 2014 20:21:43 -0300 Subject: [PATCH] Bug 12534 - PROG/CCSR deprecation: Make getlanguages() theme independent for opac This patch removes a reference to prog theme on getlanguages() when ENV var HTTP_ACCEPT_LANGUAGE is checked. Changed to use sysprefs to find theme for opac and intranet To test: 1) Apply the patch 2) Translate for a couple of languages: de-DE, fr-FR, es-ES, etc 3) Enable those languages for OPAC on I18N prefs 4) Using Firefox, clean all history/cookies 5) Change variable intl.accept_languages (will do several times) a) got to about:config b) search 'lang' c) look for the variable, double click, change to 'de-DE' 6) Go to opac page, must load in german 7) Repeat for each translated lang: clean > change val > reload opac On each case opac must load on configured language 8) Just to test, set variable on untranslated lang, opac page must load on first value of list of enabled languages 9) prove t/Languages.t Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Languages.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Languages.pm b/C4/Languages.pm index 78d54a9069..57bef47465 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -571,6 +571,7 @@ sub getlanguage { $cgi //= new CGI; my $interface = C4::Context->interface; + my $theme = C4::Context->preference( ( $interface eq 'opac' ) ? 'opacthemes' : 'template' ); my $language; my $preference_to_check = @@ -592,7 +593,7 @@ sub getlanguage { # HTTP_ACCEPT_LANGUAGE if ( !$language && $ENV{HTTP_ACCEPT_LANGUAGE} ) { $language = accept_language( $ENV{HTTP_ACCEPT_LANGUAGE}, - getTranslatedLanguages( $interface, 'prog' ) ); + getTranslatedLanguages( $interface, $theme ) ); } # Ignore a lang not selected in sysprefs -- 2.39.5