From 7ed46aab06b8dd0e4c9c4a8373421a12ad43ced1 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 6 Aug 2013 09:27:26 +0300 Subject: [PATCH] i18n fixes for Closed Dates Editor and reporter Allow translating the rest of Closed Dates Editor, and make the "Logged in as" and "Welcome" -messages in Reports and Staff client properly translatable. Signed-off-by: Pasi Kallinen Signed-off-by: Remington Steed --- Open-ILS/web/opac/common/js/utils.js | 7 +++ Open-ILS/web/opac/locale/en-US/lang.dtd | 10 +++-- Open-ILS/web/opac/locale/en-US/reports.dtd | 2 +- Open-ILS/web/reports/oils_rpt.js | 3 +- Open-ILS/web/reports/oils_rpt.xhtml | 2 +- Open-ILS/web/reports/oils_rpt_builder.xhtml | 2 +- .../chrome/content/OpenILS/global_util.js | 7 +++ .../xul/staff_client/server/admin/closed_dates.js | 31 +++++++++++++- .../staff_client/server/admin/closed_dates.xhtml | 50 ++++++++++------------ Open-ILS/xul/staff_client/server/index.xhtml | 5 ++- 10 files changed, 82 insertions(+), 37 deletions(-) diff --git a/Open-ILS/web/opac/common/js/utils.js b/Open-ILS/web/opac/common/js/utils.js index dae8ef2a16..49d564bc62 100644 --- a/Open-ILS/web/opac/common/js/utils.js +++ b/Open-ILS/web/opac/common/js/utils.js @@ -3,6 +3,13 @@ function getId(id) { return document.getElementById(id); } +function format_string() { + var str = arguments[0]; + for (var i = 1; i < arguments.length; i++) + str = str.replace(new RegExp("\\[_"+i+"\\]", "g"), arguments[i].toString()); + return str; +} + function swapCSSClass(obj, old, newc ) { removeCSSClass(obj, old ); addCSSClass(obj, newc ); diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 6e9e3a5df4..7f4b4ba6a3 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2151,13 +2151,13 @@ - + - + YYYY-MM-DD. Times must have the form HH:MM"> @@ -2167,6 +2167,10 @@ + + + + @@ -3806,7 +3810,7 @@ - + diff --git a/Open-ILS/web/opac/locale/en-US/reports.dtd b/Open-ILS/web/opac/locale/en-US/reports.dtd index 09a721bcb6..8a7c5bab72 100644 --- a/Open-ILS/web/opac/locale/en-US/reports.dtd +++ b/Open-ILS/web/opac/locale/en-US/reports.dtd @@ -1,5 +1,5 @@ - + diff --git a/Open-ILS/web/reports/oils_rpt.js b/Open-ILS/web/reports/oils_rpt.js index 67d6654338..3c0793ee16 100644 --- a/Open-ILS/web/reports/oils_rpt.js +++ b/Open-ILS/web/reports/oils_rpt.js @@ -11,7 +11,8 @@ function oilsInitReports() { var cgi = new CGI(); fetchUser(cgi.param('ses')); - DOM.oils_rpt_user.appendChild(text(USER.usrname())); + var weu = document.getElementById('oils_rpt_user'); + weu.innerHTML = format_string(weu.textContent, '' + USER.usrname() + ''); if( cgi.param('dbg') ) oilsRptDebugEnabled = true; diff --git a/Open-ILS/web/reports/oils_rpt.xhtml b/Open-ILS/web/reports/oils_rpt.xhtml index 9aa70a554d..77e3e7e028 100644 --- a/Open-ILS/web/reports/oils_rpt.xhtml +++ b/Open-ILS/web/reports/oils_rpt.xhtml @@ -27,7 +27,7 @@
- &reports.common.logged_in_as; + &reports.common.logged_in_as;
diff --git a/Open-ILS/web/reports/oils_rpt_builder.xhtml b/Open-ILS/web/reports/oils_rpt_builder.xhtml index 3107750720..3f37f0e8cb 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.xhtml +++ b/Open-ILS/web/reports/oils_rpt_builder.xhtml @@ -24,7 +24,7 @@
- &reports.common.logged_in_as; + &reports.common.logged_in_as;
diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index d1be18631d..b58262ca07 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -4,6 +4,13 @@ function $(id) { return document.getElementById(id); } + function format_string() { + var str = arguments[0]; + for (var i = 1; i < arguments.length; i++) + str = str.replace(new RegExp("\\[_"+i+"\\]", "g"), arguments[i].toString()); + return str; + } + function oils_unsaved_data_V() { JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); data.stash_retrieve(); diff --git a/Open-ILS/xul/staff_client/server/admin/closed_dates.js b/Open-ILS/xul/staff_client/server/admin/closed_dates.js index d784ff6627..b8b1f49e82 100644 --- a/Open-ILS/xul/staff_client/server/admin/closed_dates.js +++ b/Open-ILS/xul/staff_client/server/admin/closed_dates.js @@ -23,6 +23,34 @@ var myPerms = [ function cdEditorInit() { + var re = $('staff.server.admin.closed_dates.allmultiday.label'); + var p1 = $('cd_allmultiday_param_1'); + var p2 = $('cd_allmultiday_param_2'); + re.innerHTML = format_string(re.textContent, + p1.parentNode.removeChild(p1).innerHTML, + p2.parentNode.removeChild(p2).innerHTML + ); + + + re = $('cd_row').firstElementChild; + re.innerHTML = format_string($('cd_row_data_text').textContent, + "", + "", + "", + "" + ); + + re = $('cd_allday_row').firstElementChild; + re.innerHTML = format_string($('cd_allday_row_data_text').textContent, + "" + ); + + re = $('cd_allmultiday_row').firstElementChild; + re.innerHTML = format_string($('cd_allmultiday_row_data_text').textContent, + "", + "" + ); + /* set the various template rows */ cdTbody = $('cd_tbody'); cdRowTemplate = cdTbody.removeChild($('cd_row')); @@ -32,7 +60,8 @@ function cdEditorInit() { cdInitCals(); fetchUser(); - $('cd_user').appendChild(text(USER.usrname())); + var we = $('cd_user'); + we.innerHTML = format_string(we.textContent, '' + USER.usrname() + ''); setTimeout( function() { diff --git a/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml b/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml index c831f7d999..cf81ad00cc 100644 --- a/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml @@ -42,7 +42,7 @@
- &staff.server.admin.closed_dates.welcome; + &staff.server.admin.closed_dates.welcome;
@@ -63,31 +63,22 @@ - - From - at - through - at - +
- + - - All Day - +
- + - - Every Day From through - +
- + @@ -184,17 +175,7 @@ - - All Day From - - - - Through - - - + &staff.server.admin.closed_dates.allmultiday.label; @@ -227,6 +208,21 @@ &staff.server.admin.closed_dates.success; &staff.server.admin.closed_dates.date_span.invalid; + &staff.server.admin.closed_dates.row.label; + &staff.server.admin.closed_dates.allday_row.label; + &staff.server.admin.closed_dates.allmultiday_row.label; + + + + + + + + + + + +
diff --git a/Open-ILS/xul/staff_client/server/index.xhtml b/Open-ILS/xul/staff_client/server/index.xhtml index 6421e392bb..a1ae357752 100644 --- a/Open-ILS/xul/staff_client/server/index.xhtml +++ b/Open-ILS/xul/staff_client/server/index.xhtml @@ -92,7 +92,8 @@ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); - document.getElementById('staffname').innerHTML = ", " + data.list.au[0].first_given_name(); + var we = $('staffname'); + we.innerHTML = format_string(we.textContent, data.list.au[0].first_given_name()); home_ou_id = data.list.au[0].ws_ou(); xulG.set_tab_name(get_i18n_str('staff.client.portal.tab_name')); } @@ -348,7 +349,7 @@
Evergreen logo
- &staff.client.portal.welcome;
+ &staff.client.portal.welcome;

-- 2.11.0