Fix language options glitches

This commit is contained in:
Juergen Spitzmueller 2024-08-23 16:45:52 +02:00
parent 21252f924b
commit 3c852439a6
3 changed files with 19 additions and 5 deletions

View File

@ -3498,10 +3498,13 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts,
// get language options with modifiers
bool have_mods = false;
vector<string> blangs;
for (auto const & l : features.getLanguages()) {
if (l->babel().empty())
continue;
std::set<Language const *> langs = features.getLanguages();
// add main language
langs.insert(language);
for (auto const & l : langs) {
string blang = l->babel();
if (blang.empty())
continue;
if (l->babelOptFormat() == "modifier") {
vector<string> opts = getVectorFromString(babelLangOptions(l->lang()));
bool have_one = false;

View File

@ -1816,7 +1816,10 @@ docstring const LaTeXFeatures::getBabelPostsettings() const
{
odocstringstream tmp;
for (auto const & lang : UsedLanguages_) {
std::set<Language const *> langs = UsedLanguages_;
// add main language
langs.insert(bufferParams().language);
for (auto const & lang : langs) {
if (!lang->babel_postsettings().empty())
tmp << lang->babel_postsettings() << '\n';
if (lang->babelOptFormat() != "modifier") {

View File

@ -2564,6 +2564,8 @@ void GuiDocument::languageChanged(int i)
// set appropriate quotation mark style
updateQuoteStyles(true);
updateLanguageOptions();
}
@ -2860,7 +2862,13 @@ void GuiDocument::updateLanguageOptions()
bool const use_polyglossia = extern_polyglossia
|| (langpack != "babel" && !extern_babel
&& fontModule->osFontsCB->isChecked());
for (auto const & l : buffer().getLanguages()) {
std::set<Language const *> langs = buffer().getLanguages();
// We might have a non-yet applied document language
QString const langname = langModule->languageCO->itemData(
langModule->languageCO->currentIndex()).toString();
Language const * newlang = lyx::languages.getLanguage(fromqstr(langname));
langs.insert(newlang);
for (auto const & l : langs) {
QTreeWidgetItem * twi = new QTreeWidgetItem();
twi->setData(0, Qt::DisplayRole, qt_(l->display()));
twi->setData(0, Qt::UserRole, toqstr(l->lang()));