Revert "A few minor changes to previous GoogleTranslate commit"

This reverts commit 257562f0d0.

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
Brian S. Stephan 2010-08-01 19:27:44 -05:00
parent d4fc5e77eb
commit 493521c3da
1 changed files with 4 additions and 4 deletions

View File

@ -52,11 +52,11 @@ class GoogleTranslate(Module):
# do some text conversion
for i in re.findall('\u(\w{4})', translation):
translation = translation.replace('\u' + i, unichr(int(i, 16)))
replacement = unichr(int(i, 16))
translation = translation.replace('\u' + i, replacement)
for i in re.findall('&(#)?(x)?(\w+?);', translation):
original = '&' + i[0] + i[1] + i[2] + ';'
replacement = original
replacement = i[2]
if i[0] == "#":
if i[1] == 'x':
replacement = unichr(int(i[2], 16))
@ -65,7 +65,7 @@ class GoogleTranslate(Module):
else:
cp = name2codepoint.get(i[2])
replacement = unichr(cp)
translation = translation.replace(original, replacement)
translation = translation.replace('&' + i[0] + i[1] + i[2] + ';', replacement)
translation = translation.replace('\\\\', '\\')