From b6e30aa3b80f68b332bd9bef5f8f38320c13edaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Mon, 12 Nov 2007 08:57:06 +0000 Subject: [PATCH] Made lang an explicit named argument (to make it cleaner). Added a docstring. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17526 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_core/Base_translateString.xml | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml index 3a83fd6187..03f6bfd9a0 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -68,11 +65,17 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>from Products.CMFCore.utils import getToolByName\n + <value> <string>"""\n + Translate message into another language.\n + If \'lang\' is omitted a selected user interface language is used.\n + Can use any of existing message catalogs (default is \'ui\').\n +"""\n +\n +from Products.CMFCore.utils import getToolByName\n translation_service = getToolByName(context, \'Localizer\', None)\n if translation_service is not None :\n try:\n - return translation_service.translate(catalog, msg, **kw).encode(encoding)\n + return translation_service.translate(catalog, msg, lang, **kw).encode(encoding)\n except AttributeError: # This happens in unit testing, because it is not able to find something with get_context()\n pass\n return msg\n @@ -98,7 +101,7 @@ return msg\n </item> <item> <key> <string>_params</string> </key> - <value> <string>msg, catalog="ui", encoding=\'utf8\', **kw</string> </value> + <value> <string>msg, catalog="ui", encoding=\'utf8\', lang=None, **kw</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -118,7 +121,7 @@ return msg\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>3</int> </value> + <value> <int>4</int> </value> </item> <item> <key> <string>co_varnames</string> </key> @@ -127,6 +130,7 @@ return msg\n <string>msg</string> <string>catalog</string> <string>encoding</string> + <string>lang</string> <string>kw</string> <string>Products.CMFCore.utils</string> <string>getToolByName</string> @@ -150,6 +154,7 @@ return msg\n <tuple> <string>ui</string> <string>utf8</string> + <none/> </tuple> </value> </item> -- 2.30.9