From 469be06b8c75808d0fd1195ac2c87f80857f3f69 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 2 Oct 2006 13:13:52 +0000
Subject: [PATCH] Translate dialog buttons text. Cache selected language
 (calculate once per page). Use cached selected language to render translator
 mode links.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10483 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_xhtml_style/developper_shortcut_render.xml   |  2 +-
 .../portal_skins/erp5_xhtml_style/dialog_main.xml     | 11 ++++++++---
 .../erp5_xhtml_style/global_definitions.xml           |  1 +
 product/ERP5/bootstrap/erp5_xhtml_style/bt/revision   |  2 +-
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
index 978266122e..cd4d7af6cf 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
@@ -85,7 +85,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
 <tal:block metal:define-macro="translate_link">\n
   <tal:block tal:condition="preferred_html_style_translator_mode">\n
     <a tal:define="image image | python: \'translate.png\'"\n
-       tal:attributes="href python: \'%s/manage_messages?regex=^%s%%24&amp;lang=%s\' % (\'/\'.join(here.Localizer.erp5_ui.getPhysicalPath()[len(here.Localizer.erp5_ui.getPortalObject().getPhysicalPath()):]), message, here.Localizer.get_selected_language());\n
+       tal:attributes="href python: \'%s/manage_messages?regex=^%s%%24&amp;lang=%s\' % (\'/\'.join(here.Localizer.erp5_ui.getPhysicalPath()[len(here.Localizer.erp5_ui.getPortalObject().getPhysicalPath()):]), message, selected_language);\n
                        title info;"><img tal:attributes="src python: \'images/%s\' % (image, );\n
                                                          alt info;"/></a>\n
   </tal:block>\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/dialog_main.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/dialog_main.xml
index f54749a639..c10d0e19f2 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/dialog_main.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/dialog_main.xml
@@ -88,9 +88,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
           <tal:block metal:define-slot="main" />\n
           <tal:block metal:define-slot="bottom" />\n
         </div>\n
-        <input id="dialog_cancel_button" value="Cancel" name="Base_cancel:method" type="submit" i18n:translate="" i18n:domain="ui" />\n
-        <input tal:condition="python: form.update_action!=\'\'" id="dialog_update_button" value="Update" name="Base_showUpdateDialog:method" type="submit" i18n:translate="" i18n:domain="ui" />\n
-        <input tal:attributes="value python: here.Base_getFormViewDialogActionButtonTitle(form); name python: \'%s:method\' % (form_action, )" id="dialog_submit_button" type="submit" i18n:translate="" i18n:domain="ui" />\n
+        <input tal:attributes="value python: here.Base_translateString(\'Cancel\')"\n
+               id="dialog_cancel_button" name="Base_cancel:method" type="submit" />\n
+        <input tal:condition="python: form.update_action!=\'\'"\n
+               tal:attributes="value python: here.Base_translateString(\'Update\')"\n
+               id="dialog_update_button" name="Base_showUpdateDialog:method" type="submit" />\n
+        <input tal:attributes="value python: here.Base_translateString(here.Base_getFormViewDialogActionButtonTitle(form));\n
+                               name python: \'%s:method\' % (form_action, )"\n
+               id="dialog_submit_button" type="submit" />\n
       </tal:block>\n
     </tal:block>\n
   </tal:block>\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml
index 49027a1451..9e954997e9 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml
@@ -74,6 +74,7 @@
     global form                 nocall:form | nothing;\n
     global preferred_html_style_developper_mode   here/portal_preferences/getPreferredHtmlStyleDevelopperMode;\n
     global preferred_html_style_translator_mode   here/portal_preferences/getPreferredHtmlStyleTranslatorMode;\n
+    global selected_language    here/Localizer/get_selected_language;\n
   "/>\n
 </tal:block>\n
 \n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index f71beab75f..9ce0f492d8 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-237
\ No newline at end of file
+241
\ No newline at end of file
-- 
2.30.9