[Koha-bugs] [Bug 10509] Using i18n function for translation in webinstaller mysql files

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Aug 2 19:56:55 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10509

Kyle M Hall <kyle at bywatersolutions.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #19310|0                           |1
        is obsolete|                            |

--- Comment #16 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 20076
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20076&action=edit
Bug 10509: Using i18n function for translation of MySQL web installer files

This patch makes the changes needed to progressively use a i18n function to
translate strings in the web installer's MySQL files. The English scripts may
contain fields like i18n(columnvalue); for English i18n(a) is a, but for the
other languages i18n(a) is the translation of a.
The corresponding script in the language folder contains the i18n definition.
The work is done in such a way that current installations are not affected.

Subsequent patches will make the changes in the .sql files themselves. This can
be done per folder, per language. Using the extension .i18n in the last
subfolder name triggers the new translation mechanism. (See also test plan.)

In Installer.pm the all_languages parameter is removed from load_sql_in_order.
This code was not used. This change also affects the call in install.pl.
The most important change is the use of a new subroutine _run_mysql_file in
load_sql. This new routine contains the above logic.
Although I also tested changing marc_framework_sql_list and
sample_data_sql_list, it proved imo to be easier (and more maintainable) to do
this via load_sql.

Test plan:
Since no .sql files are changed in this patch, please test if you can install
English and e.g. German (or another one) in the web installer without any
changes.

Bonus points for the following additional tests :)
They serve to illustrate the i18n concept more clearly.
1) Place in en/mandatory/userflags.sql around a few strings i18n('...').
Run English install again and check the userflags table. No changes expected.
2) Place in de-DE/mandatory/userflags.sql i18n around a few strings too. Also
precede the insert statements with this definition:
DROP FUNCTION IF EXISTS i18n;
CREATE FUNCTION i18n (d text) RETURNS text DETERMINISTIC RETURN concat(d,'xx');
Now run German install again; some of the userflag strings (with i18n) should
now end with xx.
3) Before retesting German install, make some changes:
Edit en/optional/sample_holidays.sql. Add i18n calls around strings.
Create an additional folder optional.i18n in de-DE.
Copy sample_holidays.sql and sample_holidays.txt from de-DE/optional.
Edit de-DE/optional.i18n/sample_holidays.sql. Remove all text! Add:
DROP FUNCTION IF EXISTS i18n;
CREATE FUNCTION i18n (d text) RETURNS text DETERMINISTIC
RETURN CASE d
WHEN 'Sundays' THEN 'Sonntag'
ELSE d END;
Now run German install again; in the optional part of the install mark
sample holidays (in the last section standing separately; do not confuse with
 the other one). Check the repeatable_holidays table afterwards. The string
above should have been translated only, the others are still English.
Undo the changes in .sql files; remove optional.i18n folder.

Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list