From 7d983f59166f815a06a09148e290eb8d983ea838 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 4 Feb 2008 05:43:50 +0000 Subject: [PATCH] Bring i18n to the main login window git-svn-id: svn://svn.open-ils.org/ILS/trunk@8590 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/auth/controller.js | 37 ++++++++++++---------- .../staff_client/chrome/content/auth/session.js | 7 ++-- .../xul/staff_client/chrome/content/main/main.xul | 2 ++ .../chrome/locale/en-US/auth.properties | 14 ++++++++ 4 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js index 482c98ec54..f49f3c1e53 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js @@ -1,4 +1,5 @@ dump('entering auth/controller.js\n'); +// vim:sw=4:ts=4:noet: if (typeof auth == 'undefined') auth = {}; auth.controller = function (params) { @@ -130,7 +131,7 @@ auth.controller.prototype = { } else { x.appendChild( document.createTextNode( - 'Not yet configured for the specified server.' + document.getElementById('authStrings').getString('staff.auth.controller.not_configured') ) ); } @@ -211,11 +212,11 @@ auth.controller.prototype = { obj.controller.view.submit_button.disabled = true; obj.controller.view.server_prompt.disabled = true; var s = document.getElementById('status'); - s.setAttribute('value','Testing hostname...'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_hostname')); s.setAttribute('style','color: orange;'); document.getElementById('version').value = ''; if (!url) { - s.setAttribute('value','Please enter a server hostname.'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.prompt_hostname')); s.setAttribute('style','color: red;'); obj.controller.view.server_prompt.disabled = false; obj.controller.view.server_prompt.focus(); @@ -229,7 +230,7 @@ auth.controller.prototype = { x.onreadystatechange = function() { try { if (x.readyState != 4) return; - s.setAttribute('value',x.status + ' : ' + x.statusText); + s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText])); if (x.status == 200) { s.setAttribute('style','color: green;'); } else { @@ -239,14 +240,14 @@ auth.controller.prototype = { } catch(E) { obj.controller.view.server_prompt.disabled = false; obj.controller.view.server_prompt.focus(); - s.setAttribute('value','There was an error testing this hostname.'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname')); s.setAttribute('style','color: red;'); obj.error.sdump('D_ERROR',E); } } x.send(null); } catch(E) { - s.setAttribute('value','There was an error testing this hostname.'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname')); s.setAttribute('style','color: brown;'); obj.error.sdump('D_ERROR',E); obj.controller.view.server_prompt.disabled = false; @@ -257,7 +258,7 @@ auth.controller.prototype = { 'test_version' : function(url) { var obj = this; var s = document.getElementById('version'); - s.setAttribute('value','Testing version...'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_version')); s.setAttribute('style','color: orange;'); try { var x = new XMLHttpRequest(); @@ -267,7 +268,7 @@ auth.controller.prototype = { x.onreadystatechange = function() { try { if (x.readyState != 4) return; - s.setAttribute('value',x.status + ' : ' + x.statusText); + s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText])); if (x.status == 200) { s.setAttribute('style','color: green;'); obj.controller.view.submit_button.disabled = false; @@ -277,7 +278,7 @@ auth.controller.prototype = { } obj.controller.view.server_prompt.disabled = false; } catch(E) { - s.setAttribute('value','There was an error checking version support.'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version')); s.setAttribute('style','color: red;'); obj.error.sdump('D_ERROR',E); obj.controller.view.server_prompt.disabled = false; @@ -285,7 +286,7 @@ auth.controller.prototype = { } x.send(null); } catch(E) { - s.setAttribute('value','There was an error checking version support.'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version')); s.setAttribute('style','color: brown;'); obj.error.sdump('D_ERROR',E); obj.controller.view.server_prompt.disabled = false; @@ -305,7 +306,7 @@ auth.controller.prototype = { if (x.status == 200) { window.open('data:text/html,'+window.escape(x.responseText),'upgrade','chrome,resizable,modal,centered'); } else { - alert('This server does not support your version of the staff client. Please check with your system administrator.'); + alert(document.getElementById('authStrings').getString('staff.auth.controller.version_mismatch')); } obj.controller.view.server_prompt.disabled = false; } catch(E) { @@ -324,10 +325,14 @@ auth.controller.prototype = { var obj = this; - this.error.sdump('D_AUTH','login with ' - + this.controller.view.name_prompt.value + ' and ' - + this.controller.view.password_prompt.value + ' at ' - + this.controller.view.server_prompt.value + '\n' + this.error.sdump('D_AUTH', + document.getElementById('authStrings').getFormattedString( + 'staff.auth.controller.error_login', [ + this.controller.view.name_prompt.value, + this.controller.view.password_prompt.value, + this.controller.view.server_prompt.value + ] + ) ); this.controller.view.server_prompt.disabled = true; this.controller.view.name_prompt.disabled = true; @@ -455,7 +460,7 @@ auth.controller.prototype = { this.error.sdump('D_AUTH','close' + this.w + '\n'); - if (window.confirm('Are you sure you would like to exit the program completely?')) { + if (window.confirm(document.getElementById('authStrings').getString('staff.auth.controller.confirm_close'))) { this.logoff(); this.w.close(); /* Probably won't go any further */ diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/session.js b/Open-ILS/xul/staff_client/chrome/content/auth/session.js index 80baa7b13e..4b68d25c8e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/session.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/session.js @@ -1,4 +1,5 @@ dump('entering auth/session.js\n'); +// vim:sw=4:ts=4:noet: if (typeof auth == 'undefined') auth = {}; auth.session = function (view,login_type) { @@ -52,7 +53,7 @@ auth.session.prototype = { this.authtime = robj.payload.authtime; break; case 1520 /* WORKSTATION_NOT_FOUND */: - alert(params.workstation + ' is not registered with this server.'); + alert(document.getElementById('authStrings').getFormattedString('staff.auth.session.unregistered', [params.workstation])); delete(params.workstation); delete(data.ws_info[ this.view.server_prompt.value ]); data.stash('ws_info'); @@ -82,13 +83,13 @@ auth.session.prototype = { } else { - var error = 'open-ils.auth.authenticate.init returned false\n'; + var error = document.getElementById('authStrings').getStrint('staff.auth.session.init_false') + '\n'; this.error.sdump('D_ERROR',error); throw(error); } } catch(E) { - alert('Login failed. Please check your Server Hostname, Username, Password, and your CAPS LOCK key.'); + alert(document.getElementById('authStrings').getString('staff.auth.session.login_failed')); //obj.error.standard_unexpected_error_alert('Error on auth.session.init()',E); if (typeof this.on_init_error == 'function') { diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.xul b/Open-ILS/xul/staff_client/chrome/content/main/main.xul index 8854a53ecf..b09dfee06e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/main.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/main.xul @@ -55,6 +55,8 @@ dump("lang.version = " + &lang.version; + '\n'); + + diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties new file mode 100644 index 0000000000..e3e88d2041 --- /dev/null +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties @@ -0,0 +1,14 @@ +staff.auth.controller.not_configured=Not yet configured for the specified server. +staff.auth.controller.testing_hostname=Testing hostname... +staff.auth.controller.prompt_hostname=Please enter a server hostname. +staff.auth.controller.error_hostname=There was an error testing this hostname. +staff.auth.controller.status=%1$s : %2$s +staff.auth.controller.testing_version=Testing version... +staff.auth.controller.error_version=There was an error checking version support. +staff.auth.controller.version_mismatch=This server does not support your version of the staff client. Please check with your system administrator. +# login with and at +staff.auth.controller.error_login=login with %1$s and %2$s at %3$s +staff.auth.controller.confirm_close=Are you sure you would like to exit the program completely? +staff.auth.session.unregistered=%1$s is not registered with this server. +staff.auth.session.login_failed=Login failed. Please check your Server Hostname, Username, Password, and your CAPS LOCK key. +staff.auth.session.init_false=open-ils.auth.authenticate.init returned false -- 2.11.0