namespace {
-int const LYX_FORMAT = 265;
+int const LYX_FORMAT = 268;
} // namespace anon
} // output_preamble
LYXERR(Debug::INFO) << "preamble finished, now the body." << endl;
- if (!lyxrc.language_auto_begin) {
+ if (!lyxrc.language_auto_begin &&
+ !params().language->babel().empty()) {
// FIXME UNICODE
os << from_utf8(subst(lyxrc.language_command_begin,
"$$lang",
texrow().newline();
}
+ Encoding const & encoding = params().encoding();
+ if (encoding.package() == Encoding::CJK) {
+ // Open a CJK environment, since in contrast to the encodings
+ // handled by inputenc the document encoding is not set in
+ // the preamble if it is handled by CJK.sty.
+ os << "\\begin{CJK}{" << from_ascii(encoding.latexName())
+ << "}{}\n";
+ texrow().newline();
+ }
+
// if we are doing a real file with body, even if this is the
// child of some other buffer, let's cut the link here.
// This happens for example if only a child document is printed.
os << endl;
texrow().newline();
- if (!lyxrc.language_auto_end) {
+ if (encoding.package() == Encoding::CJK) {
+ // Close the open CJK environment.
+ // latexParagraphs will have opened one even if the last text
+ // was not CJK.
+ os << "\\end{CJK}\n";
+ texrow().newline();
+ }
+
+ if (!lyxrc.language_auto_end &&
+ !params().language->babel().empty()) {
os << from_utf8(subst(lyxrc.language_command_end,
"$$lang",
params().language->babel()))
docstring const Buffer::B_(string const & l10n) const
{
- Language const * lang = pimpl_->params.language;
- if (lang)
- return getMessages(lang->code()).get(l10n);
-
- return _(l10n);
+ return params().B_(l10n);
}