The locale field in subscriptions currently defaults to empty, with a note that in this case English will be used automatically. If it really defaults to English, then it would make sense to offer an option to preselect it to the currently selected template language or to a language chosen in configuration.
Note: in our 3.16.1 installation it always defaults to "Urdu"... I was not able to reproduce this in master, but have seen it multiple times when testing and presenting.
This is still a problem in 3.18.5.1 The pull down defaults to Urdu instead of empty. The note says: If empty, English is used - independent of the selected display language.
Hm, there is a deeper problem behind this in the creation of the language list. Multiple entries are marked as selected in the source code with an empty value attribute: ... <option value="por">Português (Portuguese)</option> <option value="rum">Român (Romanian)</option> <option value="rus">Русский (Russian)</option> <option value="" selected="selected">Cрпски (Serbian)</option> <option value="spa">Español (Spanish)</option> <option value="swe">Svenska (Swedish)</option> <option value="" selected="selected">Tetun (Tetum)</option> <option value="tha">ภาษาไทย (Thai)</option> <option value="tur">Türkçe (Turkish)</option> <option value="ukr">Українська (Ukranian)</option> <option value="" selected="selected">اردو (Urdu)</option> ... The preselection of Urdu also happens in the English GUI.
Somethins strange is happening here - on master the options are clean and complete, but on switching to German the language list stays in English?
Sorry but can't reproduce, on master and 3.16.10 Tried using German and Spanish
I think the problem might be missing language descriptions - some of our installations are pretty old. I will try to update the database tables and see if this fixes the problem.
Hm, bit puzzled here. I have 2 installations, both 3.18.5.1 currently. Example: Urdu Installation 1: <option value="" selected="selected">اردو (Urdu)</option> Installation 2: <option value="urd" selected="selected">اردو (Urdu)</option> I haven't spotted the difference in the database yet, that would cause the difference. The one showing the code directly is actually the older database. There are about 4-5 languages where the code is missing in the list. They are all also 'selected'.
To reproduce on master: delete a couple of values from language_rfc4646_to_iso639 table. For example DELETE FROM language_rfc4646_to_iso639 WHERE rfc4646_subtag IN ('ta','ur') gives a pulldown that defaults to Urdu (or the last lang without 3 letter code) and 'ta' (tamil) is also selected. Problem is missing values in that table. We can hide the problem removing pulldown entries without proper iso639-2 code
That might be good - I think I can fix this database with your hints, but there are probably more installations out there with that problem. It looks like we don't have a clean state for installations that have gone threw a few updates.
Created attachment 40246 [details] [review] Bug 12616: Locale in subscriptions not preselecting correctly There is a problem if a language is present but don't have ISO639-2 code. Locale pulldown on serial suscription is malformed. To reproduce on master: a) remove some entries on language_rfc4646_to_iso639 b) go to Serials > New suscription c) Put any value on Vendor and record, press Next>> d) Look at locale pulldown, it must default to last removed lang from a), also other langs has no value and are also 'selected' on html To test: 1) Reproduce the bug 2) Apply the patch 3) Add New suscription, pulldown must be fixed
You're the best - thx Bernardo!
Created attachment 40250 [details] [review] Bug 12616: Locale in subscriptions not preselecting correctly There is a problem if a language is present but don't have ISO639-2 code. Locale pulldown on serial suscription is malformed. To reproduce on master: a) remove some entries on language_rfc4646_to_iso639 b) go to Serials > New suscription c) Put any value on Vendor and record, press Next>> d) Look at locale pulldown, it must default to last removed lang from a), also other langs has no value and are also 'selected' on html To test: 1) Reproduce the problem 2) Apply the patch 3) Add New suscription, pulldown must be fixed NOTE: Deleted Urdu and Chinese. Master had both "selected" in the HTML. Applied patch, neither were added. Defaults to first item, which is blank meaning English. Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Don't you think it's better to fix the DB data?
I think we should do both - it could be hard to get all edge cases for the old databases where we have slacked with the database updates. This fixes a problem until we can figure out a more complete solution (maybe bug 12017?)
Created attachment 40254 [details] [review] Bug 12616: Locale in subscriptions not preselecting correctly There is a problem if a language is present but don't have ISO639-2 code. Locale pulldown on serial suscription is malformed. To reproduce on master: a) remove some entries on language_rfc4646_to_iso639 b) go to Serials > New suscription c) Put any value on Vendor and record, press Next>> d) Look at locale pulldown, it must default to last removed lang from a), also other langs has no value and are also 'selected' on html To test: 1) Reproduce the problem 2) Apply the patch 3) Add New suscription, pulldown must be fixed NOTE: Deleted Urdu and Chinese. Master had both "selected" in the HTML. Applied patch, neither were added. Defaults to first item, which is blank meaning English. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Patch pushed to master. Good catch Bernardo!
Pushed to 3.20.x will be in 3.20.2
Pushed to 3.18.x will be in 3.18.09