[open-ils-commits] r9448 - in trunk/Open-ILS/web: conify/global
js/dojo/openils/widget js/dojo/openils/widget/nls
js/dojo/openils/widget/nls/es-us
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Apr 24 16:50:19 EDT 2008
Author: miker
Date: 2008-04-24 16:10:54 -0400 (Thu, 24 Apr 2008)
New Revision: 9448
Added:
trunk/Open-ILS/web/js/dojo/openils/widget/nls/
trunk/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js
trunk/Open-ILS/web/js/dojo/openils/widget/nls/es-us/
trunk/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js
Modified:
trunk/Open-ILS/web/conify/global/admin.js
trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js
Log:
add translation support to the, um, translation widget; add example es-us translation
Modified: trunk/Open-ILS/web/conify/global/admin.js
===================================================================
--- trunk/Open-ILS/web/conify/global/admin.js 2008-04-24 16:50:56 UTC (rev 9447)
+++ trunk/Open-ILS/web/conify/global/admin.js 2008-04-24 20:10:54 UTC (rev 9448)
@@ -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 = '<!--#echo var="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 = '<!--#echo var="locale"-->';
+ if (_url_locale != '(none)') djConfig.locale = _url_locale;
+}
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js 2008-04-24 16:50:56 UTC (rev 9447)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js 2008-04-24 20:10:54 UTC (rev 9448)
@@ -30,6 +30,7 @@
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 @@
[dijit._Widget, dijit._Templated],
{
- templateString : "<span dojoAttachPoint='node'><div dojoType='dijit.form.DropDownButton'><span>Translate</span><div id='${field}_translation_${unique}' dojoType='dijit.TooltipDialog' onOpen='openils.widget.TranslatorPopup.renderTranslationPopup(${targetObject}, \"${field}\", \"${unique}\")' ><div dojoType='dijit.layout.ContentPane'><table><tbody class='translation_tbody_template' style='display:none; visiblity:hidden;'><tr><th>Locale</th><td class='locale'><div class='locale_combobox'></div></td><th>Translation</th><td class='translation'><div class='translation_textbox'></div></td><td><button class='create_button' style='display:none; visiblity:hidden;'>Create</button><button class='update_button' style='display:none; visiblity:hidden;'>Update</button><button class='delete_button' style='display:none; visiblity:hidden;'>Remove</button></td></tr></tbody><tbody class='translation_tbody'></tbody></table></div></div></div></span>",
+ templateString : "<span dojoAttachPoint='node'><div dojoAttachPoint='translateLabelNode' dojoType='dijit.form.DropDownButton'><span>Translate</span><div id='${field}_translation_${unique}' dojoType='dijit.TooltipDialog' onOpen='openils.widget.TranslatorPopup.renderTranslatorPopup(${targetObject}, \"${field}\", \"${unique}\")' ><div dojoType='dijit.layout.ContentPane'><table><tbody class='translation_tbody_template' style='display:none; visiblity:hidden;'><tr><th dojoAttachPoint='localeLabelNode'/><td class='locale'><div class='locale_combobox'></div></td><th dojoAttachPoint='translationLabelNode'/><td class='translation'><div class='translation_textbox'></div></td><td><button class='create_button' style='display:none; visiblity:hidden;'><span dojoAttachPoint='createButtonNode'/></button><button class='update_button' style='display:none; visiblity:hidden;'><span dojoAttachPoint='updateButtonNode'/></button><button class='delete_button' style='display:none; visiblity:hidden
;'><span dojoAttachPoint='removeButtonNode'/></button></td></tr></tbody><tbody class='translation_tbody'></tbody></table></div></div></div></span>",
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 @@
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 {
Added: trunk/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js (rev 0)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js 2008-04-24 20:10:54 UTC (rev 9448)
@@ -0,0 +1,8 @@
+({
+ locale : 'Locale',
+ translation : 'Translation',
+ translate : 'Translate',
+ create : 'Create',
+ update : 'Update',
+ remove : 'Remove'
+})
Added: trunk/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js (rev 0)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/nls/es-us/TranslatorPopup.js 2008-04-24 20:10:54 UTC (rev 9448)
@@ -0,0 +1,8 @@
+({
+ locale : 'Escena',
+ translation : 'Traduccion',
+ translation : 'Traducir',
+ create : 'Crear',
+ update : 'Actualizacion',
+ remove : 'Quitar'
+})
More information about the open-ils-commits
mailing list