From 7ebb17568848920a0ad3b10cbab8cb30029c3d83 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Mon, 23 Jan 2023 21:18:24 -0500 Subject: [PATCH] LP1902120 the All/Any Part(s) label This feature creates a new table for localizable strings intended to be used in UI's. This is not a replacement for the existing I18N system for templates, but does allow developers to choose some strings to be more easily accessible to staff/admins for dynamic localization. The string we're focused on here is a replacement for the "All Parts" and "Any Part" label in various Place Hold interfaces when monographic parts are an option. There is a UI for managing such strings under Administration -> Server Administration -> I18N: Localized UI Strings. An admin could change the "string" field directly, or use the existing Apply Translation mechanism to customize the string for a specific locale. As a bonus feature, we also expose an alternate UI for handling entries for said Translation mechanism. This can be found under Administration -> Server Administration -> I18N: Localized Fieldmapper Strings. These customizations are global to the Evergreen installation. Signed-off-by: Jason Etheridge --- Open-ILS/examples/fm_IDL.xml | 15 +++++++++++++++ .../admin/server/admin-server-splash.component.html | 4 ++++ .../src/app/staff/catalog/hold/hold.component.html | 2 +- .../eg2/src/app/staff/catalog/hold/hold.component.ts | 6 ++++++ .../perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 3 +++ Open-ILS/src/sql/Pg/002.schema.config.sql | 7 +++++++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 2 ++ Open-ILS/src/sql/Pg/upgrade/YYYY.schema.eparts.sql | 19 +++++++++++++++++++ .../templates-bootstrap/opac/parts/place_hold.tt2 | 4 ++-- Open-ILS/src/templates/opac/parts/place_hold.tt2 | 4 ++-- docs/RELEASE_NOTES_NEXT/miscellaneous.adoc | 20 ++++++++++++++++++++ 11 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/YYYY.schema.eparts.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index a4fb45b078..8cc40aa19b 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -9100,6 +9100,21 @@ SELECT usr, + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html index c6a4108031..9e61873c05 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html @@ -53,6 +53,10 @@ routerLink="/staff/admin/server/config/hold_matrix_weights"> + + diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index fc4c83690f..e7ddb7f725 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -71,6 +71,7 @@ export class HoldComponent implements OnInit { activeDateYmd: string; activeDate: Date; activeDateInvalid = false; + anyPartLabel: string; holdContexts: HoldContext[]; recordSummaries: BibRecordSummary[]; @@ -169,6 +170,11 @@ export class HoldComponent implements OnInit { } }); + this.pcrud.retrieve('i18ns', 1) // Any Part + .subscribe(i18n_string => { + this.anyPartLabel = i18n_string.string(); + }); + if (!Array.isArray(this.holdTargets)) { this.holdTargets = [this.holdTargets]; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 3ee345afc8..1ba9a04ecc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1503,6 +1503,9 @@ sub load_place_hold { $logger->info("Looking at hold_type: " . $ctx->{hold_type} . " and targets: @targets"); + my $any_part_label = $self->editor->retrieve_config_i18n_string([1, {}]); + $any_part_label = $any_part_label->string if $any_part_label; + $ctx->{any_part_label} = $any_part_label; $ctx->{staff_recipient} = $self->editor->retrieve_actor_user([ $e->requestor->id, { diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 0643d46203..bc2a370937 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -623,6 +623,13 @@ BEGIN END; $_$ LANGUAGE PLPGSQL; +-- this may grow to support full GNU gettext functionality +CREATE TABLE config.i18n_string ( + id SERIAL PRIMARY KEY, + context TEXT NOT NULL, -- hint for translators to disambiguate + string TEXT NOT NULL +); + CREATE TABLE config.billing_type ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, 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 9ece90f327..fbef0aca05 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -18879,6 +18879,8 @@ INSERT INTO config.i18n_core (fq_field, identity_value, translation, string ) AND t.xlate IS NOT NULL AND t.name <> (xlate->value); +INSERT INTO config.i18n_string (id, context, string) VALUES (1, 'In the Place Hold interfaces for staff and patrons, when monographic parts are available, this would be the option for indicating that no specific part is being requested.', 'Any Part'); + INSERT INTO authority.heading_field(heading_type, heading_purpose, label, heading_xpath, component_xpath, type_xpath, thesaurus_xpath, thesaurus_override_xpath) VALUES ( 'topical_term', 'main', 'Main Topical Term', '/mads21:mads/mads21:authority', '//mads21:topic', NULL, '/mads21:mads/mads21:authority/mads21:topic[1]/@authority', NULL ) ,( 'topical_term', 'variant', 'Variant Topical Term', '/mads21:mads/mads21:variant', '//mads21:topic', '/mads21:variant/@type', '/mads21:mads/mads21:authority/mads21:topic[1]/@authority', '//mads21:topic[1]/@authority') diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.eparts.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.eparts.sql new file mode 100644 index 0000000000..4c3fa76aa8 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.eparts.sql @@ -0,0 +1,19 @@ +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('YYYY', :eg_version); + +-- 002.schema.config.sql + +-- this may grow to support full GNU gettext functionality +CREATE TABLE config.i18n_string ( + id SERIAL PRIMARY KEY, + context TEXT NOT NULL, -- hint for translators to disambiguate + string TEXT NOT NULL +); + +-- 950.data.seed-values.sql + +INSERT INTO config.i18n_string (id, context, string) VALUES (1, 'In the Place Hold interfaces for staff and patrons, when monographic parts are available, this would be the option for indicating that no specific part is being requested.', 'Any Part'); + +COMMIT; diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2 index 7af5d42848..2cb9f5870f 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2 @@ -179,7 +179,7 @@ function maybeToggleNumCopies(obj) {
[% IF !hdata.part_required %] - [% l('All Parts') %] + [% ctx.any_part_label %] [% END %] [% FOR part IN hdata.parts %] @@ -192,7 +192,7 @@ function maybeToggleNumCopies(obj) { %] [% l('All Parts') %] + [% ctx.any_part_label %] [% END %] [% FOR part IN hdata.parts %] @@ -193,7 +193,7 @@ function maybeToggleNumCopies(obj) { %]