Commit ea953473 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Better handling of white spaces


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@940 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 03711344
...@@ -102,12 +102,16 @@ class TranslatingParser(StrippingParser): ...@@ -102,12 +102,16 @@ class TranslatingParser(StrippingParser):
if data: if data:
# encoding should be improved # encoding should be improved
#if type(self.result) != type(u'a'): self.result = unicode(self.result, 'iso-8859-15') #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) 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'): if type(translated_text) is type(u'a'):
#LOG('data', 0, translated_text.encode('iso-8859-15')) #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 self.result = self.result + translated_text
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment