From 0eb771e594cf65a0fa0f71d246d100d6a07dfda7 Mon Sep 17 00:00:00 2001 From: Ben Shum Date: Wed, 15 Feb 2017 14:22:27 -0500 Subject: [PATCH] LP#1661661: Use new rtl field in config.i18n_locale Add a new column for "rtl" in config.i18n_locale and then use that to check which direction to assign for the CSS files. Two upgrade scripts, one to change the schema for new column and a second one to enable Arabic (Jordan) as an option. Signed-off-by: Ben Shum Signed-off-by: Kathy Lussier --- Open-ILS/examples/fm_IDL.xml | 1 + Open-ILS/src/sql/Pg/002.schema.config.sql | 3 ++- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 3 +++ .../Pg/upgrade/XXXX.schema.add-rtl-field-to-i18n_locale.sql | 8 ++++++++ .../sql/Pg/upgrade/YYYY.data.add-arabic-to-i18n_locale.sql | 11 +++++++++++ Open-ILS/src/templates/opac/parts/base.tt2 | 2 +- 6 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.schema.add-rtl-field-to-i18n_locale.sql create mode 100644 Open-ILS/src/sql/Pg/upgrade/YYYY.data.add-arabic-to-i18n_locale.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 367b5b3c52..6f722e00c6 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -7503,6 +7503,7 @@ SELECT usr, + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index f9c5ccc06a..3e2758ee9b 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -547,7 +547,8 @@ CREATE TABLE config.i18n_locale ( code TEXT PRIMARY KEY, marc_code TEXT NOT NULL, -- should exist in config.coded_value_map WHERE ctype = 'item_lang' name TEXT UNIQUE NOT NULL, - description TEXT + description TEXT, + rtl BOOL NOT NULL DEFAULT FALSE ); CREATE TABLE config.i18n_core ( diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 6b49c3cc65..f831fc9f63 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -372,6 +372,9 @@ INSERT INTO config.i18n_locale (code,marc_code,name,description) INSERT INTO config.i18n_locale (code,marc_code,name,description) VALUES ('ru-RU', 'rus', oils_i18n_gettext('ru-RU', 'Russian', 'i18n_l', 'name'), oils_i18n_gettext('ru-RU', 'Russian', 'i18n_l', 'description')); +INSERT INTO config.i18n_locale (code,marc_code,name,description,rtl) + VALUES ('ar-JO', 'ara', oils_i18n_gettext('ar-JO', 'Arabic (Jordan)', 'i18n_l', 'name'), + oils_i18n_gettext('ar-JO', 'Arabic (Jordan)', 'i18n_l', 'description'), 'true'); -- Z39.50 server attributes diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.add-rtl-field-to-i18n_locale.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.add-rtl-field-to-i18n_locale.sql new file mode 100644 index 0000000000..a94a564a59 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.add-rtl-field-to-i18n_locale.sql @@ -0,0 +1,8 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +-- Add new column "rtl" with default of false +ALTER TABLE config.i18n_locale ADD COLUMN rtl BOOL NOT NULL DEFAULT FALSE; + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.data.add-arabic-to-i18n_locale.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.add-arabic-to-i18n_locale.sql new file mode 100644 index 0000000000..a6f61bcf62 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.add-arabic-to-i18n_locale.sql @@ -0,0 +1,11 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('YYYY', :eg_version); + +-- Add Arabic (Jordan) to i18n_locale table as a stock language option +INSERT INTO config.i18n_locale (code,marc_code,name,description,rtl) + VALUES ('ar-JO', 'ara', oils_i18n_gettext('ar-JO', 'Arabic (Jordan)', 'i18n_l', 'name'), + oils_i18n_gettext('ar-JO', 'Arabic (Jordan)', 'i18n_l', 'description'), 'true'); + +COMMIT; + diff --git a/Open-ILS/src/templates/opac/parts/base.tt2 b/Open-ILS/src/templates/opac/parts/base.tt2 index fa44abaae2..2b0cb2c460 100644 --- a/Open-ILS/src/templates/opac/parts/base.tt2 +++ b/Open-ILS/src/templates/opac/parts/base.tt2 @@ -11,7 +11,7 @@ - [% IF ctx.locale == "ar_ar" %] + [% IF ctx.get_i18n_l(ctx.eg_locale).rtl == 't' %] [% END %] -- 2.11.0