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
Created attachment 26691 [details] [review] Bug 12017 - Move language description out of database This patch moves language descriptions from database into template files, to ease the translation process. As pointed out on comment #5 of Bug 9056 [1], present implementation needs many queries to database, and more important, it's very difficult to scale so that every language could properly name any other language. So, at the cost of loose some native descriptions, that can be added or replace english ones, I propose to use only the rfc4646 subtag (it's in the name of translation files or translated directories) to find the proper name for language/region/script using blocks of template files It's more work for translators 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 2) Go to Administration > System preferences > I18N/L10N Preety mess! 3) Enable some random languages, some in groups (fr|en) on staff/opac. Enable OPAC changelanguage 4) Reload page, look at the bottom for language changer Also open a OPAC view, look for language changer Do NOT change languages 5) Apply the patch 6) Reload STAFF page, some cosmetic changes on lang display and language changer 7) Reload OPAC page, similar view of language changer 8) Change OPAC theme (prog|ccsr) and check again On prog and ccsr the result is not preety, but works 9) Now to business: Translations. Update language files for one of the active languages, say de-DE (cd misc/translator; perl translate update de-DE; perl translate update de-DE; perl translate install de-DE) 10) Change language to German (DE), reload STAFF page, some of the strings are already translated!!! 11) Check that there are many references to 'language.inc' files on PO files egrep "language.inc" misc/translator/po/de-DE-*po 12) Sign! Note: I'm imposing a sort order on results, by subtag, that could slow things a little (almos nothing if there are few languages). Could be removed. Note2: I put every string between it's own <span></span> In that way each string is taken individually to translate instead of a solitary line filled with '%s' Note3: Of course if this pass it needs a lot of followups to eventually remove language tables, but that needs more analysis, there are more funcions on C4/Languages.pm that use the tables. But it's a first step. Also more followups are needed to update or complete languages/regions/scripts [1] http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9056#c5
Created attachment 26694 [details] [review] Bug 12017 - Followup - Sort and update lang/script/regions lists This followup sorts and updates language/regions/scripts lists As far as I know there all languages, scripts and regions, included some not yet present on master. To test with previous patch
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.
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.
(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 :)
Created attachment 26735 [details] [review] Bug 12017 - Move language description out of database This patch moves language descriptions from database into template files, in part to ease the translation of some strings, but mostly to have one place to define languages. All languages/scripts/regions are defined at languages.inc template file, with native versión and translatable version. As a bonus, language descriptions are present at webinstaller stage. 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 2) Go to Administration > System preferences > I18N/L10N There are many missing descriptions 3) Enable some random languages, some in groups (fr|en) on staff/opac. Enable OPAC changelanguage 4) Reload page, look at the bottom for language changer. Also open a OPAC view, look for language changer. Do NOT change languages 5) Apply the patch 6) Reload STAFF page, verify all descriptions in native language. 7) CHANGE in Language changer (staff/opac). Currently we show Lang+Code, and in lang groups Lang+Script+Region+Code I think it's too long, I propose to show only Lang, and in groups Region+Code, all native. Change OPAC theme (prog|ccsr) and check again. On prog and ccsr the result is not pretty, but works 8) Go to Administration > System preferences > Local use Add a new local syspref, any Explanation|Variable|Value, type Languages, Save. Check that all languages look good. Also Edit that syspref, on edition a list of languages must show in value box, check that they look good NOTE: There is a Bug in this kind of preference, selected languages are passed but ignored at save/load time. Only staff selected languages are shown. A problem for another report 9) NEW - Installer languages. This patch enable view of languages on Web installer. Edit your koha-conf.xml, change database name to a new name, create that database and grant access, reload staff page, log in, you will be redirected to step1 of installer, check names and codes for installed languages. (revert to your old database before proceed) 10) Advanced Search. On staff/opac{bootstrap/prog/ccsr}, go to advanced search, clic more options, go to limit by language, select one and press search, verify the search term "Search with limit(s): 'ln,rtrn:XXX'" with XXX the iso639-2 code of your selected lang NOTE: This is the ONLY place where translated language names are used!!! 11) Translations. Update language files for one of the active languages, say de-DE (cd misc/translator; perl translate update de-DE; perl translate update de-DE; perl translate install de-DE) 12) Change language to German (DE), go to advanced search 'Suche' (staff), clic 'mehr Optionen', look for 'Sprache' pulldown, verify some translations (ej. Greek -> Griechisch) [this translations are not present on opac] I think that all previous functionality is present. Lines starting
Sorry, resubmit to fix koha-qa errors
Created attachment 26736 [details] [review] Bug 12017 - Move language description out of database This patch moves language descriptions from database into template files, in part to ease the translation of some strings, but mostly to have one place to define languages. All languages/scripts/regions are defined at languages.inc template file, with native versión and translatable version. As a bonus, language descriptions are present at webinstaller stage. 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 2) Go to Administration > System preferences > I18N/L10N There are many missing descriptions 3) Enable some random languages, some in groups (fr|en) on staff/opac. Enable OPAC changelanguage 4) Reload page, look at the bottom for language changer. Also open a OPAC view, look for language changer. Do NOT change languages 5) Apply the patch 6) Reload STAFF page, verify all descriptions in native language. 7) CHANGE in Language changer (staff/opac). Currently we show Lang+Code, and in lang groups Lang+Script+Region+Code I think it's too long, I propose to show only Lang, and in groups Region+Code, all native. Change OPAC theme (prog|ccsr) and check again. On prog and ccsr the result is not pretty, but works 8) Go to Administration > System preferences > Local use Add a new local syspref, any Explanation|Variable|Value, type Languages, Save. Check that all languages look good. Also Edit that syspref, on edition a list of languages must show in value box, check that they look good NOTE: There is a Bug in this kind of preference, selected languages are passed but ignored at save/load time. Only staff selected languages are shown. A problem for another report 9) NEW - Installer languages. This patch enable view of languages on Web installer. Edit your koha-conf.xml, change database name to a new name, create that database and grant access, reload staff page, log in, you will be redirected to step1 of installer, check names and codes for installed languages. (revert to your old database before proceed) 10) Advanced Search. On staff/opac{bootstrap/prog/ccsr}, go to advanced search, clic more options, go to limit by language, select one and press search, verify the search term "Search with limit(s): 'ln,rtrn:XXX'" with XXX the iso639-2 code of your selected lang NOTE: This is the ONLY place where translated language names are used!!! 11) Translations. Update language files for one of the active languages, say de-DE (cd misc/translator; perl translate update de-DE; perl translate update de-DE; perl translate install de-DE) 12) Change language to German (DE), go to advanced search 'Suche' (staff), clic 'mehr Optionen', look for 'Sprache' pulldown, verify some translations (ej. Greek -> Griechisch) [this translations are not present on opac] I think that all previous functionality is present.
[%# "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.
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.
(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?
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?
(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.
(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.
Created attachment 26770 [details] [review] Bug 12017 - Followup to set one location for languages.inc This patch implements things that needs their own reports. Just consider it a proof of concept. Don't sign It: 1) Adds a new function to Koha.tt plugin to get any value of config variable (needs own report) 2) Create a include dir on opachtdocs to be used as a general include dir for all interefaces and themes I opted for opachtdocs in the thinking that it's has more public access than intrahtdocs (needs own report) 3) Adds "USE Koha" in doc-head-close.inc on every interface/theme to use Koha template plugin. It's used in almost all opac files, and many staff. So make it universal I suppose there is a better way (needs own report) 4) Copy languages.inc to new created general include dir and rewrite all relevant files to find and use this only file looking for it by PATH. Removed all other languages.inc files. Main idea is remove the need to n-plicate template files of general use. If you want to test: 1) Apply the patch 2) Check that all works as first patch test plan, EXCEPT for translations because strings to translate are looked only on theme dir. But if Bug 7939 pass, an arbitrary dir can be searched and its strings added to some OPAC po file to be translated. Another solution is to use as general include dir en/bootstrap's
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.
Bug 10968 added a good feature. Need to rethink this.
(In reply to Bernardo Gonzalez Kriegel from comment #17) > Bug 10968 added a good feature. Need to rethink this. Sorry, I mean 10986 :(
Created attachment 27687 [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
Created attachment 27688 [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.
Created attachment 27689 [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
Created attachment 27690 [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.
Created attachment 27691 [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
Created attachment 27692 [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
Created attachment 27693 [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
Created attachment 27694 [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.
Created attachment 27695 [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
Created attachment 27696 [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;'
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 :)
Hi Bernardo, I'd love to test this - could you rebase?
Created attachment 29898 [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
Created attachment 29899 [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.
Created attachment 29900 [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
Created attachment 29901 [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.
Created attachment 29902 [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
Created attachment 29903 [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
Created attachment 29904 [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
Created attachment 29905 [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.
Created attachment 29906 [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
Created attachment 29907 [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;'
Rebased on master :) To test I suggest to apply all patches and then follow each test plan.
Sorry, Needs Signof
Created attachment 33337 [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
Created attachment 33338 [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.
Created attachment 33339 [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
Created attachment 33340 [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.
Created attachment 33341 [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
Created attachment 33342 [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
Created attachment 33343 [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
Created attachment 33344 [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.
Created attachment 33345 [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
Created attachment 33346 [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;'
Rebased & updated
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.
(In reply to Bernardo Gonzalez Kriegel from comment #53) > Rebased & updated Could you rebase and update again?
Created attachment 39304 [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
Created attachment 39305 [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.
Created attachment 39306 [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
Created attachment 39307 [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.
Created attachment 39308 [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
Created attachment 39309 [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
Created attachment 39310 [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
Created attachment 39311 [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.
Created attachment 39312 [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
Created attachment 39313 [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;'
Rebased and updated
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
The bug mentioned at Comment #67 is happening when we create a new syspref with type = Language
*** Bug 14284 has been marked as a duplicate of this bug. ***
Created attachment 39644 [details] [review] 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.
(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.
(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?
Created attachment 39655 [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>
Created attachment 39656 [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>
Created attachment 39657 [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>
Created attachment 39658 [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>
Created attachment 39659 [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>
Created attachment 39660 [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>
Created attachment 39661 [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>
Created attachment 39662 [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>
Created attachment 39663 [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>
Created attachment 39664 [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>
Created attachment 39665 [details] [review] 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>
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?
(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.
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
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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
(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.
Hi Bernardo Patch doesn't apply anymore changing status.
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 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?
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.
(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?