mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Fix local polyglossia switch for Arabic
We need to lowercase the language again (it's \begin{Arabic},
but \textarabic)
Fixes: #11057.
(cherry picked from commit 27584f5f70
)
This commit is contained in:
parent
94fe126161
commit
afeb5acb0f
@ -142,11 +142,16 @@ string const getPolyglossiaEnvName(Language const * lang)
|
|||||||
|
|
||||||
|
|
||||||
string const getPolyglossiaBegin(string const & lang_begin_command,
|
string const getPolyglossiaBegin(string const & lang_begin_command,
|
||||||
string const & lang, string const & opts)
|
string const & lang, string const & opts,
|
||||||
|
bool const localswitch = false)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
if (!lang.empty())
|
if (!lang.empty()) {
|
||||||
result = subst(lang_begin_command, "$$lang", lang);
|
// we need to revert the upcasing done in getPolyglossiaEnvName()
|
||||||
|
// in case we have a local polyglossia command (\textarabic).
|
||||||
|
string language = localswitch ? ascii_lowercase(lang) : lang;
|
||||||
|
result = subst(lang_begin_command, "$$lang", language);
|
||||||
|
}
|
||||||
string options = opts.empty() ?
|
string options = opts.empty() ?
|
||||||
string() : "[" + opts + "]";
|
string() : "[" + opts + "]";
|
||||||
result = subst(result, "$$opts", options);
|
result = subst(result, "$$opts", options);
|
||||||
@ -905,7 +910,9 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
&& (par_lang != openLanguageName(state) || localswitch)
|
&& (par_lang != openLanguageName(state) || localswitch)
|
||||||
&& !par_lang.empty()) {
|
&& !par_lang.empty()) {
|
||||||
string bc = use_polyglossia ?
|
string bc = use_polyglossia ?
|
||||||
getPolyglossiaBegin(lang_begin_command, par_lang, par_language->polyglossiaOpts())
|
getPolyglossiaBegin(lang_begin_command, par_lang,
|
||||||
|
par_language->polyglossiaOpts(),
|
||||||
|
localswitch)
|
||||||
: subst(lang_begin_command, "$$lang", par_lang);
|
: subst(lang_begin_command, "$$lang", par_lang);
|
||||||
os << bc;
|
os << bc;
|
||||||
os << lang_command_termination;
|
os << lang_command_termination;
|
||||||
@ -964,11 +971,13 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
if (runparams.encoding->package() == Encoding::CJK
|
if (runparams.encoding->package() == Encoding::CJK
|
||||||
&& par_lang != openLanguageName(state)
|
&& par_lang != openLanguageName(state)
|
||||||
&& !par_lang.empty()) {
|
&& !par_lang.empty()) {
|
||||||
os << from_ascii(subst(
|
string bc = use_polyglossia ?
|
||||||
lang_begin_command,
|
getPolyglossiaBegin(lang_begin_command, par_lang,
|
||||||
"$$lang",
|
par_language->polyglossiaOpts(),
|
||||||
par_lang))
|
localswitch)
|
||||||
<< lang_command_termination;
|
: subst(lang_begin_command, "$$lang", par_lang);
|
||||||
|
os << bc
|
||||||
|
<< lang_command_termination;
|
||||||
if (using_begin_end)
|
if (using_begin_end)
|
||||||
pushLanguageName(par_lang, localswitch);
|
pushLanguageName(par_lang, localswitch);
|
||||||
}
|
}
|
||||||
@ -1135,7 +1144,8 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
&& current_lang != openLanguageName(state)) {
|
&& current_lang != openLanguageName(state)) {
|
||||||
string bc = use_polyglossia ?
|
string bc = use_polyglossia ?
|
||||||
getPolyglossiaBegin(lang_begin_command, current_lang,
|
getPolyglossiaBegin(lang_begin_command, current_lang,
|
||||||
current_language->polyglossiaOpts())
|
current_language->polyglossiaOpts(),
|
||||||
|
localswitch)
|
||||||
: subst(lang_begin_command, "$$lang", current_lang);
|
: subst(lang_begin_command, "$$lang", current_lang);
|
||||||
os << bc;
|
os << bc;
|
||||||
pending_newline = !localswitch;
|
pending_newline = !localswitch;
|
||||||
|
@ -60,6 +60,8 @@ What's new
|
|||||||
- Do not embrace numbers in \beginL ... \endL with polyglossia in Right-
|
- Do not embrace numbers in \beginL ... \endL with polyglossia in Right-
|
||||||
to-Left languages, since bidi handles the numbers automatically.
|
to-Left languages, since bidi handles the numbers automatically.
|
||||||
|
|
||||||
|
- Fix polyglossia language switches for Arabic (bug 11057).
|
||||||
|
|
||||||
|
|
||||||
* LYX2LYX
|
* LYX2LYX
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user