Bug 10560: make it possible for default interface language to not be English
authorRobin Sheat <robin@catalyst.net.nz>
Fri, 30 Nov 2012 02:48:50 +0000 (15:48 +1300)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 12 Jul 2013 14:54:42 +0000 (14:54 +0000)
If you enable another translation, and disable English, then if you dont
have a cookie set, or your browser is not set to that language, you will
get English. So you can not disable English in either the staff client
or the OPAC.

This patch fixes the language selection to do the right thing.

To test you must have at least one other language installed besides
English. Apply the patch and disable the en translation. Koha should
fall back to one of the enabled translations.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I added a patch description and test plan, missing from the
original patch.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I have tested with various combinations of activated languages
and have found no regression. If the cookie is set, the right
language is shown accordingly. Else the first language in the
list seems to be picked. It did never fall back to English
in my tests, when English was explicitly deactivated.

Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Templates.pm

index 88b9b01..21604fc 100644 (file)
@@ -344,6 +344,10 @@ sub getlanguage {
         return $lang;
     }
 
+    # Pick the first selected syspref language
+    $lang = shift @languages;
+    return $lang if $lang;
+
     # Fall back to English if necessary
     return 'en';
 }