From ea953473050b05eb52e12aed4181f7cacb109396 Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Mon, 31 May 2004 18:30:13 +0000 Subject: [PATCH] Better handling of white spaces git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@940 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/CMFTranslation/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/product/CMFTranslation/utils.py b/product/CMFTranslation/utils.py index a69030f0b2..2fed5d6343 100755 --- a/product/CMFTranslation/utils.py +++ b/product/CMFTranslation/utils.py @@ -102,12 +102,16 @@ class TranslatingParser(StrippingParser): if data: # encoding should be improved #if type(self.result) != type(u'a'): self.result = unicode(self.result, 'iso-8859-15') - #LOG('result', 0, self.result) + #LOG('result', 0, self.result) + start_space = data[0] == ' ' + end_space = data[-1] == ' ' + LOG('data', 0, 'x%sx' % data) translated_text = self.md.gettext(data, lang=self.lang) - #LOG('translated_text', 0, translated_text) + LOG('translated_text', 0, 'x%sx' % translated_text) if type(translated_text) is type(u'a'): #LOG('data', 0, translated_text.encode('iso-8859-15')) - translated_text = translated_text.encode('iso-8859-15') + translated_text = translated_text.encode('iso-8859-15') + translated_text = start_space * ' ' + translated_text + end_space * ' ' self.result = self.result + translated_text -- 2.30.9