From ff7f2893584bd6976d1e01ed7a8eb9d6d1a61568 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Wed, 9 Aug 2006 22:18:27 +0000 Subject: [PATCH] Add language attribute to default file git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14598 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/LyX.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index c9c5b38021..0161dc6afe 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -124,7 +124,11 @@ def get_encoding(language, inputencoding): # class LyX_Base: """This class carries all the information of the LyX file.""" - def __init__(self, end_format = 0, input = "", output = "", error = "", debug = default_debug_level, try_hard = 0): + + def __init__(self, end_format = 0, input = "", output = "", error + = "", debug = default_debug_level, try_hard = 0, language = "english", + encoding = "auto"): + """Arguments: end_format: final format that the file should be converted. (integer) input: the name of the input source, if empty resort to standard input. @@ -157,7 +161,8 @@ class LyX_Base: self.preamble = [] self.body = [] self.status = 0 - self.encoding = "auto" + self.encoding = encoding + self.language = language def warning(self, message, debug_level= default_debug_level): @@ -240,6 +245,8 @@ class LyX_Base: " Writes the LyX file to self.output." self.set_version() self.set_format() + if self.encoding == "auto": + self.encoding = get_encoding(self.language, self.encoding) if self.preamble: i = find_token(self.header, '\\textclass', 0) + 1 -- 2.39.2