From: Pasi Kallinen Date: Tue, 9 Jul 2013 06:52:22 +0000 (+0300) Subject: Fix untranslatable strings in several dijits: X-Git-Tag: sprint4-merge-nov22~2504 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ac56aa414592f870d061156676f98a4303ea421d;p=working%2FEvergreen.git Fix untranslatable strings in several dijits: AutoGrid, EditPane, FlattenerGrid, GridColumnPicker and HoldingCode. [LFW: One string amended in conflict resolution; commit message edited to wrap; one line of code moved (this.nls assignment in GridColumnPicker.js).] Signed-off-by: Pasi Kallinen Signed-off-by: Lebbeous Fogle-Weekley --- 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..9c20c26125 100644 --- a/Open-ILS/web/js/dojo/openils/serial/nls/serial.js +++ b/Open-ILS/web/js/dojo/openils/serial/nls/serial.js @@ -1,4 +1,13 @@ { + "SEASON_SPRING": "Spring", + "SEASON_SUMMER": "Summer", + "SEASON_FALL": "Fall", + "SEASON_WINTER": "Winter", + "SELECT_VALID_CAP": "Have you selected a valid caption and pattern?", + "NO_CAP_SUBFIELDS": "No caption subfields in selected caption and pattern", + "COMPILE": "Create Holding Code", + "ERROR_BLANK_FIELDS": "A valid holding code cannot be produced with any blank fields.", + "WIZARD": "Wizard", "CREATE_ISSUANCE": "Create Issuance", "MODIFY_ISSUANCE": "Modify Issuance", "SAVE_SUCCESSFUL": "Save Successful", diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 73f3509c67..9114aa2302 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -9,6 +9,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { dojo.require('openils.widget.GridColumnPicker'); dojo.require('openils.widget._GridHelperColumns'); dojo.require('openils.Util'); + dojo.requireLocalization('openils.widget', 'AutoFieldWidget'); dojo.declare( 'openils.widget.AutoGrid', @@ -58,6 +59,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { this.overrideEditWidgetClass = {}; this.overrideWidgetArgs = {}; + this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget'); + if(this.editOnEnter) this._applyEditOnEnter(); else if(this.singleEditStyle) @@ -69,7 +72,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { var back = dojo.create('a', { - innerHTML : 'Back', // TODO i18n + innerHTML : self.nls.BACK, style : 'padding-right:6px;', href : 'javascript:void(0);', onclick : function() { @@ -81,7 +84,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { }); var forw = dojo.create('a', { - innerHTML : 'Next', // TODO i18n + innerHTML : self.nls.NEXT, style : 'padding-right:6px;', href : 'javascript:void(0);', onclick : function() { @@ -98,7 +101,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { dojo.require('openils.widget.PCrudFilterDialog'); dojo.place( dojo.create('a', { - innerHTML : 'Filter', // TODO i18n + innerHTML : self.nls.FILTER, style : 'padding-right:6px;', href : 'javascript:void(0);', onclick : function() { diff --git a/Open-ILS/web/js/dojo/openils/widget/EditPane.js b/Open-ILS/web/js/dojo/openils/widget/EditPane.js index 5bde239237..a3d36c0df2 100644 --- a/Open-ILS/web/js/dojo/openils/widget/EditPane.js +++ b/Open-ILS/web/js/dojo/openils/widget/EditPane.js @@ -7,6 +7,7 @@ if(!dojo._hasResource['openils.widget.EditPane']) { dojo.require('openils.Util'); dojo.require('openils.PermaCrud'); dojo.require('dijit.form.Button'); + dojo.requireLocalization('openils.widget', 'AutoFieldWidget'); dojo.declare( 'openils.widget.EditPane', @@ -44,6 +45,8 @@ if(!dojo._hasResource['openils.widget.EditPane']) { this.fieldDocs = pcrud.search('fdoc', {fm_class:this.fmClass}); */ + this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget'); + var table = this.existingTable; if(!table) { var table = this.table = document.createElement('table'); @@ -190,14 +193,14 @@ if(!dojo._hasResource['openils.widget.EditPane']) { var self = this; new dijit.form.Button({ - label:'Cancel', // XXX + label: this.nls.CANCEL, onClick : this.onCancel }, cancelSpan); if(this.hideSaveButton) return; new dijit.form.Button({ - label:'Save', // XXX + label:this.nls.SAVE, onClick: function() {self.performAutoEditAction();} }, applySpan); }, @@ -210,15 +213,14 @@ if(!dojo._hasResource['openils.widget.EditPane']) { // in this edit pane. If any required value is null, then return // an error object. mapValues: function (fn) { - var e = 0, msg = this.fmIDL.label + ' '; + var e = 0, msg = '', lbl = this.fmIDL.label; dojo.forEach(this.fieldList, function (f) { var v, w = f.widget; if ((v = w.getFormattedValue()) === null && w.isRequired()) { e++; } fn(f.name, v); }); if (e > 0) { - msg += 'edit pane has ' + e + ' required field(s) that contain no value(s)'; - return new Error(msg); + return new Error(dojo.string.substitute(this.nls.REQ_FIELDS_EMPTY, [lbl, e])); } }, diff --git a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js index 4583a97375..7548266b08 100644 --- a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js @@ -530,6 +530,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { "_setupLinks": function() { this.linkHolder = new dijit.layout.ContentPane(); + var localeStrings = this.localeStrings; dojo.place(this.linkHolder.domNode, this.domNode, "before"); if (this.showLoadFilter) { @@ -566,7 +567,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { if (!this.filterAlwaysInDiv) { new dijit.form.Button( { - "label": "Filter", /* XXX i18n */ + "label": localeStrings.FILTER, "onClick": dojo.hitch( this, function() { this.filterUi.show(); } ) diff --git a/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js b/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js index 1d32bbe7d5..4fce0b7a7f 100644 --- a/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js +++ b/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js @@ -25,7 +25,7 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { dojo.require('openils.Event'); dojo.require('openils.Util'); dojo.require('fieldmapper.Fieldmapper'); - + dojo.requireLocalization('openils.widget', 'AutoFieldWidget'); dojo.declare('openils.widget.GridColumnPicker', null, { @@ -33,6 +33,7 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { constructor : function (authtoken, persistKey, grid, structure) { var _this = this; + this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget'); this.grid = grid; this.persistKey = this.USER_PERSIST_SETTING+'.'+persistKey; this.authtoken = authtoken || openils.User.authtoken; @@ -42,6 +43,7 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { this.dialog = this.buildDialog(); this.dialogTable = this.dialog.containerNode.getElementsByTagName('tbody')[0]; + // replace: called after any sort changes this.onSortChange = function(list) {console.log('onSortChange()')} // replace: called after user settings are first retrieved @@ -118,13 +120,13 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { buildDialog : function() { var self = this; - - // TODO i18n - var dialog = new dijit.Dialog({title : 'Column Picker'}); + var dialog = new dijit.Dialog({title : this.nls.COLUMN_PICKER}); var table = dojo.create('table', {'class':'oils-generic-table', innerHTML : - "" + - "" + + "
ColumnDisplayAuto WidthSort Priority
" + + "" + + "" + + "" + ""}); var tDiv = dojo.create('div'); @@ -135,8 +137,8 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { var textDiv = dojo.create('div', {style : 'padding:5px; margin-top:5px; border-top:1px solid #333', innerHTML : - "A Sort Priority of '0' means no sorting is applied.
" + - "Apply a negative Sort Priority for descending sort."}); + "" + this.nls.SORT_PRIORITY_ZERO + "
" + + "" + this.nls.SORT_PRIORITY_MINUS}); var wrapper = dojo.create('div'); wrapper.appendChild(tDiv); @@ -144,11 +146,11 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { wrapper.appendChild(bDiv); dialog.containerNode.appendChild(wrapper); - var button = new dijit.form.Button({label:'Save'}, + var button = new dijit.form.Button({label: this.nls.SAVE }, dojo.query('[name=save_button]', bDiv)[0]); button.onClick = function() { dialog.hide(); self.update(true); }; - button = new dijit.form.Button({label:'Cancel'}, + button = new dijit.form.Button({label: this.nls.CANCEL }, dojo.query('[name=cancel_button]', bDiv)[0]); button.onClick = function() { dialog.hide(); }; diff --git a/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js b/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js index 0ee6892d16..aada2bdfc1 100644 --- a/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js +++ b/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js @@ -3,6 +3,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.form.DropDownButton"); dojo.require("dijit.form.TextBox"); + dojo.requireLocalization('openils.serial', 'serial'); /* XXX These variables and functions preceding the call to dojo.declar() * all pollute the window namespace. They're not written as methods for @@ -10,16 +11,18 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { * into there anyway. */ + var _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.SEASON_SPRING}, + {"code": 22, "label": _localeStrings.SEASON_SUMMER}, + {"code": 23, "label": _localeStrings.SEASON_FALL}, + {"code": 24, "label": _localeStrings.SEASON_WINTER} ] } }); /* XXX i18n the above seasons. Also maybe don't @@ -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 = _localeStrings.SELECT_VALID_CAP; 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 = _localeStrings.NO_CAP_SUBFIELDS; return; } @@ -119,15 +120,13 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { new dijit.form.Button( { - "label": "Create Holding Code", + "label": _localeStrings.COMPILE, "onClick": function() { 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."); + alert(_localeStrings.ERROR_BLANK_FIELDS); } holding_code.push(input.subfield); holding_code.push(value); @@ -192,7 +191,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { this.wizard_button = new dijit.form.Button( { - "label": "Wizard" /* XXX i18n */, + "label": _localeStrings.WIZARD, "onClick": function() { _prepare_ttip_dialog(target_div, self); } diff --git a/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js index bc77c0689c..1abeb38303 100644 --- a/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js @@ -1,4 +1,17 @@ { + "NEXT" : "Next", + "BACK" : "Back", + "FILTER" : "Filter", + "CANCEL" : "Cancel", + "SAVE" : "Save", + "REQ_FIELDS_EMPTY" : "${0} edit pane has ${1} required field(s) that contain no value(s)", + "COLUMN_PICKER" : "Column Picker", + "COLUMN" : "Column", + "DISPLAY" : "Display", + "AUTO_WIDTH" : "Auto Width", + "SORT_PRIORITY" : "Sort Priority", + "SORT_PRIORITY_ZERO" : "A Sort Priority of '0' means no sorting is applied.", + "SORT_PRIORITY_MINUS" : "Apply a negative Sort Priority for descending sort.", "TRUE" : "True", "FALSE" : "False", "UNSET" : "Unset",
" + this.nls.COLUMN + "" + this.nls.DISPLAY + "" + this.nls.AUTO_WIDTH + "" + this.nls.SORT_PRIORITY + "