From 84027e679b1ea7d92975ac309456dea2afc68fa0 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Thu, 28 Aug 2008 16:26:01 +0000
Subject: [PATCH] 2008-08-28 yusei * Use Base_translateString or
 translateString instead of N_ for translation message.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23255 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Project_getExportModeItemList.xml          | 18 +++++++++++-------
 .../erp5_project/Task_calculateDuplication.xml | 16 +++++++++++-----
 bt5/erp5_project/bt/change_log                 |  3 +++
 bt5/erp5_project/bt/revision                   |  2 +-
 ...tCategorizedModuleActionInformationDict.xml | 18 +++++++++---------
 .../ERP5Site_uploadContributeContent.xml       | 12 +++++++++---
 .../erp5_xhtml_style/Base_doAction.xml         | 18 ++++++++++++------
 .../erp5_xhtml_style/Folder_create.xml         | 14 ++++++++++----
 .../erp5_xhtml_style/Workflow_statusModify.xml | 14 +++++++++-----
 9 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getExportModeItemList.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getExportModeItemList.xml
index 07eec808b8..4d4897b04a 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getExportModeItemList.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getExportModeItemList.xml
@@ -65,13 +65,12 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from Products.ERP5Type.Message import Message\n
-N_ = lambda msg: Message(\'erp5_ui\', msg)\n
+            <value> <string>from Products.ERP5Type.Message import translateString\n
 \n
 return [\n
-  ( N_(\'Tasks\'), \'Project_viewTaskList\'),\n
-  ( N_(\'Tasks Reports\'), \'Project_viewTaskReportList\' ),\n
-  ( N_(\'Tasks Summary\'), \'Project_viewSummaryList\'),\n
+  (translateString(\'Tasks\'), \'Project_viewTaskList\'),\n
+  (translateString(\'Tasks Reports\'), \'Project_viewTaskReportList\' ),\n
+  (translateString(\'Tasks Summary\'), \'Project_viewSummaryList\'),\n
 ]\n
 </string> </value>
         </item>
@@ -116,8 +115,7 @@ return [\n
                         <value>
                           <tuple>
                             <string>Products.ERP5Type.Message</string>
-                            <string>Message</string>
-                            <string>N_</string>
+                            <string>translateString</string>
                           </tuple>
                         </value>
                     </item>
@@ -136,6 +134,12 @@ return [\n
             <key> <string>id</string> </key>
             <value> <string>Project_getExportModeItemList</string> </value>
         </item>
+        <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>warnings</string> </key>
             <value>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_calculateDuplication.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_calculateDuplication.xml
index 5a83b2b81f..df79dedaa6 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_calculateDuplication.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_calculateDuplication.xml
@@ -68,7 +68,7 @@
             <value> <string encoding="cdata"><![CDATA[
 
 from Products.ERP5Type.DateUtils import addToDate\n
-N_ = context.Base_translateString\n
+Base_translateString = context.Base_translateString\n
 \n
 task_portal_type = \'Task\'\n
 task_module = context.getDefaultModule(task_portal_type)\n
@@ -125,8 +125,8 @@ start_date = context.getStartDate()\n
 if start_date is None:\n
   return context.REQUEST.RESPONSE.redirect(\n
     \'%s?portal_status_message=%s+%s.\' % (context.absolute_url(), \n
-                                         N_(\'Tasks+can+not+be+created:\'), \n
-                                         N_(\'Start+Date+is+None\')))\n
+                                         Base_translateString(\'Tasks+can+not+be+created:\'), \n
+                                         Base_translateString(\'Start+Date+is+None\')))\n
 else:\n
   date_list = getDatePeriodList(start_date)\n
   for next_date in date_list:\n
@@ -134,7 +134,7 @@ else:\n
   return context.REQUEST.RESPONSE.redirect(\n
     \'%s?portal_status_message=%s+%s.\' % (context.absolute_url(), \n
                                          len(date_list), \n
-                                         N_(\'Tasks+created\')))\n
+                                         Base_translateString(\'Tasks+created\')))\n
 
 
 ]]></string> </value>
@@ -189,7 +189,7 @@ else:\n
                             <string>addToDate</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>N_</string>
+                            <string>Base_translateString</string>
                             <string>task_portal_type</string>
                             <string>task_module</string>
                             <string>validateDay</string>
@@ -227,6 +227,12 @@ else:\n
             <key> <string>id</string> </key>
             <value> <string>Task_calculateDuplication</string> </value>
         </item>
+        <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>warnings</string> </key>
             <value>
diff --git a/bt5/erp5_project/bt/change_log b/bt5/erp5_project/bt/change_log
index 5edca2b890..b80a5372ca 100644
--- a/bt5/erp5_project/bt/change_log
+++ b/bt5/erp5_project/bt/change_log
@@ -1,3 +1,6 @@
+2008-08-28 yusei
+* Use Base_translateString or translateString instead of N_ for translation message.
+
 2008-06-13 yusei
 * Removed unused action in Project type information.
 
diff --git a/bt5/erp5_project/bt/revision b/bt5/erp5_project/bt/revision
index ed1c32452c..09c40390cc 100644
--- a/bt5/erp5_project/bt/revision
+++ b/bt5/erp5_project/bt/revision
@@ -1 +1 @@
-575
\ No newline at end of file
+576
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml
index abc836c536..626ed0859c 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getCategorizedModuleActionInformationDict.xml
@@ -66,7 +66,7 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>def getModuleActionInformationDict(**kw):\n
-  N_ = context.Base_translateString\n
+  Base_translateString = context.Base_translateString\n
   result_dict = {}\n
 \n
   # If the user is not allowed to get the category, return immediately.\n
@@ -134,7 +134,7 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     select_action=action))\n
-        module_add_list.append((N_(content_type), url))\n
+        module_add_list.append((Base_translateString(content_type), url))\n
       for template in module.getDocumentTemplateList():\n
         action = \'template %s\' % template.getRelativeUrl()\n
         url = renderCustomLink(\'%s/Base_doAction\' % module_url,\n
@@ -142,8 +142,8 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     select_action=action))\n
-        template_name = N_(\'${template_title} (Template)\',\n
-                           mapping=dict(template_title=template.getTitle()))\n
+        template_name = Base_translateString(\'${template_title} (Template)\',\n
+                                             mapping=dict(template_title=template.getTitle()))\n
         module_add_list.append((template_name, url))\n
       for add_action in action_dict.get(\'object_add\', ()):\n
         url = renderCustomLink(add_action[\'url\'],\n
@@ -151,7 +151,7 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     select_action=action))\n
-        module_add_list.append((N_(add_action[\'name\']), url))\n
+        module_add_list.append((Base_translateString(add_action[\'name\']), url))\n
       if module_add_list:\n
         add_list.append((translated_title, module_add_list))\n
 \n
@@ -163,7 +163,7 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     dialog_category=\'object_search\')).strip()\n
-        module_search_list.append((N_(search_action[\'name\']), url))\n
+        module_search_list.append((Base_translateString(search_action[\'name\']), url))\n
       if module_search_list:\n
         search_list.append((translated_title, module_search_list))\n
 \n
@@ -175,7 +175,7 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     dialog_category=\'object_exchange\')).strip()\n
-        module_exchange_list.append((N_(exchange_action[\'name\']), url))\n
+        module_exchange_list.append((Base_translateString(exchange_action[\'name\']), url))\n
       if module_exchange_list:\n
         exchange_list.append((translated_title, module_exchange_list))\n
 \n
@@ -187,7 +187,7 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     dialog_category=\'object_report\')).strip()\n
-        module_report_list.append((N_(report_action[\'name\']), url))\n
+        module_report_list.append((Base_translateString(report_action[\'name\']), url))\n
       if module_report_list:\n
         report_list.append((translated_title, module_report_list))\n
 \n
@@ -199,7 +199,7 @@
                                     form_id=form_id,\n
                                     selection_name=selection_name,\n
                                     dialog_category=\'object_print\')).strip()\n
-        module_print_list.append((N_(print_action[\'name\']), url))\n
+        module_print_list.append((Base_translateString(print_action[\'name\']), url))\n
       if module_print_list:\n
         print_list.append((translated_title, module_print_list))\n
 \n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_uploadContributeContent.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_uploadContributeContent.xml
index 6094abb01f..ba40daf142 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_uploadContributeContent.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_uploadContributeContent.xml
@@ -65,7 +65,7 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>N_ = context.Base_translateString\n
+            <value> <string>Base_translateString = context.Base_translateString\n
 REQUEST = context.REQUEST\n
 portal = context.getPortalObject()\n
 contribute_file = REQUEST.get(\'contribute_file\', None)\n
@@ -75,7 +75,7 @@ contribute_portal_type = REQUEST.get(\'contribute_portal_type\', None)\n
 \n
 \n
 if contribute_file is None or not contribute_file.filename:\n
-  portal_status_message = N_(\'Please select upload file.\')\n
+  portal_status_message = Base_translateString(\'Please select upload file.\')\n
   keep_items={\'portal_status_message\':portal_status_message}\n
   portal.Base_redirect(form_view=\'view\', keep_items=keep_items)\n
   return\n
@@ -132,7 +132,7 @@ return context.ERP5Site_contributeContent(\n
                             <string>kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>N_</string>
+                            <string>Base_translateString</string>
                             <string>REQUEST</string>
                             <string>portal</string>
                             <string>None</string>
@@ -160,6 +160,12 @@ return context.ERP5Site_contributeContent(\n
             <key> <string>id</string> </key>
             <value> <string>ERP5Site_uploadContributeContent</string> </value>
         </item>
+        <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>warnings</string> </key>
             <value>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml
index 97fcae8db1..d9e51e3464 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml
@@ -66,7 +66,7 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>portal = context.getPortalObject()\n
-N_ = portal.Base_translateString\n
+Base_translateString = portal.Base_translateString\n
 preserved_parameters={\'form_id\': form_id, \'cancel_url\': cancel_url}\n
 request = context.REQUEST\n
 \n
@@ -101,7 +101,7 @@ elif doAction0 == \'add\':\n
   new_content = context.newContent(portal_type=type_name,\n
                                    container=context,\n
                                    id=str(new_id))\n
-  preserved_parameters[\'portal_status_message\'] = N_("Object Created.")\n
+  preserved_parameters[\'portal_status_message\'] = Base_translateString("Object Created.")\n
   preserved_parameters[\'editable_mode\'] = 1\n
   redirect_url = \'%s/view\' % (new_content.absolute_url(), )\n
   # The created object is not a part of the selection, so prevent from displaying the selection navigation controls\n
@@ -118,14 +118,14 @@ elif doAction0 == \'template\':\n
     new_content_id = new_content_list[0][\'new_id\']\n
     new_content = context[new_content_id]\n
     new_content.makeTemplateInstance()\n
-    preserved_parameters[\'portal_status_message\'] = N_("Template Created.")\n
+    preserved_parameters[\'portal_status_message\'] = Base_translateString("Template Created.")\n
     redirect_url = \'%s/view\' % ( new_content.absolute_url(), )\n
   else:\n
-    preserved_parameters[\'portal_status_message\'] = N_("Template Does not Exist.")\n
+    preserved_parameters[\'portal_status_message\'] = Base_translateString("Template Does not Exist.")\n
     redirect_url = \'%s/view\' % (context.absolute_url(), )\n
 else:\n
   redirect_url = request[\'ACTUAL_URL\']\n
-  preserved_parameters[\'portal_status_message\'] = N_(\'Error: the action "%s" is not recognised.\' % (doAction0, ))\n
+  preserved_parameters[\'portal_status_message\'] = Base_translateString(\'Error: the action "%s" is not recognised.\' % (doAction0, ))\n
 \n
 return context.ERP5Site_redirect(redirect_url, keep_items=preserved_parameters, **kw)\n
 </string> </value>
@@ -183,7 +183,7 @@ return context.ERP5Site_redirect(redirect_url, keep_items=preserved_parameters,
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>
-                            <string>N_</string>
+                            <string>Base_translateString</string>
                             <string>preserved_parameters</string>
                             <string>request</string>
                             <string>None</string>
@@ -227,6 +227,12 @@ return context.ERP5Site_redirect(redirect_url, keep_items=preserved_parameters,
             <key> <string>id</string> </key>
             <value> <string>Base_doAction</string> </value>
         </item>
+        <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>warnings</string> </key>
             <value>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml
index a0b48526ba..463c53bafc 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml
@@ -65,16 +65,16 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>N_ = context.getPortalObject().Base_translateString\n
+            <value> <string>Base_translateString = context.getPortalObject().Base_translateString\n
 allowed_type_list = context.getVisibleAllowedContentTypeList()\n
 \n
 if not allowed_type_list:\n
-  return context.ERP5Site_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n
+  return context.ERP5Site_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': Base_translateString("You are not allowed to add new content in this context.")})\n
 \n
 # newContent will add the first allowed type when we do not specify portal_type=\n
 new_object = context.newContent(portal_type=allowed_type_list[0])\n
 \n
-return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': N_("Object Created.")})\n
+return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': Base_translateString("Object Created.")})\n
 </string> </value>
         </item>
         <item>
@@ -125,7 +125,7 @@ return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), ke
                           <tuple>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>N_</string>
+                            <string>Base_translateString</string>
                             <string>allowed_type_list</string>
                             <string>_getitem_</string>
                             <string>new_object</string>
@@ -147,6 +147,12 @@ return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), ke
             <key> <string>id</string> </key>
             <value> <string>Folder_create</string> </value>
         </item>
+        <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>warnings</string> </key>
             <value>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml
index 46c3e7706d..d5e87bc61f 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml
@@ -67,8 +67,7 @@
             <key> <string>_body</string> </key>
             <value> <string>from Products.Formulator.Errors import FormValidationError\n
 from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
-from Products.ERP5Type.Message import Message\n
-N_ = lambda msg, **kwd: Message(\'erp5_ui\', msg, **kwd)\n
+from Products.ERP5Type.Message import translateString\n
 portal = context.getPortalObject()\n
 request=context.REQUEST\n
 \n
@@ -136,7 +135,7 @@ except ValidationFailed, error_message:\n
                   \'%s/%s\' % (context.absolute_url(), form_id),\n
                   keep_items={\'portal_status_message\': message}, **kw)\n
 \n
-portal_status_message = request.get(\'portal_status_message\', N_(\'Status changed.\'))\n
+portal_status_message = request.get(\'portal_status_message\', translateString(\'Status changed.\'))\n
 \n
 return context.ERP5Site_redirect(\n
                 \'%s/%s\' % (context.absolute_url(), form_id),\n
@@ -197,8 +196,7 @@ return context.ERP5Site_redirect(\n
                             <string>Products.DCWorkflow.DCWorkflow</string>
                             <string>ValidationFailed</string>
                             <string>Products.ERP5Type.Message</string>
-                            <string>Message</string>
-                            <string>N_</string>
+                            <string>translateString</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>
@@ -247,6 +245,12 @@ return context.ERP5Site_redirect(\n
             <key> <string>id</string> </key>
             <value> <string>Workflow_statusModify</string> </value>
         </item>
+        <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>warnings</string> </key>
             <value>
-- 
2.30.9