Bug 12017 - Move language description out of database
Summary: Move language description out of database
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bernardo Gonzalez Kriegel
QA Contact: Testopia
URL:
Keywords:
: 14284 (view as bug list)
Depends on: 14252
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-30 00:46 UTC by Bernardo Gonzalez Kriegel
Modified: 2021-10-15 19:36 UTC (History)
15 users (show)

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


Attachments
Bug 12017 - Move language description out of database (40.13 KB, patch)
2014-03-30 05:04 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - Followup - Sort and update lang/script/regions lists (19.56 KB, patch)
2014-03-31 01:01 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - Move language description out of database (104.28 KB, patch)
2014-04-02 04:26 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - Move language description out of database (104.26 KB, patch)
2014-04-02 04:43 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - Followup to set one location for languages.inc (41.08 KB, patch)
2014-04-02 17:57 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 1 - Move language description out of database (49.68 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 2 - Enable languages on web installer (3.22 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 3 - Change lang display on sysprefs I18N (4.50 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 4 - Change language changers (17.77 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 5 - Change local use syspref type Language (14.64 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 6 - Change syspref AdvancedSearchLanguages (14.93 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 7 - Remove function getFrameworkLanguages (3.31 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 8 - Remove use of getAllLanguages from installer (4.52 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 9 - Remove use of language_get_description function (2.97 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 10 - Remove description from getLanguage (4.09 KB, patch)
2014-04-28 02:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 1 - Move language description out of database (49.67 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 2 - Enable languages on web installer (3.22 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 3 - Change lang display on sysprefs I18N (4.51 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 4 - Change language changers (17.77 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 5 - Change local use syspref type Language (14.66 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 6 - Change syspref AdvancedSearchLanguages (14.81 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 7 - Remove function getFrameworkLanguages (3.33 KB, patch)
2014-07-21 00:03 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 8 - Remove use of getAllLanguages from installer (4.52 KB, patch)
2014-07-21 00:04 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 9 - Remove use of language_get_description function (2.96 KB, patch)
2014-07-21 00:04 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 10 - Remove description from getLanguage (4.11 KB, patch)
2014-07-21 00:04 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 1 - Move language description out of database (33.30 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 2 - Enable languages on web installer (3.22 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 3 - Change lang display on sysprefs I18N (4.50 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 4 - Change language changers (10.21 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 5 - Change local use syspref type Language (14.66 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 6 - Change syspref AdvancedSearchLanguages (13.28 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 7 - Remove function getFrameworkLanguages (3.33 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 8 - Remove use of getAllLanguages from installer (4.52 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 9 - Remove use of language_get_description function (2.98 KB, patch)
2014-11-06 18:56 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 10 - Remove description from getLanguage (4.11 KB, patch)
2014-11-06 18:57 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 1 - Move language description out of database (33.78 KB, patch)
2015-05-19 18:10 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 2 - Enable languages on web installer (3.22 KB, patch)
2015-05-19 18:10 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 3 - Change lang display on sysprefs I18N (4.67 KB, patch)
2015-05-19 18:10 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 4 - Change language changers (10.21 KB, patch)
2015-05-19 18:10 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 5 - Change local use syspref type Language (14.66 KB, patch)
2015-05-19 18:10 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 6 - Change syspref AdvancedSearchLanguages (13.76 KB, patch)
2015-05-19 18:10 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 7 - Remove function getFrameworkLanguages (3.33 KB, patch)
2015-05-19 18:11 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 8 - Remove use of getAllLanguages from installer (4.52 KB, patch)
2015-05-19 18:11 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 9 - Remove use of language_get_description function (2.98 KB, patch)
2015-05-19 18:11 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 10 - Remove description from getLanguage (4.11 KB, patch)
2015-05-19 18:11 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: followup to patch 5 (4.45 KB, patch)
2015-05-28 16:41 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017 - 1 - Move language description out of database (33.83 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 2 - Enable languages on web installer (3.28 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 3 - Change lang display on sysprefs I18N (4.73 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 4 - Change language changers (10.27 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 5 - Change local use syspref type Language (14.71 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 6 - Change syspref AdvancedSearchLanguages (13.80 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 7 - Remove function getFrameworkLanguages (3.38 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 8 - Remove use of getAllLanguages from installer (4.57 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 9 - Remove use of language_get_description function (3.03 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017 - 10 - Remove description from getLanguage (4.16 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017: followup to patch 5 (4.51 KB, patch)
2015-05-29 08:08 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 12017: 1 - Move language description out of database (33.83 KB, patch)
2015-06-18 13:59 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 2 - Enable languages on web installer (3.27 KB, patch)
2015-06-18 14:00 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 3 - Change lang display on sysprefs I18N (4.73 KB, patch)
2015-06-18 14:00 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 4 - Change language changers (9.89 KB, patch)
2015-06-18 14:00 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 5 - Change local use syspref type Language (16.29 KB, patch)
2015-06-18 14:00 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 6 - Change syspref AdvancedSearchLanguages (13.61 KB, patch)
2015-06-18 14:00 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 7 - Remove function getFrameworkLanguages (1.91 KB, patch)
2015-06-18 14:00 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 8 - Remove use of getAllLanguages from installer (4.58 KB, patch)
2015-06-18 14:01 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 9 - Remove use of language_get_description function (3.03 KB, patch)
2015-06-18 14:01 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 10 - Remove description from getLanguage (4.16 KB, patch)
2015-06-18 14:01 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12017: 11 - Change masthead language switcher (5.38 KB, patch)
2015-06-18 14:01 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Bernardo Gonzalez Kriegel 2014-03-30 00:46:03 UTC
Language descriptions are stored in database using this tables

 language_descriptions
 language_rfc4646_to_iso639
 language_subtag_registry

Those tables are filled at install time using en/mandatory/subtag_registry.sql
or translated variants.
As with any string stored in database, it's difficult to update and synchronize those files.

I propose to use language descriptions out of database using standard templates files. Then these can be translated in a standard way, and as a bonus save many access to the database
Comment 1 Bernardo Gonzalez Kriegel 2014-03-30 05:04:56 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2014-03-31 01:01:18 UTC Comment hidden (obsolete)
Comment 3 Bernardo Gonzalez Kriegel 2014-03-31 03:09:35 UTC
Note4: In the former procedure having something like this
in subtag_registry.sql was useless

INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'zh', 'language', 'zh', '中文');

INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES( 'zh', 'language', 'en', 'Chinese');

INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES( 'zh', 'language', 'fr', 'Chinois');

INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES( 'zh', 'language', 'de', 'Chinesisch');

(I mean the translations) because the former procedure will always use native
representation if present (zh - 中文), then current language (ej. in de - Chinesisch ), then english version as last resort (Chinese)

I can reintroduce native versions, hardcoded so nobody tries to translate them,
and mimic former procedure, but in that case I don't see the point to translate names.
Comment 4 Katrin Fischer 2014-03-31 03:47:01 UTC
Hi Bernardo, my impression was that the translations where used to build the langauage sarch pull down on advanced search, but I am not sure if that changed at some point.
Comment 5 Bernardo Gonzalez Kriegel 2014-04-02 04:25:39 UTC
(In reply to Katrin Fischer from comment #4)
> Hi Bernardo, my impression was that the translations where used to build the
> langauage sarch pull down on advanced search, but I am not sure if that
> changed at some point.

Hi Katrin, you are right. But I reworked it to do that, and other things :)
Comment 6 Bernardo Gonzalez Kriegel 2014-04-02 04:26:17 UTC Comment hidden (obsolete)
Comment 7 Bernardo Gonzalez Kriegel 2014-04-02 04:41:01 UTC
Sorry, resubmit to fix koha-qa errors
Comment 8 Bernardo Gonzalez Kriegel 2014-04-02 04:43:58 UTC Comment hidden (obsolete)
Comment 9 paxed 2014-04-02 05:24:51 UTC
[%# "WARNING: This file must be replicated on 'include' dir" %]
[%# "for each staff/opac theme"                              %]

It's the exact same information in each file. To reduce the chance of these files getting out of sync, wouldn't it be better to have a single file?  And, IMO, these language names have no need to be translatable, either.
Comment 10 Katrin Fischer 2014-04-02 05:35:37 UTC
If we aim for keeping the same functionality, the translations are needed - we use them on the advanced search language pull down. I think there is currently no way to use the same file for OPAC and staff as the template directories are separate.
Comment 11 paxed 2014-04-02 05:44:31 UTC
(In reply to Katrin Fischer from comment #10)
> If we aim for keeping the same functionality, the translations are needed -
> we use them on the advanced search language pull down. I think there is
> currently no way to use the same file for OPAC and staff as the template
> directories are separate.

Yes, but if I understand correctly, after this patch, these would be picked up into the po-files. Why would these need to be translatable in there?
Comment 12 Katrin Fischer 2014-04-02 05:46:04 UTC
Hm, I am not sure I understand the problem. Currently we keep the native name of the language and the (quite incomplete) translations in the sql files. This just moves it to the standard procedure, enabling every translator to have the translations without adding to the SQL file?
Comment 13 paxed 2014-04-02 05:59:43 UTC
(In reply to Katrin Fischer from comment #12)
> Hm, I am not sure I understand the problem. Currently we keep the native
> name of the language and the (quite incomplete) translations in the sql
> files. This just moves it to the standard procedure, enabling every
> translator to have the translations without adding to the SQL file?

Nevermind, you're right about that.

Still, having the same code in triplicate (once for each theme), is a bit fragile.
Comment 14 Bernardo Gonzalez Kriegel 2014-04-02 17:57:00 UTC
(In reply to paxed from comment #13)
> Still, having the same code in triplicate (once for each theme), is a bit
> fragile.

It's fragile, a lot. 
I add a patch to show how this could be solved.
Comment 15 Bernardo Gonzalez Kriegel 2014-04-02 17:57:54 UTC Comment hidden (obsolete)
Comment 16 Chris Cormack 2014-04-24 15:15:40 UTC
Falling back to patching base and 3-way merge...
Auto-merging opac/opac-search.pl
CONFLICT (content): Merge conflict in opac/opac-search.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc
Auto-merging catalogue/search.pl
CONFLICT (content): Merge conflict in catalogue/search.pl
Auto-merging C4/Languages.pm
Failed to merge in the changes.
Comment 17 Bernardo Gonzalez Kriegel 2014-04-24 16:51:07 UTC
Bug 10968 added a good feature. Need to rethink this.
Comment 18 Bernardo Gonzalez Kriegel 2014-04-24 18:11:01 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #17)
> Bug 10968 added a good feature. Need to rethink this.
Sorry, I mean 10986 :(
Comment 19 Bernardo Gonzalez Kriegel 2014-04-28 02:03:13 UTC Comment hidden (obsolete)
Comment 20 Bernardo Gonzalez Kriegel 2014-04-28 02:03:17 UTC Comment hidden (obsolete)
Comment 21 Bernardo Gonzalez Kriegel 2014-04-28 02:03:22 UTC Comment hidden (obsolete)
Comment 22 Bernardo Gonzalez Kriegel 2014-04-28 02:03:25 UTC Comment hidden (obsolete)
Comment 23 Bernardo Gonzalez Kriegel 2014-04-28 02:03:30 UTC Comment hidden (obsolete)
Comment 24 Bernardo Gonzalez Kriegel 2014-04-28 02:03:34 UTC Comment hidden (obsolete)
Comment 25 Bernardo Gonzalez Kriegel 2014-04-28 02:03:38 UTC Comment hidden (obsolete)
Comment 26 Bernardo Gonzalez Kriegel 2014-04-28 02:03:42 UTC Comment hidden (obsolete)
Comment 27 Bernardo Gonzalez Kriegel 2014-04-28 02:03:47 UTC Comment hidden (obsolete)
Comment 28 Bernardo Gonzalez Kriegel 2014-04-28 02:03:51 UTC Comment hidden (obsolete)
Comment 29 Bernardo Gonzalez Kriegel 2014-04-28 02:26:55 UTC
Changed from one patch to a patch series, to make clear what is changed on each one.

In my opinion the only table that is useful is language_rfc4646_to_iso639,
and it need to be completed.

Two more things are needed: a serious cleaning of Languages.pm, and the removing of useless data from database and sql files.

Just to remember, the purpose of this is to enable an easy translation of language descriptions :)
Comment 30 Katrin Fischer 2014-07-20 22:04:17 UTC
Hi Bernardo,

I'd love to test this - could you rebase?
Comment 31 Bernardo Gonzalez Kriegel 2014-07-21 00:03:16 UTC Comment hidden (obsolete)
Comment 32 Bernardo Gonzalez Kriegel 2014-07-21 00:03:24 UTC Comment hidden (obsolete)
Comment 33 Bernardo Gonzalez Kriegel 2014-07-21 00:03:32 UTC Comment hidden (obsolete)
Comment 34 Bernardo Gonzalez Kriegel 2014-07-21 00:03:38 UTC Comment hidden (obsolete)
Comment 35 Bernardo Gonzalez Kriegel 2014-07-21 00:03:47 UTC Comment hidden (obsolete)
Comment 36 Bernardo Gonzalez Kriegel 2014-07-21 00:03:52 UTC Comment hidden (obsolete)
Comment 37 Bernardo Gonzalez Kriegel 2014-07-21 00:03:57 UTC Comment hidden (obsolete)
Comment 38 Bernardo Gonzalez Kriegel 2014-07-21 00:04:03 UTC Comment hidden (obsolete)
Comment 39 Bernardo Gonzalez Kriegel 2014-07-21 00:04:09 UTC Comment hidden (obsolete)
Comment 40 Bernardo Gonzalez Kriegel 2014-07-21 00:04:15 UTC Comment hidden (obsolete)
Comment 41 Bernardo Gonzalez Kriegel 2014-07-21 00:17:33 UTC
Rebased on master :)
To test I suggest to apply all patches and then follow each test plan.
Comment 42 Bernardo Gonzalez Kriegel 2014-07-21 00:19:42 UTC
Sorry, Needs Signof
Comment 43 Bernardo Gonzalez Kriegel 2014-11-06 18:56:04 UTC Comment hidden (obsolete)
Comment 44 Bernardo Gonzalez Kriegel 2014-11-06 18:56:10 UTC Comment hidden (obsolete)
Comment 45 Bernardo Gonzalez Kriegel 2014-11-06 18:56:17 UTC Comment hidden (obsolete)
Comment 46 Bernardo Gonzalez Kriegel 2014-11-06 18:56:23 UTC Comment hidden (obsolete)
Comment 47 Bernardo Gonzalez Kriegel 2014-11-06 18:56:29 UTC Comment hidden (obsolete)
Comment 48 Bernardo Gonzalez Kriegel 2014-11-06 18:56:36 UTC Comment hidden (obsolete)
Comment 49 Bernardo Gonzalez Kriegel 2014-11-06 18:56:43 UTC Comment hidden (obsolete)
Comment 50 Bernardo Gonzalez Kriegel 2014-11-06 18:56:49 UTC Comment hidden (obsolete)
Comment 51 Bernardo Gonzalez Kriegel 2014-11-06 18:56:55 UTC Comment hidden (obsolete)
Comment 52 Bernardo Gonzalez Kriegel 2014-11-06 18:57:01 UTC Comment hidden (obsolete)
Comment 53 Bernardo Gonzalez Kriegel 2014-11-06 18:57:53 UTC
Rebased & updated
Comment 54 Paola Rossi 2014-11-11 16:27:56 UTC
I've tried to apply the patches against master 3.17.00.052

Applying: Bug 12017 - 3 - Change lang display on sysprefs I18N
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
Failed to merge in the changes.
Patch failed at 0001 Bug 12017 - 3 - Change lang display on sysprefs I18N

So I pass the patch to "Patch doesn't apply" status.
Comment 55 Mark Tompsett 2015-04-22 14:50:39 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #53)
> Rebased & updated

Could you rebase and update again?
Comment 56 Bernardo Gonzalez Kriegel 2015-05-19 18:10:25 UTC Comment hidden (obsolete)
Comment 57 Bernardo Gonzalez Kriegel 2015-05-19 18:10:34 UTC Comment hidden (obsolete)
Comment 58 Bernardo Gonzalez Kriegel 2015-05-19 18:10:40 UTC Comment hidden (obsolete)
Comment 59 Bernardo Gonzalez Kriegel 2015-05-19 18:10:46 UTC Comment hidden (obsolete)
Comment 60 Bernardo Gonzalez Kriegel 2015-05-19 18:10:52 UTC Comment hidden (obsolete)
Comment 61 Bernardo Gonzalez Kriegel 2015-05-19 18:10:58 UTC Comment hidden (obsolete)
Comment 62 Bernardo Gonzalez Kriegel 2015-05-19 18:11:05 UTC Comment hidden (obsolete)
Comment 63 Bernardo Gonzalez Kriegel 2015-05-19 18:11:11 UTC Comment hidden (obsolete)
Comment 64 Bernardo Gonzalez Kriegel 2015-05-19 18:11:17 UTC Comment hidden (obsolete)
Comment 65 Bernardo Gonzalez Kriegel 2015-05-19 18:11:23 UTC Comment hidden (obsolete)
Comment 66 Bernardo Gonzalez Kriegel 2015-05-19 18:12:26 UTC
Rebased and updated
Comment 67 Julian FIOL 2015-05-28 14:21:20 UTC
Hi Bernardo, 

This is a very interesting patch !

I have tested each patch one-by-one, and my only remark is with the new syspref AdvancedSearchLanguages, when you clic on edit, you loose the languages nav-bar.

Test Plan
---------
0. You should have several languages installed and activated to see the languages nav-bar.
1. Clic on "Koha administration"
2. Clic on "Global system preferences"
3. Clic on "Local use"
4. Find "AdvancedSearchLanguages" syspref and clic on "edit"

Your languages nav-bar disappeared
Comment 68 Julian FIOL 2015-05-28 14:38:33 UTC
The bug mentioned at Comment #67 is happening when we create a new syspref with type = Language
Comment 69 Mark Tompsett 2015-05-28 14:56:52 UTC
*** Bug 14284 has been marked as a duplicate of this bug. ***
Comment 70 Bernardo Gonzalez Kriegel 2015-05-28 16:41:36 UTC Comment hidden (obsolete)
Comment 71 Bernardo Gonzalez Kriegel 2015-05-28 16:46:37 UTC
(In reply to Julian FIOL from comment #67)
> This is a very interesting patch !

Thanks for testing!!

> 
> I have tested each patch one-by-one, and my only remark is with the new
> syspref AdvancedSearchLanguages, when you clic on edit, you loose the
> languages nav-bar.
> 
> Test Plan
> ---------
> 0. You should have several languages installed and activated to see the
> languages nav-bar.
> 1. Clic on "Koha administration"
> 2. Clic on "Global system preferences"
> 3. Clic on "Local use"
> 4. Find "AdvancedSearchLanguages" syspref and clic on "edit"
> 
> Your languages nav-bar disappeared

Good catch!!
Problem was that i used a variable set by Templates.pm to show
languages selector.
Fixed.
Comment 72 Mark Tompsett 2015-05-28 17:03:29 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #71)
> Good catch!!
> Problem was that i used a variable set by Templates.pm to show
> languages selector.
> Fixed.

Have you considered a 'git rebase -i' and then moving your last patch just under 5, and squashing them?
Comment 73 Julian FIOL 2015-05-29 08:08:18 UTC Comment hidden (obsolete)
Comment 74 Julian FIOL 2015-05-29 08:08:22 UTC Comment hidden (obsolete)
Comment 75 Julian FIOL 2015-05-29 08:08:26 UTC Comment hidden (obsolete)
Comment 76 Julian FIOL 2015-05-29 08:08:29 UTC Comment hidden (obsolete)
Comment 77 Julian FIOL 2015-05-29 08:08:33 UTC Comment hidden (obsolete)
Comment 78 Julian FIOL 2015-05-29 08:08:37 UTC Comment hidden (obsolete)
Comment 79 Julian FIOL 2015-05-29 08:08:40 UTC Comment hidden (obsolete)
Comment 80 Julian FIOL 2015-05-29 08:08:44 UTC Comment hidden (obsolete)
Comment 81 Julian FIOL 2015-05-29 08:08:47 UTC Comment hidden (obsolete)
Comment 82 Julian FIOL 2015-05-29 08:08:51 UTC Comment hidden (obsolete)
Comment 83 Julian FIOL 2015-05-29 08:08:55 UTC Comment hidden (obsolete)
Comment 84 Jonathan Druart 2015-06-04 12:07:09 UTC
Just looking at the patches:
Why don't you remove language_get_description?
Why did you write "getLanguages_iso"? Prefer get_languages_iso or getLanguagesIso. (not blocker)

Otherwise all looks good so far!

Could we get another signoff here please?
Comment 85 Bernardo Gonzalez Kriegel 2015-06-04 12:26:11 UTC
(In reply to Jonathan Druart from comment #84)
> Just looking at the patches:
> Why don't you remove language_get_description?

I was considering a rewrite/move of C4/Languages.pm to Koha/Languages.pm
Then we can clean it up.

> Why did you write "getLanguages_iso"? Prefer get_languages_iso or
> getLanguagesIso. (not blocker)

Sorry, don't know what was thinking :)
getLanguagesIso is better, can change it.
Comment 86 Julian FIOL 2015-06-18 10:00:37 UTC
I wanted to add that this patch optimize the number of MySQL requests in a significant way :

On the mainpage with 3 languages installed and activated we save 67 queries for each load. 
This is a good MySQL optimization.


Test plan
---------

1. mysql> SHOW GLOBAL STATUS
      Com_select  = X1 (number of queries like 'SELECT ...')
      Qcache_hits = Y1 (number of queries automatically cached by MySQL)

2. Reload your mainpage

3. mysql> SHOW GLOBAL STATUS
      Com_select  = X2
      Qcache_hits = Y2

4. (X2 + Y2) - (X1 + Y1) = number of queries saved
Comment 87 Bernardo Gonzalez Kriegel 2015-06-18 13:59:52 UTC
Created attachment 40285 [details] [review]
Bug 12017: 1 - Move language description out of database

This patch adds identical copies of languages.inc
file on include dirs, and modifies include files
to process it.

To test:
1. No change on current behavior must be observer,
any page staff/opac

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 88 Bernardo Gonzalez Kriegel 2015-06-18 14:00:04 UTC
Created attachment 40286 [details] [review]
Bug 12017: 2 - Enable languages on web installer

This patch modifies installer/step1.tt to use new
language descriptions.
Only parameter used is rfc4646 code.

To test:
1. Do some fake translations, for example all langs
for l in $(cd misc/translator/po; ls *-pref.po | sed 's/-pref.po//'); do
mkdir koha-tmpl/intranet-tmpl/prog/$l;
mkdir koha-tmpl/opac-tmpl/bootstrap/$l;
mkdir koha-tmpl/opac-tmpl/prog/$l;
mkdir koha-tmpl/opac-tmpl/ccsr/$l;
done

or make some lang dirs on intranet-tmpl/prog

2. Apply the patch

3. Edit your koha-conf.xml, change database name to a
new name, create that database and grant access, reload
staff page, log in with database user, you will be
redirected to step1 of web installer.

4. Check names and codes for installed languages.

Revert to your old database before proceed,
but left dirs.

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 89 Bernardo Gonzalez Kriegel 2015-06-18 14:00:14 UTC
Created attachment 40287 [details] [review]
Bug 12017: 3 - Change lang display on sysprefs I18N

This patch change the display of languages on sysprefs
to set translated languages on I18N

Only parameter used is rfc4646 subtag

To test:
1. Apply the patch
2. Go to I18N syspref, look language descriptions

Following steps are for next patch

3. Set a bunch of languages for staff/opac, save, reload
Inlude vi-VN for which there is no current description
in databasse
4. Set opaclanguagesdisplay to Allow

Current display is preserved, native description for
languages outside group, and script/region for language
groups

Only change is languages ordered by rfc4646 subtag

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 90 Bernardo Gonzalez Kriegel 2015-06-18 14:00:25 UTC
Created attachment 40288 [details] [review]
Bug 12017: 4 - Change language changers

This patch modifies language changers on staff/opac
Only parameter used is rfc4646

To test:
1. Apply the patch
2. Reload staff and opac (prog/ccsr/bootstrap)
3. Check display of language changers
4. Do a real translation and check language change works

Do not change language unless you did a real translation

Only change in display is showing only regions for sublanguages.

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 91 Bernardo Gonzalez Kriegel 2015-06-18 14:00:39 UTC
Created attachment 40289 [details] [review]
Bug 12017: 5 - Change local use syspref type Language

This patch changes local use syspref of type Language
Currently this type of syspref is not used, and shows
currently translated staff languages. It's values
can't be changed.

To make something useful, this kind of syspref is
changed to show all langs and save iso639_2 codes.
And they not use descriptions on database, only
rfc4646 codes from templates.

It's easy to add new kinds that save rfc4646 codes,
or only show translated languages.

To test:
1. Apply the patch
2. Go to system preferences, local use
3. Define a new syspref, any name/description, type
'Language', Save

4. New syspref is showed as a multiple selection of
iso639_2 codes with current lang and native names.
Check that

5. Select some values, save, check they are saved
and restored

6. Edit, similar view, change values, save, check

7. Delete test syspref

Values are stored as ',' separated values
Verify in database

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>

(Squashed followup)

Bug 12017: followup to patch 5

Local use syspref of type language need to use a different
variable to store languages, if not bottom language selector
does not show.

Also change multiple and selected attributes for
XHTML compatibility, and a tab char

To test:
1) Apply patch 5 and this one
2) On add/edit Language type Local use syspref,
check bottom language selector shows up.

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>

Changed sub name getLanguages_iso -> getLanguagesIso
Comment 92 Bernardo Gonzalez Kriegel 2015-06-18 14:00:49 UTC
Created attachment 40290 [details] [review]
Bug 12017: 6 - Change syspref AdvancedSearchLanguages

Bug 10986 introduces a way of limiting advanced search
languages list. It's a good feature, but to fill the
preference you need to list iso639_2 codes. And there
is no way to get the list of all codes again as
before, and language descriptions are taken from database.

This patch changes that preference so it's now
a Local syspref, to present an interface to set
it's value. Also adds another syspref to control
if language chooser is limited at all, recovering
previous behavior.

As per comments on Bug 10986 language list shows
translated and native names and is ordered by
iso639_2 code

To test:
1. Apply the patch
2. Run updatedatabase.pl
3. Go to system preferences, Searching, new syspref
LimitAdvancedSearchLanguages, on by default
4. Go to Local use sysprefs, AdvancedSearchLanguages
is now here with interface to set it's values
5. Check language limit on advanced search on
staff and opac (any theme)
6. Disable limit and chech language list
7. Enable limit and set different languages
on syspref, check language list

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 93 Bernardo Gonzalez Kriegel 2015-06-18 14:00:59 UTC
Created attachment 40291 [details] [review]
Bug 12017: 7 - Remove function getFrameworkLanguages

[ Note: From now on dependence on language descriptions
in database is about to be removed, also some code
cleaning.]

This must be an old relic, not used anymore.

To test:
1. Check use of getFrameworkLanguages
egrep -Rl getFrameworkLanguages *

No result save for definition file
2. Apply the patch
3. check again, no results

Reason for removing this function is that it's not
used and tries to send languages descriptions from database

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 94 Bernardo Gonzalez Kriegel 2015-06-18 14:01:10 UTC
Created attachment 40292 [details] [review]
Bug 12017: 8 - Remove use of getAllLanguages from installer

getAllLanguages is only used on installer/install.pl,
and some tests.

Result parameters are passed to C4/Install.pm, but
its use is futile, language check on Installer.pm uses
parameters that are not present on return value of
getAllLanguages, and returned value fwk_code is
undefined

To test:
1. Apply the patch
2. Do translated install (eg using de-DE or es-ES)
a. translate first,
b. then create a new database,
c. grant permissions,
d. change koha-conf to use new db,
e. reload staff,
f. proceed to web install,
g. select translated language,
h. use marc21,
i. finish,
3. Login and check that marc frameworks are translated

The translated install must proceed without problems.

Removed only the very first occurence of template parameter
fwk_language because of it's null value.

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 95 Bernardo Gonzalez Kriegel 2015-06-18 14:01:21 UTC
Created attachment 40293 [details] [review]
Bug 12017: 9 - Remove use of language_get_description function

This patch removes every use of language_get_description
function. This function retrieves lang names from database

To test:
1. Functionality removed by this patch do not
affect anything, because previous patches are
only using rfc4646_subtag value, not values stored
in database.
2. Removed import from Templates.pm, not used there

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 96 Bernardo Gonzalez Kriegel 2015-06-18 14:01:37 UTC
Created attachment 40294 [details] [review]
Bug 12017: 10 - Remove description from getLanguage

This patch rewrites getLanguage function.
This function is of not much use, but is
rewrited to takes its data from language_rfc4646_to_iso639
table.

To test:
1. Apply the patch
2. Only place that use this function is t/db_dependent/Languages.t
so run the test and check that it pass
3. To compare the output pre and post patch you can run
perl -e 'use C4::Languages; use Data::Dumper; $a = getLanguages(); print Dumper $a;'

Signed-off-by: Julian FIOL <julian.fiol@biblibre.com>
Comment 97 Bernardo Gonzalez Kriegel 2015-06-18 14:01:46 UTC
Created attachment 40295 [details] [review]
Bug 12017: 11 - Change masthead language switcher

On top of Bug 14252

This patch adapt to new style masthead language switcher

To test:
1) Apply the patch
2) Install and enable on opac some languages and sublanguages
e.g. es-ES de-DE de-CH en-NZ
3) Check that masthead language switcher shows language description
and region description for sublanguages
Comment 98 Bernardo Gonzalez Kriegel 2015-06-18 14:13:06 UTC
(In reply to Julian FIOL from comment #86)
> I wanted to add that this patch optimize the number of MySQL requests in a
> significant way :

Thanks for keep testing :)

A few changes:

1) Added 14252 as dependence, it's PQA and needs to be taken into account
2) Squashed Patch 5 and it's followup
3) Changed sub name getLanguages_iso -> getLanguagesIso
4) Added Patch 11 to handle masthead lang changer from Bug 14252

I preserved Julian sings, but last patch needs one.

And Jonathan wants another another sign from an additional tester...
so if you want to test, best way is apply all patches from Bug 14252 and this one, then follow test plant from each patch.
Comment 99 Héctor Eduardo Castro Avalos 2016-01-20 19:55:34 UTC
Hi Bernardo

Patch doesn't apply anymore changing status.
Comment 100 David Cook 2021-04-26 00:36:38 UTC
Thanks for working on this, Bernardo. I think I ignored the language* tables for years until I needed to work on them this past Friday...

I'm not sure I follow all the changes across all the patches though.

Overall, I was thinking that we could keep a database table in Koha with language codes and the native name for the language. Examples: en, eng, English; zh, chi, 中文. 

Then we could have a template that defines a hash map which can be used to provide translated versions. 

For example:
[% BLOCK en %]Anglais[% END %]
[% BLOCK fr %]Français[% END %]
[% langs.en = INCLUDE en %]
[% langs.fr = INCLUDE fr %]

We could then iterate through the database list and show translated names where possible based on the hash map lookup using the code.
Comment 101 David Cook 2021-04-28 04:21:58 UTC
Comment on attachment 40288 [details] [review]
Bug 12017: 4 - Change language changers

Review of attachment 40288 [details] [review]:
-----------------------------------------------------------------

::: koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc
@@ +5,4 @@
>          <div id="changelanguage" class="navbar navbar-fixed-bottom">
>              <div class="navbar-inner">
>          <ul id="i18nMenu" class="nav">
> +        [% FOREACH languages_loo IN languages_loop.sort('rfc4646_subtag') %]

It seems to me the ideal way would be to sort by the user's chosen language.

That said, I'm not sure that translated names are always provided, so maybe a system preference for ordering language makes sense?
Comment 102 David Cook 2021-04-28 04:24:14 UTC
Note that Chinese sorts using radical and stroke count. So English, French, and Chinese would be sorted as '中文','法文','英文' (Chinese, French, English respectively). 

That doesn't correspond to the more western-centric language codes.
Comment 103 David Cook 2021-04-28 05:16:25 UTC
(In reply to David Cook from comment #102)
> Note that Chinese sorts using radical and stroke count. So English, French,
> and Chinese would be sorted as '中文','法文','英文' (Chinese, French, English
> respectively). 
> 
> That doesn't correspond to the more western-centric language codes.

Then again maybe it is just doing a byte order sort...

中 = e4b8ad
法 = e6b395
英 = e88bb1

So I guess that theory is out the window. I think users without alphabets just suffer with Koha?