Bug 3754 - Language detection doesn't take really care of syspref
Summary: Language detection doesn't take really care of syspref
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: master
Hardware: All All
: P5 - low critical (vote)
Assignee: Henri-Damien LAURENT
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-03 03:27 UTC by Nahuel Angelinetti
Modified: 2019-06-27 09:24 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, before Nahuel patch (42.45 KB, image/png)
2009-11-17 13:55 UTC, Chris Cormack
Details
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, AFTER Nahuel patch (42.27 KB, image/png)
2009-11-17 14:34 UTC, Chris Cormack
Details
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, AFTER Nahuel patch (42.14 KB, image/png)
2009-11-17 14:36 UTC, Chris Cormack
Details
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, AFTER Nahuel patch AND my patch (40.92 KB, image/png)
2009-11-17 14:47 UTC, Chris Cormack
Details
[Koha-patches] [PATCH] Bug 3754: Follow-up patch (70 bytes, text/plain)
2009-11-17 14:50 UTC, Chris Cormack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:14:36 UTC


---- Reported by nahuel.angelinetti@biblibre.com 2009-11-03 15:27:03 ----

If you choose only english in "opaclanguage" or "language" syspref, and theme is translated in spanish and french.
The frenchies and spanishes browsers will use french and spanish translated files, instead of use only english files ans specified in syspref.



---- Additional Comments From ricmarques@spamcop.net 2009-11-17 13:55:57 ----

Created an attachment
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, before Nahuel patch





---- Additional Comments From ricmarques@spamcop.net 2009-11-17 14:34:15 ----

Created an attachment
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, AFTER Nahuel patch


Staff client looks much better, after applying Nahuel's patch! :)

However, I can't switch language from Português (Portuguese) to English



---- Additional Comments From ricmarques@spamcop.net 2009-11-17 14:36:38 ----

Created an attachment
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, AFTER Nahuel patch


Staff client looks much better, after applying Nahuel's patch! :)

However, I can't switch language from Português (Portuguese) to English




---- Additional Comments From ricmarques@spamcop.net 2009-11-17 14:47:19 ----

Created an attachment
Look of Koha staff client in Koha 3.0.4, with pt-BR folder, AFTER Nahuel patch AND my patch


After applying my patch, as a follow-up to Nahuel's patch, I get the same correct look of the "staff client" (thanks to Nahuel's patch) *and* I can now switch between "Português" (Portuguese) and English (thanks to my patch).





---- Additional Comments From ricmarques@spamcop.net 2009-11-17 14:50:14 ----

Created an attachment
[Koha-patches] [PATCH] http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3754: Follow-up patch


