From 4c5fac34b7058f413973488cccbd13d18f7834f6 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 24 Apr 2008 20:10:54 +0000 Subject: [PATCH] add translation support to the, um, translation widget; add example es-us translation git-svn-id: svn://svn.open-ils.org/ILS/trunk@9448 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/conify/global/admin.js | 11 ++++++++--- .../js/dojo/openils/widget/TranslatorPopup.js | 19 +++++++++++++++---- .../openils/widget/nls/TranslatorPopup.js | 8 ++++++++ .../widget/nls/es-us/TranslatorPopup.js | 8 ++++++++ 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js create mode 100644 Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js diff --git a/Open-ILS/web/conify/global/admin.js b/Open-ILS/web/conify/global/admin.js index e3b4ae2be9..a8e7e02864 100644 --- a/Open-ILS/web/conify/global/admin.js +++ b/Open-ILS/web/conify/global/admin.js @@ -1,6 +1,11 @@ var djConfig = { parseOnLoad : true }; -var _url_locale = location.href.replace(/^.*conify\/(.+)\/global.*$/, "$1").toLowerCase().replace(/-/,'_'); -if (_url_locale) djConfig.locale = _url_locale; -else djConfig.locale = ''; +if (location.href.match(/^.*conify\/(.+)\/global.*$/, "$1")) { + var _url_locale = location.href.replace(/^.*conify\/(.+)\/global.*$/, "$1").toLowerCase().replace(/_/,'-','g'); + if (_url_locale) djConfig.locale = _url_locale; + +} else { + var _url_locale = ''; + if (_url_locale != '(none)') djConfig.locale = _url_locale; +} diff --git a/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js b/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js index 4a5f04488b..935ae67ce8 100644 --- a/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js +++ b/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js @@ -30,6 +30,7 @@ if(!dojo._hasResource["openils.widget.TranslatorPopup"]) { dojo.require("dijit.form.Button"); dojo.require("dijit.form.TextBox"); dojo.require("dijit.form.ComboBox"); + dojo.requireLocalization("openils.widget", "TranslatorPopup"); dojo.declare( @@ -37,16 +38,26 @@ if(!dojo._hasResource["openils.widget.TranslatorPopup"]) { [dijit._Widget, dijit._Templated], { - templateString : "
Translate
", + templateString : "
Translate
", widgetsInTemplate: true, field : "", targetObject : "", - unique : "" + unique : "", + + postCreate : function () { + var nls = dojo.i18n.getLocalization("openils.widget", "TranslatorPopup"); + this.localeLabelNode.textContent = nls.locale; + this.translationLabelNode.textContent = nls.translation; + this.translateLabelNode.setLabel(nls.translation); + this.createButtonNode.textContent = nls.create; + this.updateButtonNode.textContent = nls.update; + this.removeButtonNode.textContent = nls.remove; + } } ); - openils.widget.TranslatorPopup.renderTranslationPopup = function (obj, field, num) { + openils.widget.TranslatorPopup.renderTranslatorPopup = function (obj, field, num) { var node = dojo.byId(field + '_translation_' + num); var trans_list = openils.I18N.getTranslations( obj, field ); @@ -208,7 +219,7 @@ if(!dojo._hasResource["openils.widget.TranslatorPopup"]) { var node = dojo.byId(field + '_translation_' + num); dijit.byId('i18n_new_locale_' + obj.classname + '.' + field + num).setValue(null); dijit.byId('i18n_new_translation_' + obj.classname + '.' + field + num).setValue(null); - openils.widget.TranslatorPopup.renderTranslationPopup(obj, field, num); + openils.widget.TranslatorPopup.renderTranslatorPopup(obj, field, num); } } else { diff --git a/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js b/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js new file mode 100644 index 0000000000..7fc07a47bd --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js @@ -0,0 +1,8 @@ +({ + locale : 'Locale', + translation : 'Translation', + translate : 'Translate', + create : 'Create', + update : 'Update', + remove : 'Remove' +}) diff --git a/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js b/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js new file mode 100644 index 0000000000..b6a446f4ea --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js @@ -0,0 +1,8 @@ +({ + locale : 'Escena', + translation : 'Traduccion', + translation : 'Traducir', + create : 'Crear', + update : 'Actualizacion', + remove : 'Quitar' +}) -- 2.43.2