From e81ba586c5961dd617d7bf18a61e6980806fb638 Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 9 Apr 2008 01:29:35 +0000 Subject: [PATCH 1/1] Finish i18n for the easy part of copy_editor.js git-svn-id: svn://svn.open-ils.org/ILS/trunk@9276 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/server/cat/copy_editor.js | 43 +++++++++++-------- .../server/locale/en-US/cat.properties | 20 +++++++++ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index 316f281cad..a2d4db67bf 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -337,8 +337,12 @@ g.import_templates = function() { } var r = g.error.yns_alert( - 'Save all of these imported templates permanently to this account?', - 'Final Warning', 'Yes', 'No', null, 'Click here' + $('catStrings').getString('staff.cat.copy_editor.import_templates.save.prompt'), + $('catStrings').getFormattedString('staff.cat.copy_editor.import_templates.save.title'), + $('catStrings').getString('staff.cat.copy_editor.import_templates.save.yes'), + $('catStrings').getString('staff.cat.copy_editor.import_templates.save.no'), + null, + $('catStrings').getString('staff.cat.copy_editor.import_templates.save.click_here') ); if (r == 0 /* Yes */) { @@ -348,13 +352,13 @@ g.import_templates = function() { if (typeof robj.ilsevent != 'undefined') { throw(robj); } else { - alert('All templates saved.'); + alert($('catStrings').getString('staff.cat.copy_editor.import_templates.save.success')); setTimeout( function() { try { g.retrieve_templates(); } catch(E) { - g.error.standard_unexpected_error_alert('Error saving templates',E); + g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.import_templates.save.error'), E); } },0 ); @@ -364,12 +368,12 @@ g.import_templates = function() { var list = util.functional.map_object_to_list( g.templates, function(obj,i) { return [i, i]; } ); g.template_menu = util.widgets.make_menulist( list ); $('template_placeholder').appendChild(g.template_menu); - alert("Note: These imported templates will get saved along with any new template you try to create, but if that doesn't happen, then these templates will disappear with the next invocation of the item attribute editor."); + alert($('catStrings').getString('staff.cat.copy_editor.import_templates.note')); } } } catch(E) { - g.error.standard_unexpected_error_alert('Error importing templates',E); + g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.import_templates.error'), E); } } @@ -446,7 +450,7 @@ g.apply_owning_lib = function(ou_id) { if (!g.map_acn[copy.call_number()]) { var volume = g.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ copy.call_number() ]); if (typeof volume.ilsevent != 'undefined') { - g.error.standard_unexpected_error_alert('Error retrieving Volume information for copy ' + copy.barcode() + ". The owning library for this copy won't be changed.",volume); + g.error.standard_unexpected_error_alert($('catStrings').getFormattedString('staff.cat.copy_editor.apply_owning_lib.undefined_volume.error', [copy.barcode()]), volume); continue; } g.map_acn[copy.call_number()] = volume; @@ -457,7 +461,7 @@ g.apply_owning_lib = function(ou_id) { [ses(),old_volume.label(),old_volume.record(),ou_id] ); if (typeof acn_id.ilsevent != 'undefined') { - g.error.standard_unexpected_error_alert('Error changing owning lib for copy ' + copy.barcode() + ". The owning library for this copy won't be changed.",acn_id); + g.error.standard_unexpected_error_alert($('catStrings').getFormattedString('staff.cat.copy_editor.apply_owning_lib.call_number.error', [copy.barcode()], acn_id); continue; } copy.call_number(acn_id); @@ -1061,8 +1065,13 @@ g.render = function() { label1.appendChild( document.createTextNode(value) ); } var label2 = document.createElement('description'); row.appendChild(label2); - var unit = count == 1 ? 'copy' : 'copies'; - label2.appendChild( document.createTextNode(count + ' ' + unit) ); + var copy_count; + if (count == 1) { + copy_count = $('catStrings').getString('staff.cat.copy_editor.copy_count'); + } else { + copy_count = $('catStrings').getFormattedString('staff.cat.copy_editor.copy_count.plural', [count]); + } + label2.appendChild( document.createTextNode(copy_count) ); } var hbox = document.createElement('hbox'); hbox.setAttribute('id',fn); @@ -1173,12 +1182,12 @@ g.render_input = function(node,blob) { util.widgets.remove_children(hbox2); hbox.appendChild(x); var apply = document.createElement('button'); - apply.setAttribute('label','Apply'); - apply.setAttribute('accesskey','A'); + apply.setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.apply.label')); + apply.setAttribute('accesskey', $('catStrings').getString('staff.cat.copy_editor.apply.accesskey')); hbox2.appendChild(apply); apply.addEventListener('command',function() { c(x.value); },false); var cancel = document.createElement('button'); - cancel.setAttribute('label','Cancel'); + cancel.setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.cancel.label')); cancel.addEventListener('command',function() { setTimeout( function() { g.summarize( g.copies ); g.render(); document.getElementById(caption.id).focus(); }, 0); }, false); hbox2.appendChild(cancel); setTimeout( function() { x.focus(); }, 0 ); @@ -1217,11 +1226,11 @@ g.stash_and_close = function() { if (typeof r.ilsevent != 'undefined') { g.error.standard_unexpected_error_alert('copy update',r); } else { - alert('Items added/modified.'); + alert($('catStrings').getString('staff.cat.copy_editor.handle_update.success')); } /* FIXME -- revisit the return value here */ } catch(E) { - alert('copy update error: ' + js2JSON(E)); + alert($('catStrings').getString('staff.cat.copy_editor.handle_update.error') + ' ' + js2JSON(E)); } } //g.data.temp_copies = js2JSON( g.copies ); @@ -1322,7 +1331,7 @@ g.add_stat_cat = function(sc) { g.panes_and_field_names.right_pane4.push( temp_array ); } catch(E) { - g.error.standard_unexpected_error_alert('Error adding stat cat to display definition',E); + g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.add_stat_cat.error'), E); } } @@ -1422,7 +1431,7 @@ g.populate_stat_cats = function() { g.panes_and_field_names.right_pane4.sort(); } catch(E) { - g.error.standard_unexpected_error_alert('Error populating stat cats for display',E); + g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.populate_stat_cat.error'),E); } } diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties index 2e1fba73c0..3b612a64db 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties @@ -120,3 +120,23 @@ staff.cat.copy_editor.import_templates.replace.title=Template %1$s already exist staff.cat.copy_editor.import_templates.replace.yes=Yes staff.cat.copy_editor.import_templates.replace.no=No staff.cat.copy_editor.import_templates.replace.click_here=Click here +staff.cat.copy_editor.import_templates.save.prompt=Save all of these imported templates permanently to this account? +staff.cat.copy_editor.import_templates.save.title=Final warning +staff.cat.copy_editor.import_templates.save.yes=Yes +staff.cat.copy_editor.import_templates.save.no=No +staff.cat.copy_editor.import_templates.save.click_here=Click here +staff.cat.copy_editor.import_templates.save.success=All templates saved. +staff.cat.copy_editor.import_templates.save.error=Error saving templates +staff.cat.copy_editor.import_templates.note=Note: These imported templates will get saved along with any new template you try to create, but if that does not happen, then these templates will disappear with the next invocation of the item attribute editor. +staff.cat.copy_editor.import_templates.error=Error importing templates +staff.cat.copy_editor.apply_owning_lib.undefined_volume.error=Error retrieving Volume information for copy %1$s. The owning library for this copy will not be changed. +staff.cat.copy_editor.apply_owning_lib.call_number.error=Error changing owning library for copy %1$s. The owning library for this copy will not be changed. +staff.cat.copy_editor.copy_count=1 copy +staff.cat.copy_editor.copy_count.plural=%1$s copies +staff.cat.copy_editor.apply.label=Apply +staff.cat.copy_editor.apply.accesskey=A +staff.cat.copy_editor.cancel.label=Cancel +staff.cat.copy_editor.handle_update.success=Items were added or modified. +staff.cat.copy_editor.handle_update.error=copy update error: +staff.cat.copy_editor.add_stat_cat.error=Error adding statistical category to display definition +staff.cat.copy_editor.populate_stat_cat.error=Error populating statistical categories for display -- 2.43.2