tex2lyx: reset language after polyglossia lang environment has been closed

Fixes #11878

(cherry picked from commit 5b2479176b)
This commit is contained in:
Juergen Spitzmueller 2020-05-26 10:15:52 +02:00
parent 3792f3e649
commit d13e3193b3
2 changed files with 6 additions and 0 deletions

View File

@ -1641,11 +1641,15 @@ void parse_environment(Parser & p, ostream & os, bool outer,
parent_context.check_end_layout(os); parent_context.check_end_layout(os);
parent_context.new_paragraph(os); parent_context.new_paragraph(os);
} }
// store previous language because we must reset it at the end
string const lang_old = parent_context.font.language;
// save the language in the context so that it is // save the language in the context so that it is
// handled by parse_text // handled by parse_text
parent_context.font.language = parent_context.font.language =
preamble.polyglossia2lyx(fromPolyglossiaEnvironment(name)); preamble.polyglossia2lyx(fromPolyglossiaEnvironment(name));
parse_text(p, os, FLAG_END, outer, parent_context); parse_text(p, os, FLAG_END, outer, parent_context);
// reset previous language
parent_context.font.language = lang_old;
// Just in case the environment is empty // Just in case the environment is empty
parent_context.extra_stuff.erase(); parent_context.extra_stuff.erase();
// We must begin a new paragraph to reset the language // We must begin a new paragraph to reset the language

View File

@ -155,6 +155,8 @@ What's new
* TEX2LYX * TEX2LYX
- Fix import of nested polyglossia language environments (bug 11878).
* LYXHTML * LYXHTML