Provide babel language options only for languages that have options

This commit is contained in:
Juergen Spitzmueller 2024-08-24 04:51:45 +02:00
parent ad0d5f9d40
commit 285f467f24
3 changed files with 15 additions and 2 deletions

View File

@ -131,7 +131,8 @@
# if a corresponding language module exists. # if a corresponding language module exists.
# * BabelOptFormat specifies how the language-specific options shall be # * BabelOptFormat specifies how the language-specific options shall be
# passed with babel (which differs between languages). # passed with babel (which differs between languages).
# Default is \languageattribute{$lang$}{$opts$} # You can use the placeholders $lang$ and $opts$ (as in
# \languageattribute{$lang$}{$opts$})
# The special value "modifier" indicates to use babel modifiers. # The special value "modifier" indicates to use babel modifiers.
# #
########################################################################## ##########################################################################
@ -217,6 +218,7 @@ End
Language ancientgreek Language ancientgreek
GuiName "Greek (ancient)" GuiName "Greek (ancient)"
BabelName greek BabelName greek
BabelOptFormat modifier
PostBabelPreamble PostBabelPreamble
\languageattribute{greek}{ancient} \languageattribute{greek}{ancient}
EndPostBabelPreamble EndPostBabelPreamble
@ -404,6 +406,7 @@ End
Language belarusian Language belarusian
GuiName "Belarusian" GuiName "Belarusian"
BabelName belarusian BabelName belarusian
BabelOptFormat \languageattribute{$lang$}{$opts$}
PolyglossiaName belarusian PolyglossiaName belarusian
XindyName belarusian XindyName belarusian
QuoteStyle french QuoteStyle french
@ -477,6 +480,7 @@ Language bulgarian
GuiName "Bulgarian" GuiName "Bulgarian"
HasGuiSupport true HasGuiSupport true
BabelName bulgarian BabelName bulgarian
BabelOptFormat \languageattribute{$lang$}{$opts$}
PolyglossiaName bulgarian PolyglossiaName bulgarian
XindyName bulgarian XindyName bulgarian
QuoteStyle german QuoteStyle german
@ -588,6 +592,7 @@ Language czech
GuiName "Czech" GuiName "Czech"
HasGuiSupport true HasGuiSupport true
BabelName czech BabelName czech
BabelOptFormat \languageattribute{$lang$}{$opts$}
PolyglossiaName czech PolyglossiaName czech
XindyName czech XindyName czech
QuoteStyle german QuoteStyle german
@ -834,6 +839,7 @@ Language greek
GuiName "Greek" GuiName "Greek"
HasGuiSupport true HasGuiSupport true
BabelName greek BabelName greek
BabelOptFormat modifier
PolyglossiaName greek PolyglossiaName greek
PolyglossiaOpts "variant=monotonic" PolyglossiaOpts "variant=monotonic"
XindyName greek XindyName greek
@ -849,6 +855,7 @@ End
Language polutonikogreek Language polutonikogreek
GuiName "Greek (polytonic)" GuiName "Greek (polytonic)"
BabelName polutonikogreek BabelName polutonikogreek
BabelOptFormat modifier
PolyglossiaName greek PolyglossiaName greek
PolyglossiaOpts "variant=polytonic" PolyglossiaOpts "variant=polytonic"
XindyName greek XindyName greek
@ -956,6 +963,7 @@ Language japanese
GuiName "Japanese" GuiName "Japanese"
HasGuiSupport true HasGuiSupport true
BabelName japanese BabelName japanese
BabelOptFormat \languageattribute{$lang$}{$opts$}
Encoding jis-platex Encoding jis-platex
WordWrap false WordWrap false
LangCode ja_JP LangCode ja_JP
@ -1028,6 +1036,7 @@ End
Language kurmanji Language kurmanji
GuiName "Kurdish (Kurmanji)" GuiName "Kurdish (Kurmanji)"
BabelName kurmanji BabelName kurmanji
BabelOptFormat \languageattribute{$lang$}{$opts$}
PolyglossiaName kurdish PolyglossiaName kurdish
XindyName kurdish-bedirxan XindyName kurdish-bedirxan
PolyglossiaOpts "variant=kurmanji" PolyglossiaOpts "variant=kurmanji"
@ -1328,6 +1337,7 @@ Language russian
GuiName "Russian" GuiName "Russian"
HasGuiSupport true HasGuiSupport true
BabelName russian BabelName russian
BabelOptFormat \languageattribute{$lang$}{$opts$}
PolyglossiaName russian PolyglossiaName russian
PolyglossiaOpts "spelling=modern" PolyglossiaOpts "spelling=modern"
XindyName russian XindyName russian
@ -1398,6 +1408,7 @@ End
Language serbian-latin Language serbian-latin
GuiName "Serbian (Latin)" GuiName "Serbian (Latin)"
BabelName serbian BabelName serbian
BabelOptFormat modifier
PolyglossiaName serbian PolyglossiaName serbian
PolyglossiaOpts "script=Latin" PolyglossiaOpts "script=Latin"
XindyName croatian XindyName croatian
@ -1412,6 +1423,7 @@ Language slovak
GuiName "Slovak" GuiName "Slovak"
HasGuiSupport true HasGuiSupport true
BabelName slovak BabelName slovak
BabelOptFormat \languageattribute{$lang$}{$opts$}
PolyglossiaName slovak PolyglossiaName slovak
XindyName slovak-large XindyName slovak-large
QuoteStyle german QuoteStyle german

View File

@ -288,7 +288,6 @@ bool Language::read(Lexer & lex)
encoding_ = nullptr; encoding_ = nullptr;
internal_enc_ = false; internal_enc_ = false;
rightToLeft_ = false; rightToLeft_ = false;
babeloptformat_ = "\\languageattribute{$lang$}{$opts$}";
if (!lex.next()) { if (!lex.next()) {
lex.printError("No name given for language: `$$Token'."); lex.printError("No name given for language: `$$Token'.");

View File

@ -2869,6 +2869,8 @@ void GuiDocument::updateLanguageOptions()
Language const * newlang = lyx::languages.getLanguage(fromqstr(langname)); Language const * newlang = lyx::languages.getLanguage(fromqstr(langname));
langs.insert(newlang); langs.insert(newlang);
for (auto const & l : langs) { for (auto const & l : langs) {
if (!use_polyglossia && l->babelOptFormat().empty())
continue;
QTreeWidgetItem * twi = new QTreeWidgetItem(); QTreeWidgetItem * twi = new QTreeWidgetItem();
twi->setData(0, Qt::DisplayRole, qt_(l->display())); twi->setData(0, Qt::DisplayRole, qt_(l->display()));
twi->setData(0, Qt::UserRole, toqstr(l->lang())); twi->setData(0, Qt::UserRole, toqstr(l->lang()));