[Erp5-report] r40687 jerome - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplat...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 25 14:25:21 CET 2010


Author: jerome
Date: Thu Nov 25 14:25:21 2010
New Revision: 40687

URL: http://svn.erp5.org?rev=40687&view=rev
Log:
do not encode messages that are not unicode. This cause problem for usages like
Base_translateString("hé") when "hé" is not translated

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml?rev=40687&r1=40686&r2=40687&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml [utf8] Thu Nov 25 14:25:21 2010
@@ -62,9 +62,13 @@ if translation_service is not None :\n
   try:\n
     if not encoding:\n
       return translation_service.translate(catalog, msg, lang=lang, **kw)\n
-    return translation_service.translate(catalog, msg, lang=lang, **kw).encode(encoding)\n
+    msg = translation_service.translate(catalog, msg, lang=lang, **kw)\n
+    if same_type(msg, u\'\'):\n
+      msg = msg.encode(encoding)\n
+    return msg\n
   except AttributeError: # This happens in unit testing, because it is not able to find something with get_context()\n
     pass\n
+\n
 return msg\n
 </string> </value>
         </item>
@@ -114,6 +118,7 @@ return msg\n
                             <string>translation_service</string>
                             <string>_apply_</string>
                             <string>_getattr_</string>
+                            <string>same_type</string>
                             <string>AttributeError</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=40687&r1=40686&r2=40687&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Thu Nov 25 14:25:21 2010
@@ -1 +1 @@
-1798
\ No newline at end of file
+1799
\ No newline at end of file




More information about the Erp5-report mailing list