primary = False
secondary = False
+ orig_doc_language = document.language
# Main language first
if document.language == lyxname:
primary = True
endlayout = ""
if with_polyglossia:
add_to_preamble(document, ["\\AtBeginDocument{\setotherlanguage{%s}}" % polyglossianame])
- document.body[langswitch : langswitch] = [startlayout,
+ document.body[endlang : endlang] = [startlayout,
"\\begin_inset ERT", "status open", "",
"\\begin_layout Plain Layout", "", "",
"\\backslash",
"\\end_layout", "", "\\end_inset", "", "",
endlayout, ""]
elif with_babel:
- document.body[langswitch : langswitch] = [startlayout,
+ document.body[endlang : endlang] = [startlayout,
"\\begin_inset ERT", "status open", "",
"\\begin_layout Plain Layout", "", "",
"\\backslash",
endlayout = ""
if with_polyglossia:
parent = get_containing_layout(document.body, i)
- document.body[langswitch : langswitch] = [startlayout,
+ document.body[endlang : endlang] = [startlayout,
"\\begin_inset ERT", "status open", "",
"\\begin_layout Plain Layout", "", "",
"\\backslash",
endlayout, ""]
elif with_babel:
parent = get_containing_layout(document.body, i)
- document.body[langswitch : langswitch] = [startlayout,
+ document.body[endlang : endlang] = [startlayout,
"\\begin_inset ERT", "status open", "",
"\\begin_layout Plain Layout", "", "",
"\\backslash",
# With babel, we need to add the language options
if with_babel and (primary or secondary):
insert_document_option(document, babelname)
- if secondary and document.body[10] != "selectlanguage{%s}" % document.language:
+ if secondary and document.body[10] != "selectlanguage{%s}" % orig_doc_language:
# Since the user options are always placed after the babel options,
# we need to reset the main language
document.body[2 : 2] = ["\\begin_layout Standard",
"\\begin_inset ERT", "status open", "",
"\\begin_layout Plain Layout", "", "",
"\\backslash",
- "selectlanguage{%s}" % document.language,
+ "selectlanguage{%s}" % orig_doc_language,
"\\end_layout", "", "\\end_inset", "", "",
"\\end_layout", ""]