From c7c2f26f9bd3a38b316ab7c13506ad04cda204f3 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Tue, 17 Sep 2013 15:37:41 -0400 Subject: [PATCH] Internationalize the Holding Code wizard in serials Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/web/js/dojo/openils/serial/nls/serial.js | 10 ++++++- Open-ILS/web/js/dojo/openils/widget/HoldingCode.js | 31 +++++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/serial/nls/serial.js b/Open-ILS/web/js/dojo/openils/serial/nls/serial.js index c9a5653bbe..4c3d020ccb 100644 --- a/Open-ILS/web/js/dojo/openils/serial/nls/serial.js +++ b/Open-ILS/web/js/dojo/openils/serial/nls/serial.js @@ -4,5 +4,13 @@ "SAVE_SUCCESSFUL": "Save Successful", "NOTES_SSUB": "Subscription Notes (ID: ${0})", "NOTES_SDIST": "Distribution Notes (ID: ${0})", - "REQUIRE_ONE_ROW": "Use the checkboxes to select exactly one row for this operation." + "REQUIRE_ONE_ROW": "Use the checkboxes to select exactly one row for this operation.", + "SPRING": "Spring", + "SUMMER": "Summer", + "FALL": "Fall", + "WINTER": "Winter", + "SELECTED_SCAP": "Have you selected a valid caption and pattern?", + "NO_CAPTIONS_IN_SELECTED_SCAP": "No caption subfields in selected caption and pattern", + "NO_BLANKS_BOSS": "A valid holding code cannot be produced with any blank fields.", + "WIZARD": "Wizard" } diff --git a/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js b/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js index 0ee6892d16..5d5865f9f7 100644 --- a/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js +++ b/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js @@ -10,20 +10,23 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { * into there anyway. */ + dojo.requireLocalization("openils.serial", "serial"); + var localeStrings = + localeStrings || dojo.i18n.getLocalization("openils.serial", "serial"); + var _needed_fields = "abcdefghijklm"; var _season_store = new dojo.data.ItemFileReadStore({ "data": { "identifier": "code", "label": "label", "items": [ - {"code": 21, "label": "Spring"}, - {"code": 22, "label": "Summer"}, - {"code": 23, "label": "Fall"}, - {"code": 24, "label": "Winter"} + {"code": 21, "label": localeStrings.SPRING}, + {"code": 22, "label": localeStrings.SUMMER}, + {"code": 23, "label": localeStrings.FALL}, + {"code": 24, "label": localeStrings.WINTER} ] } - }); /* XXX i18n the above seasons. Also maybe don't - hardcode MFHD seasons here? */ + }); /* XXX maybe don't hardcode MFHD seasons here? */ function _prepare_ttip_dialog(div, wizard) { @@ -44,8 +47,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { } if (!dojo.isArray(pattern_code)) { - div.innerHTML = - "Have you selected a valid caption and pattern?";/* XXX i18n */ + div.innerHTML = openils.widget.HoldingCode.localeStrings.SELECTED_SCAP; return; } @@ -59,8 +61,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { } if (!fields.length) { - div.innerHTML = /* XXX i18n (below) */ - "No caption subfields in seleted caption and pattern"; + div.innerHTML = openils.widget.HoldingCode.localeStrings.NO_CAPTIONS_IN_SELECTED_SCAP; return; } @@ -124,11 +125,8 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { inputs.forEach( function(input) { var value = input.input.attr("value"); - if (value === null || value === "") { - /* XXX i18n */ - alert("A valid holding code cannot be " + - "produced with any blank fields."); - } + if (value === null || value === "") + alert(openils.widget.HoldingCode.localeStrings.NO_BLANKS_BOSS); holding_code.push(input.subfield); holding_code.push(value); } @@ -192,7 +190,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { this.wizard_button = new dijit.form.Button( { - "label": "Wizard" /* XXX i18n */, + "label": openils.widget.HoldingCode.localeStrings.WIZARD, "onClick": function() { _prepare_ttip_dialog(target_div, self); } @@ -261,4 +259,5 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { "date_widget": null } ); + openils.widget.HoldingCode.localeStrings = localeStrings; } -- 2.11.0