From 7550285514ce3f7e14d96af7a1e6373fd8d1eecc Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 7 Aug 2007 15:36:56 +0000 Subject: [PATCH] Patch from Dan Scott which starts the process of proper staff client internationalization: As documented at http://developer.mozilla.org/en/docs/XUL_Tutorial:Property_Files , string bundles are the normal method for holding translatable text from Javascript files in XULRunner applications. The staff client currently does not use string bundles; it currently uses a mix of hardcoded strings, with reliance on some of the strings that are converted from lang.dtd into the massive hash that is lang.js. This patch hopes to start changing that, by introducing string bundles for a few small parts of the staff client -- hopefully paving the way for conversion of more of the client to stringbundles and i18n glory. 1) We create one .properties file per chrome/content/ subdirectory that we're converting to string bundles, plus a common.properties file for common strings like error messages. In this patch, I address the chrome/content/admin/ and chrome/content/cat/ directories; therefore, I add: * Open-ILS/xul/staff_client/chrome/locale/en-US/admin.properties * Open-ILS/xul/staff_client/chrome/locale/en-US/cat.properties * Open-ILS/xul/staff_client/chrome/locale/en-US/common.properties 2) Note that the files are being added to a directory that does not currently exist in the Subversion repository. It doesn't make sense to serve the properties files remotely from the web/locale/en-US/ directory, as their real home is the chrome. So that's where I've stuck them. Accordingly, the xul/staff_client/Makefile has been modified to no longer make this directory. 3) chrome/content/cat/opac.xul has been converted to a fully i18n-ized file, by adding XML entities to web/opac/locale/en-US/lang.dtd and converting hardcoded strings in the Javascript to stringbundle calls that pull in the properties defined in cat.properties and common.properties. 4) chrome/content/admin/survey* have also been given the entity & stringbundle treatment. I have tested the opac and survey screens in the client and nothing seems to be going wrong, so I'm taking that as a good sign :) git-svn-id: svn://svn.open-ils.org/ILS/trunk@7629 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/locale/en-US/lang.dtd | 39 +++++++++++++++ Open-ILS/xul/staff_client/Makefile | 4 -- .../staff_client/chrome/content/admin/survey.js | 5 +- .../chrome/content/admin/survey_overlay.xul | 20 ++++---- .../chrome/content/admin/survey_wizard.xul | 10 ++-- .../xul/staff_client/chrome/content/cat/opac.xul | 55 ++++++++++++---------- 6 files changed, 89 insertions(+), 44 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 530286cb97..6d88a61f88 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -123,6 +123,17 @@ + + + + + + + + + + + @@ -185,6 +196,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/xul/staff_client/Makefile b/Open-ILS/xul/staff_client/Makefile index 2d7cf9a9b5..ebfcaba6ba 100644 --- a/Open-ILS/xul/staff_client/Makefile +++ b/Open-ILS/xul/staff_client/Makefile @@ -35,10 +35,6 @@ add_symlinks: build_dir: @echo - @echo '********************************************************* Kludge, make sure these directories exists ' - mkdir -p chrome/locale/en-US/ - #mkdir -p chrome/content/OpenSRF/ - @echo @echo '********************************************************* Creating and populating build/ ' mkdir -p build/ cp -R chrome build/ diff --git a/Open-ILS/xul/staff_client/chrome/content/admin/survey.js b/Open-ILS/xul/staff_client/chrome/content/admin/survey.js index 3787aa4b99..9dccae731c 100644 --- a/Open-ILS/xul/staff_client/chrome/content/admin/survey.js +++ b/Open-ILS/xul/staff_client/chrome/content/admin/survey.js @@ -247,8 +247,9 @@ function add_question_row(my_asvq) { g_row_2.appendChild(g_tb); if (last_button) last_button.setAttribute('accesskey',''); var g_b = document.createElement('button'); - g_b.setAttribute('label','Save this Response'); - g_b.setAttribute('accesskey','R'); + var strbundle = document.getElementById("adminStrings"); + g_b.setAttribute('label', strbundle.getString('staff.admin.survey.save_response.label')); + g_b.setAttribute('accesskey', strbundle.getString('staff.admin.survey.save_response.label')); g_b.setAttribute('oncommand','add_answer(event,' + my_asvq.id() + ');'); g_row_2.appendChild(g_b); diff --git a/Open-ILS/xul/staff_client/chrome/content/admin/survey_overlay.xul b/Open-ILS/xul/staff_client/chrome/content/admin/survey_overlay.xul index a36f74692d..2f4d6d1465 100644 --- a/Open-ILS/xul/staff_client/chrome/content/admin/survey_overlay.xul +++ b/Open-ILS/xul/staff_client/chrome/content/admin/survey_overlay.xul @@ -20,48 +20,48 @@ - - - - - - - - - @@ -89,7 +89,7 @@