Bug 14912 - Sort Advanced Search Languages by priority
Summary: Sort Advanced Search Languages by priority
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Lari Taskula
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-28 11:59 UTC by Lari Taskula
Modified: 2021-02-16 08:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 14912: Sort Advanced Search Languages by priority (1.97 KB, patch)
2015-09-28 12:04 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 14912: Sort Advanced Search Languages by priority (2.06 KB, patch)
2015-09-28 12:10 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 14912: Sort Advanced Search Languages by priority (2.21 KB, patch)
2015-09-29 06:53 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 14912: (follow-up) Use priority sorting only if AdvancedSearchLanguagesSort is set to priority. (5.51 KB, patch)
2015-10-08 11:06 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 14912: (follow-up) Use priority sorting only if AdvancedSearchLanguagesSort is set to priority. (5.58 KB, patch)
2015-10-12 06:07 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Taskula 2015-09-28 11:59:30 UTC
Libraries should be able to control the priority of languages in the advanced search drop-down list. This could be achieved by sorting them according to the AdvancedSearchLanguages system preference.
Comment 1 Lari Taskula 2015-09-28 12:04:40 UTC Comment hidden (obsolete)
Comment 2 Lari Taskula 2015-09-28 12:10:43 UTC Comment hidden (obsolete)
Comment 3 Marc Véron 2015-09-29 06:53:38 UTC
Created attachment 42944 [details] [review]
Bug 14912: Sort Advanced Search Languages by priority

Libraries should be able to control the priority of languages in the advanced
search drop-down list. This could be achieved by sorting them according to the
AdvancedSearchLanguages system preference.

To test:
-1. Set some languages into AdvancedSearchLanguages system preference

1. Go to advanced search and look at Languages drop-down list
2. Note that the list is in alphabetical order
3. Apply patch
4. Repeat step 1
5. Note that the list is sorted like AdvancedSearchLanguages

Works as expected
Signed-off-by: Marc Véron <veron@veron.ch>
Comment 4 Katrin Fischer 2015-09-29 22:27:12 UTC
I am not sure about this solution - it removes the option to have alphabetic sorting AND a limited list of language options. Even if you sort the entries in AdvancedSearchLanguages correct for one language, it will be wrong for another.
Comment 5 Marc Véron 2015-09-30 07:03:18 UTC
(In reply to Katrin Fischer from comment #4)
> I am not sure about this solution - it removes the option to have alphabetic
> sorting AND a limited list of language options. Even if you sort the entries
> in AdvancedSearchLanguages correct for one language, it will be wrong for
> another.

Good point. I guess the solution would be to have an additional sysypref, something like SortAdvancedSearchLanguages [Alphabetically | As defined]
Comment 6 Katrin Fischer 2015-09-30 07:33:59 UTC
Yes, that would make sense to me.
Comment 7 Lari Taskula 2015-10-08 11:06:25 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2015-10-11 19:38:28 UTC
Hi Lari,

It seems that the alphabetical order uses the English language names and not the (translated) names, is that the case?

I have: fre|eng|ger
Order: alphabetically

and I get E-D-F instead of D-E-F:

English (English)
Deutsch (German)
Français (French)
Comment 9 Josef Moravec 2015-10-12 06:07:43 UTC
Created attachment 43333 [details] [review]
Bug 14912: (follow-up) Use priority sorting only if AdvancedSearchLanguagesSort is set to priority.

This patch adds a system preference "AdvancedSearchLanguagesSort" that defines
whether the drop-down list should be sorted by priority in AdvancedSearchLanguages
or alphabetically like before.

To test:
-1. Set some languages into AdvancedSearchLanguages system preference

1. Go to advanced search and look at Languages drop-down list
2. Note that the list is in alphabetical order
3. Apply patches and run database update
4. Change system preference AdvancedSearchLanguagesSort to "by priority"
5. Repeat step 1
6. Note that the list is sorted like AdvancedSearchLanguages
7. Change system preference AdvancedSearchLanguagesSort to "alphabetically"
8. Repeat step 1
9. Note that the list is again in alphabetical order

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Works as expected
Comment 10 Josef Moravec 2015-10-12 06:10:12 UTC
Marc, I tried some combinations, including the one you wrote about, but I have no problems with sorting. Is it possible that something else comes into effect?
Comment 11 Jonathan Druart 2015-10-15 09:08:47 UTC
Lari,
Don't you think it would be better to have the 2 prefs on the same line (Same as OpacSeparateHoldings and OpacSeparateHoldingsBranch)?
Comment 12 Marc Véron 2015-10-15 10:20:48 UTC
(In reply to Josef Moravec from comment #10)
> Marc, I tried some combinations, including the one you wrote about, but I
> have no problems with sorting. Is it possible that something else comes into
> effect?

Josef,

The problem is that sorting happens with iso639-2. 
(Lanugages.pm after line 255)

See: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

For German (Deutsch), the code can be ger *or* deu. With ger it would be sorted as g and not as d (Deutsch). There are more languages where the code can be ambivalent, e.g. dutch, and it is not guaranteed that it is alphabetically on the same place as the native name.

Maye the usage of ambivalent codes depends in Koha on what language was used during installation, that could explain that it works for you and not for me.

In my opinion, the sorting should happen with the native description anyway, not with the iso 639-2 code.

BTW, the native description already exists Lanugages.pm (see around line 240).