From bd24a1c7db576a6f361266e26313a526da12aa41 Mon Sep 17 00:00:00 2001 From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Sat, 23 Apr 2011 05:22:05 +0000 Subject: [PATCH] Add i18n support to the User Editor / registration interface Per LP # 754898, the Register Patron interface currently contains many hardcoded strings. Given that the previous patron registration interface supported translation, this is a regression in 2.0. Accordingly, we extend the use of Dojo i18n support to provide the strings for buttons and a number of labels on the Register Patron interface. The bulk of the remaining text is provided by the fieldmapper definitions, which should in theory be translated automatically for us. git-svn-id: svn://svn.open-ils.org/ILS/trunk@20298 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/actor/nls/register.js | 18 ++++- Open-ILS/web/js/ui/default/actor/user/register.js | 21 ++++- .../default/actor/user/register_table.tt2 | 30 ++++--- build/i18n/po/register.js/register.js.pot | 94 ++++++++++++++++++---- 4 files changed, 130 insertions(+), 33 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/actor/nls/register.js b/Open-ILS/web/js/dojo/openils/actor/nls/register.js index ab1150a96f..9a35b6c962 100644 --- a/Open-ILS/web/js/dojo/openils/actor/nls/register.js +++ b/Open-ILS/web/js/dojo/openils/actor/nls/register.js @@ -9,5 +9,21 @@ "DUPE_PATRON_ADDR" : "Found ${0} patron(s) with the same address", "REPLACED_ADDRESS" : "<div>Replaces address <b>${0}</b><br/> ${1} ${2}<br/> ${3}, ${4} ${5}</div>", "INVALID_FORM" : "Form is invalid. Please edit and try again.", - "EXAMPLE" : "Example: " + "EXAMPLE" : "Example: ", + "REPLACE_BARCODE" : "Replace Barcode", + "BARCODE_IN_USE" : "Barcode is already in use", + "SEE_ALL" : "See All", + "DUPE_USERNAME" : "Username is already in use", + "RESET_PASSWORD" : "Reset Password", + "VERIFY_PASSWORD" : "Verify Password", + "PARENT_OR_GUARDIAN" : "Parent/Guardian", + "USER_SETTINGS" : "User Settings", + "ADDRESS_HEADER" : "Address", + "ADDRESS_MAILING" : "Mailing", + "ADDRESS_BILLING" : "Billing", + "ADDRESS_PENDING" : "This is a pending address: ", + "ADDRESS_APPROVE" : "Approve Address", + "ADDRESS_OWNED" : "This address is owned by another user: ", + "ADDRESS_NEW" : "New Address", + "STAT_CATS" : "Statistical Categories" } diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 71545939c2..658a6dd78b 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -61,6 +61,14 @@ function load() { var userId = cgi.param('usr'); var stageUname = cgi.param('stage'); + dojo.query("td[name='addressHeader']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_HEADER; }); + dojo.query("span[name='mailingAddress']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_MAILING; }); + dojo.query("span[name='billingAddress']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_BILLING; }); + dojo.query("span[name='addressPending']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_PENDING; }); + dojo.query("button[name='approve-button']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_APPROVE; }); + dojo.query("span[name='address-already-owned']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_OWNED; }); + dojo.query("button[name='addressNew']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_NEW; }); + if(xulG) { if(xulG.ses) openils.User.authtoken = xulG.ses; if(typeof xulG.clone != 'undefined') cloneUser = xulG.clone; @@ -187,6 +195,17 @@ function load() { checkGrpAppPerm(); // to do the initial load loadStaticFields(); + + replaceBarcode.attr("label", localeStrings.REPLACE_BARCODE); + dojo.byId('uedit-dupe-barcode-warning').innerHTML = localeStrings.BARCODE_IN_USE; + allCards.attr("label", localeStrings.SEE_ALL); + dojo.byId('uedit-dupe-username-warning').innerHTML = localeStrings.DUPE_USERNAME; + generatePassword.attr("label", localeStrings.RESET_PASSWORD); + dojo.byId('verifyPassword').innerHTML = localeStrings.VERIFY_PASSWORD; + dojo.byId('parentGuardian').innerHTML = localeStrings.PARENT_OR_GUARDIAN; + dojo.byId('userSettings').innerHTML = localeStrings.USER_SETTINGS; + dojo.byId('statCats').innerHTML = localeStrings.STAT_CATS; + if(patron.isnew() && patron.addresses().length == 0) uEditNewAddr(null, uEditAddrVirtId, true); else loadAllAddrs(); @@ -1515,7 +1534,7 @@ function uEditNewAddr(evt, id, mkLinks) { } } else if(row.getAttribute('name') == 'uedit-addr-divider') { - // link up the billing/mailing address and give the inputs IDs so we can acces the later + // link up the billing/mailing address and give the inputs IDs so we can access the later // billing address var ba = getByName(row, 'billing_address'); diff --git a/Open-ILS/web/templates/default/actor/user/register_table.tt2 b/Open-ILS/web/templates/default/actor/user/register_table.tt2 index 711e56f72e..552825234c 100644 --- a/Open-ILS/web/templates/default/actor/user/register_table.tt2 +++ b/Open-ILS/web/templates/default/actor/user/register_table.tt2 @@ -2,30 +2,28 @@ <tr fmclass='ac' fmfield='barcode' required='required'> <td/><td/><td/> <td> - <button dojoType='dijit.form.Button' jsId='replaceBarcode' scrollOnFocus='false'>Replace Barcode</button> + <button dojoType='dijit.form.Button' jsId='replaceBarcode' scrollOnFocus='false'></button> <span id='uedit-dupe-barcode-warning' style='color:red; font-weight:bold' class='hidden'> - Barcode is already in use </span> </td> <td id='uedit-all-barcodes' class='hidden'> - <button dojoType='dijit.form.Button' jsId='allCards' scrollOnFocus='false'>See All</button> + <button dojoType='dijit.form.Button' jsId='allCards' scrollOnFocus='false'></button> </td> </tr> <tr fmclass='au' fmfield='usrname' required='required'> <td/><td/><td/> <td> <span id='uedit-dupe-username-warning' style='color:red; font-weight:bold' class='hidden'> - Username is already in use </span> </td> </tr> <tr fmclass='au' fmfield='passwd' required='required'> <td/><td/><td/> <td> - <button dojoType='dijit.form.Button' jsId='generatePassword' scrollOnFocus='false' tabIndex='-1'>Reset Password</button> + <button dojoType='dijit.form.Button' jsId='generatePassword' scrollOnFocus='false' tabIndex='-1'></button> </td> </tr> - <tr fmclass='au' fmfield='passwd2' required='required'><td/><td>Verify Password</td><td/></tr> + <tr fmclass='au' fmfield='passwd2' required='required'><td/><td id='verifyPassword'></td><td/></tr> <tr fmclass='au' fmfield='first_given_name' required='required'/> <tr fmclass='au' fmfield='second_given_name'/> <tr fmclass='au' fmfield='family_name' required='required'/> @@ -35,7 +33,7 @@ <tr fmclass='au' fmfield='juvenile'/> <tr fmclass='au' fmfield='ident_type' required='required'/> <tr fmclass='au' fmfield='ident_value'/> - <tr fmclass='au' fmfield='ident_value2'><td/><td>Parent/Guardian</td></tr> + <tr fmclass='au' fmfield='ident_value2'><td/><td id='parentGuardian'></td></tr> <tr fmclass='au' fmfield='email'/> <tr fmclass='au' fmfield='day_phone'/> <tr fmclass='au' fmfield='evening_phone'/> @@ -51,7 +49,7 @@ <tr fmclass='au' fmfield='claims_never_checked_out_count' wclass='dijit.form.NumberSpinner' wconstraints="{min:0,places:0}" wvalue='0'/> <tr fmclass='au' fmfield='alert_message' wclass='dijit.form.Textarea' wstyle='height:5em'/> - <tr class='divider hidden' id='uedit-settings-divider'><td colspan='0'>User Settings</td></tr> + <tr class='divider hidden' id='uedit-settings-divider'><td colspan='0' id='userSettings'></td></tr> <tr class='hidden' id='uedit-user-setting-template'> <td/> <td><span name='label'></span></td> @@ -60,18 +58,18 @@ <!-- Address --> <tr name='uedit-addr-divider' class='divider' type='addr-template' required='show'> - <td colspan='2'>Address</td> + <td colspan='2' name='addressHeader'></td> <td> - <span>Mailing</span><input type='radio' name='mailing_address'> - <span>Billing</span><input type='radio' name='billing_address'> + <span name='mailingAddress'></span><input type='radio' name='mailing_address'> + <span name='billingAddress'></span><input type='radio' name='billing_address'> <button dojoType='dijit.form.Button' scrollOnFocus='false' name='delete-button' class='uedit-addr-del-button'>X</button> </td> </tr> <tr name='uedit-addr-pending-row' type='addr-template' class='pending-addr-row hidden'> <td colspan='3'> - <span style='padding-right:10px;'>This is a pending address: </span> - <button dojoType='dijit.form.Button' scrollOnFocus='false' name='approve-button'>Approve Address</button> + <span style='padding-right:10px;' name='addressPending'></span> + <button dojoType='dijit.form.Button' scrollOnFocus='false' name='approve-button'></button> <div name='replaced-addr-div'> <div name='replaced-addr'></div> </div> @@ -80,7 +78,7 @@ <tr name='uedit-addr-owner-row' type='addr-template' class='pending-addr-row hidden'> <td colspan='3'> - <span style='padding-right:10px;'>This address is owned by another user: </span> + <span style='padding-right:10px;' name='address-already-owned'></span> <a href='javascript:void(0);' name='addr-owner'></a> </td> </tr> @@ -99,12 +97,12 @@ <tr id='new-addr-row' class='newaddr-row' required='show'> <td colspan='0' style='text-align:center;'> - <button dojoType='dijit.form.Button' onClick='uEditNewAddr' scrollOnFocus='false'>New Address</button> + <button dojoType='dijit.form.Button' onClick='uEditNewAddr' scrollOnFocus='false' name='addressNew'></button> </td> </tr> <!-- stat cats --> - <tr class='divider' id='stat-cat-divider' required='suggested'><td colspan='0'>Statistical Categories</td></tr> + <tr class='divider' id='stat-cat-divider' required='suggested'><td colspan='0' id='statCats'></td></tr> <tr id='stat-cat-row-template' required='suggested'><td class='uedit-help'/><td name='name'/><td name='widget'/></tr> <!-- surveys --> diff --git a/build/i18n/po/register.js/register.js.pot b/build/i18n/po/register.js/register.js.pot index f2fc92d083..21f4cab94b 100644 --- a/build/i18n/po/register.js/register.js.pot +++ b/build/i18n/po/register.js/register.js.pot @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Evergreen 1.4\n" "Report-Msgid-Bugs-To: open-ils-dev@list.georgialibraries.org\n" -"POT-Creation-Date: 2011-04-18 21:45:31-0400\n" +"POT-Creation-Date: 2011-04-23 01:19:52-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -11,28 +11,44 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8-bit\n" -#: register.js:DUPE_PATRON_ADDR -msgid "Found ${0} patron(s) with the same address" +#: register.js:USER_SETTINGS +msgid "User Settings" msgstr "" -#: register.js:INVALID_FORM -msgid "Form is invalid. Please edit and try again." +#: register.js:DUPE_PATRON_EMAIL +msgid "Found ${0} patron(s) with the same email address" msgstr "" -#: register.js:DUPE_PATRON_IDENT -msgid "Found ${0} patron(s) with the same identification" +#: register.js:ADDRESS_BILLING +msgid "Billing" msgstr "" -#: register.js:DELETE_ADDRESS -msgid "Delete address ${0}?" +#: register.js:SEE_ALL +msgid "See All" msgstr "" -#: register.js:DUPE_PATRON_EMAIL -msgid "Found ${0} patron(s) with the same email address" +#: register.js:BARCODE_IN_USE +msgid "Barcode is already in use" msgstr "" -#: register.js:DUPE_PATRON_NAME -msgid "Found ${0} patron(s) with the same name" +#: register.js:REPLACED_ADDRESS +msgid "<div>Replaces address <b>${0}</b><br/> ${1} ${2}<br/> ${3}, ${4} ${5}</div>" +msgstr "" + +#: register.js:DUPE_PATRON_ADDR +msgid "Found ${0} patron(s) with the same address" +msgstr "" + +#: register.js:DUPE_PATRON_IDENT +msgid "Found ${0} patron(s) with the same identification" +msgstr "" + +#: register.js:ADDRESS_MAILING +msgid "Mailing" +msgstr "" + +#: register.js:REPLACE_BARCODE +msgid "Replace Barcode" msgstr "" #: register.js:NEED_ADDRESS @@ -43,14 +59,62 @@ msgstr "" msgid "Example: " msgstr "" +#: register.js:ADDRESS_HEADER +msgid "Address" +msgstr "" + #: register.js:DUPE_PATRON_PHONE msgid "Found ${0} patron(s) with the same phone number" msgstr "" -#: register.js:REPLACED_ADDRESS -msgid "<div>Replaces address <b>${0}</b><br/> ${1} ${2}<br/> ${3}, ${4} ${5}</div>" +#: register.js:INVALID_FORM +msgid "Form is invalid. Please edit and try again." +msgstr "" + +#: register.js:PARENT_OR_GUARDIAN +msgid "Parent/Guardian" +msgstr "" + +#: register.js:DUPE_PATRON_NAME +msgid "Found ${0} patron(s) with the same name" +msgstr "" + +#: register.js:ADDRESS_PENDING +msgid "This is a pending address: " +msgstr "" + +#: register.js:DUPE_USERNAME +msgid "Username is already in use" msgstr "" #: register.js:DEFAULT_ADDRESS_TYPE msgid "MAILING" msgstr "" + +#: register.js:ADDRESS_APPROVE +msgid "Approve Address" +msgstr "" + +#: register.js:VERIFY_PASSWORD +msgid "Verify Password" +msgstr "" + +#: register.js:STAT_CATS +msgid "Statistical Categories" +msgstr "" + +#: register.js:ADDRESS_NEW +msgid "New Address" +msgstr "" + +#: register.js:RESET_PASSWORD +msgid "Reset Password" +msgstr "" + +#: register.js:ADDRESS_OWNED +msgid "This address is owned by another user: " +msgstr "" + +#: register.js:DELETE_ADDRESS +msgid "Delete address ${0}?" +msgstr "" -- 2.11.0