From ba1022342b240aa98d6b9a13bc2d0fea996b2ef1 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 14 Oct 2004 04:09:38 +0000 Subject: [PATCH] * src/docgen/OpenOfficeDoc.py: incorporated Julio Sanchez's language patch svn: r3631 --- ChangeLog | 4 ++++ src/docgen/OpenOfficeDoc.py | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d23e2e5b..40016267b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-10-13 Don Allingham + * src/docgen/OpenOfficeDoc.py: incorporated Julio Sanchez's + language patch + 2004-10-13 Alex Roitman * src/plugins/Makefile.am: Ship rel_es.py plugin. * src/rule.glade: Clean up the filter definition dialog. diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 515586364..be4111a8f 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -30,6 +30,7 @@ import tempfile import string import zipfile import time +import locale from math import pi, cos, sin, fabs #------------------------------------------------------------------------- @@ -97,6 +98,14 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): raise Errors.ReportError(_("Could not create %s") % self.content_xml) def init(self): + + current_locale = locale.getlocale() + self.lang = current_locale[0] + if self.lang: + self.lang = self.lang.replace('_','-') + else: + self.lang = "en-US" + self.f.write('\n') self.f.write('') @@ -683,7 +692,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): text = text.replace(' '*n, ' ' % (n-1) ) text = text.replace('\n','') text = text.replace('\t','') - text = text.replace('<super>','') + text = text.replace('<super>', + '') text = text.replace('</super>','') self.start_paragraph(style_name) @@ -695,7 +705,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): for line in text.split('\n\n'): self.start_paragraph(style_name) line = line.replace('\n',' ') - line = string.join(string.split(line)) + line = string.join(line.split()) self.write_text(line) self.end_paragraph() @@ -704,7 +714,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): text = text.replace('<','<') text = text.replace('>','>') text = text.replace('\n','') - text = text.replace('<super>','') + text = text.replace('<super>', + '') text = text.replace('</super>','') self.f.write(text) @@ -782,7 +793,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): self.f.write(self.time) self.f.write('\n') self.f.write('0-00-00T00:00:00\n') - self.f.write('en-US\n') + self.f.write('%s\n' % self.lang) self.f.write('1\n') self.f.write('PT0S\n') self.f.write('\n') @@ -933,8 +944,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): if text != "": self.f.write('' % para_name) self.f.write('' % para_name) - text = string.replace(text,'\t','') - text = string.replace(text,'\n','') + text = text.replace('\t','') + text = text.replace('\n','') self.f.write(text) self.f.write('') self.f.write('\n')