My follow-up patch (to Nahuel's patch) that enables the switch between "Português" (Portuguese) and English



---- Additional Comments From ricmarques@spamcop.net 2009-11-17 15:38:05 ----


Nahuel Angelinneti has submitted a patch that solves this problem and that was committed for the 3.0.x branch of Koha. The patch is available here:

---------------------------------------- 
(http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3754) fix language choose 
http://git.koha.org/cgi-bin/gitweb.cgi?p=Koha;a=commit;h=df25509e8c500c0e91b9f2343ebca1c7c98238cf 

author	Nahuel ANGELINETTI <nahuel.angelinetti@biblibre.com> 
	Tue, 3 Nov 2009 15:30:22 +0000 (16:30 +0100) 
committer Henri-Damien LAURENT <henridamien.laurent@biblibre.com> 
	Tue, 3 Nov 2009 15:47:46 +0000 (16:47 +0100) 
commit	df25509e8c500c0e91b9f2343ebca1c7c98238cf 
---------------------------------------- 

This patch solved a problem that I was having, in the Intranet (Staff) interface in a Koha 3.0.4 setup (UNIMARC and NoZebra installation, running in a SLES 11 virtual machine - SUSE Linux Enterprise Server 11). That installation had "Português" (Portuguese, "pt-PT") and also "Português (Brasil)" (Brazilian Portuguese, "pt-BR") template folders. After I logged in to the staff client, I got the *very weird* screenshot (in Mozilla Firefox 3.5.5, in Windows XP Professional) that's available at:

http://bugs.koha.org/cgi-bin/bugzilla3/attachment.cgi?id=1248

The languages set in Firefox (under "Tools", "Options", "Content" tab, "Languages" section) were these (in the following order):
- Portuguese [pt] 
- English/United States [en-us] 
- French [fr] 
- English [en] 


The problem was correctly traced by Chris Cormack that pointed that, for "pt-BR", there's no "includes" directory under:
/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/pt-BR


However, my System Preferences that are related to language have the following values (none of them mentions pt-BR):

mysql> select variable, value from systempreferences where variable LIKE '%lang%';
+----------------------+----------+
| variable             | value    |
+----------------------+----------+
| language             | pt-PT,en |
| opaclanguages        | pt-PT,en |
| opaclanguagesdisplay | 1        |
+----------------------+----------+
3 rows in set (0.00 sec)


The weird look of the screenshot went away when applying Nahuel's patch. Thanks Nahuel!  :) 


HOWEVER, I was unable to switch between "Português" (Portuguese) and "English". I created a follow-up patch to Nahuel's (that "builds" on his patch) and that solved the problem of being unable to switch. I sent the patch to the "Koha Patches" mailing list and the patch is available at:

[Koha-patches] [PATCH] http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3754: Follow-up patch 
http://bugs.koha.org/cgi-bin/bugzilla3/attachment.cgi?id=1252

So, I would like to ask you to also apply ("commit") my patch to the 3.0.x branch, so that it gets included for the 3.0.5 release. I don't have a git setup for the "master" branch but I suspect that these problems also happen for that one, and so the two patches should also be applied to that branch (as two patches or as a single patch).

On a related note, could you also commit the following patch (also for 3.0.5):

[Koha-patches] [PATCH] Fix for http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3730 - Wrong ISO 639-2 Language Code for Portuguese in database 
http://lists.koha.org/pipermail/koha-patches/2009-October/004766.html


Thanks and congratulations for the work already done!  :)





--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:14 UTC  ---

This bug was previously known as _bug_ 3754 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3754
Imported an attachment (id=1550)
Imported an attachment (id=1551)
Imported an attachment (id=1552)
Imported an attachment (id=1553)
Imported an attachment (id=1554)

Actual time not defined. Setting to 0.0
The original submitter of attachment 1550 [details] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 1551 [details] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 1552 [details] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 1553 [details] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 1554 [details] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.

Comment 1 Katrin Fischer 2010-12-13 11:07:17 UTC
What is the status of this patch?

I tested the behaviour in current HEAD:

German templates are installed bot not checked in sys prefs language and opaclanguages. Language chooser is enabled and doesn't list German now.

Language settings in Firefox list German as first language.

Results: 

- Firefox opens OPAC in German
- Firefox opens staff login in German
- IE opens OPAC using German templates
- IE opens staff loginin German

Libraries should be able to decide in which languages they want to offer an OPAC, same for staff.

The language detection in its current form causes some problems:

- Customization is not done in a way that it works for all languages
-  CSS files are not copied over to all language folders
- Templates are not updated
- Translations are outdated or incomplete

If we want to keep language detection (not sure we should) it should respect the language and opaclanguages sys prefs.
Comment 2 Chris Cormack 2011-04-30 08:06:12 UTC
This has been fixed in master (and 3.4.0)
Comment 3 Magnus Enger 2011-05-18 12:51:21 UTC
(In reply to comment #2)
> This has been fixed in master (and 3.4.0)

Sorry, I just tested this on 3.05.00.001 and it does not look fixed to me. The parts related to Porugues might be fixed, but not the problem described in the original bug report. 

Here's what I did: 

I have English and Norwegian installed, but only English enabled. 

When I set the language preference in my browser to English, I get the English interface - fine, no problem. 

When I set the language preference in my browser to Norwegian (either nb or nb-no), I get the Norwegian interface, even though that language has not been enabled.
Comment 4 Chris Cormack 2012-02-13 20:42:47 UTC
This is still a major problem
Comment 5 Tomás Cohen Arazi 2013-03-13 13:16:45 UTC
This was fixed when patch for bug 7874 was pushed and the desired language (browser or cookie provided) started to get tested against the list of languages by this piece of code (@languages is get from the sysprefs, any is a map function for the test):

    # Ignore a lang not selected in sysprefs
    if ( $lang && any { $_ eq $lang } @languages ) {
        return $lang;
    }

Marked resolved fixed then.