+ bool const maintext = text.isMainText(buf);
+
+ // Open a CJK environment at the beginning of the main buffer
+ // if the document's language is a CJK language
+ if (maintext && bparams.encoding().package() == Encoding::CJK) {
+ os << "\\begin{CJK}{" << from_ascii(bparams.encoding().latexName())
+ << "}{}%\n";
+ texrow.newline();
+ open_encoding_ = CJK;
+ }
+ // if "auto begin" is switched off, explicitely switch the
+ // language on at start
+ if (maintext && !lyxrc.language_auto_begin &&
+ !bparams.language->babel().empty()) {
+ // FIXME UNICODE
+ os << from_utf8(subst(lyxrc.language_command_begin,
+ "$$lang",
+ bparams.language->babel()))
+ << '\n';
+ texrow.newline();
+ }
+
+ ParagraphList::const_iterator lastpar;