commit 85ecde631163c4f93ed9e71681571714b80b6790
Author: Juergen Spitzmueller <[email protected]>
Date: Sat Oct 11 08:35:58 2025 +0200
Extend crossref localization (#7426)
For languages not supported by a crossref package, we generate
the necessary definitions on the fly
---
lib/languages | 32 +++++++++++++
po/lyx_pot.py | 17 ++++---
src/LaTeXFeatures.cpp | 129 ++++++++++++++++++++++++++++++++++++++------------
src/LaTeXFeatures.h | 4 +-
src/Language.cpp | 21 +++++++-
src/Language.h | 4 ++
6 files changed, 169 insertions(+), 38 deletions(-)
diff --git a/lib/languages b/lib/languages
index 425724bf78..ab2fe12113 100644
--- a/lib/languages
+++ b/lib/languages
@@ -34,6 +34,7 @@
# EndPostBabelPreamble
# Requires <requirement>
# Provides <babel language feature>
+# SupportedBy <package,package,...>
# End
#
#
@@ -145,6 +146,9 @@
# You can use the placeholders $lang$ and $opts$ (as in
# \languageattribute{$lang$}{$opts$})
# The special value "modifier" indicates to use babel modifiers.
+# * SupportedBy indicates whether a specific package provides localization
+# for the given language. This is currently used for the cross-reference
+# packages (cleveref, refstyle, zref).
#
##########################################################################
@@ -179,6 +183,7 @@ Language afrikaans
FontEncoding T1|OT1
DateFormats "dd MMMM yyyy|dd MMM yyyy|yyyy/MM/dd"
LangCode af_ZA
+ SupportedBy refstyle
End
# FontEncoding: no hyphenation, but uses Ç/ç und Ë/ë
@@ -213,6 +218,7 @@ Language american
FontEncoding ASCII
DateFormats "MMMM dd, yyyy|MMM dd, yyyy|M/d/yyyy"
LangCode en_US
+ SupportedBy cleveref,refstyle,zref
End
Language amharic
@@ -326,6 +332,7 @@ Language australian
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
QuoteStyle english
LangCode en_AU
+ SupportedBy cleveref,refstyle,zref
End
# In polyglossia, this is supported since release 1.33.4 (May 2014)
@@ -343,6 +350,7 @@ Language austrian
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de
LangVariety alt
+ SupportedBy refstyle,zref
End
# In polyglossia, this is supported since release 1.33.4 (May 2014)
@@ -358,6 +366,7 @@ Language naustrian
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_AT
+ SupportedBy refstyle,zref
End
Language azerbaijani
@@ -466,6 +475,7 @@ Language brazilian
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d 'de' MMM 'de' yyyy|dd/MM/yyyy"
LangCode pt_BR
+ SupportedBy cleveref,refstyle,zref
End
# FontEncoding: # ? no hyphenation, but uses ñ
@@ -491,6 +501,7 @@ Language british
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode en_GB
+ SupportedBy cleveref,refstyle,zref
End
Language bulgarian
@@ -519,6 +530,7 @@ Language canadian
FontEncoding ASCII
DateFormats "MMMM d, yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode en_CA
+ SupportedBy cleveref,refstyle,zref
End
Language canadien
@@ -533,6 +545,7 @@ Language canadien
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode fr_CA
+ SupportedBy zref
End
Language catalan
@@ -546,6 +559,7 @@ Language catalan
FontEncoding T1|OT1
DateFormats "d / MMMM / yyyy|d / MMM / yyyy|dd/MM/yyyy"
LangCode ca_ES
+ SupportedBy cleveref
End
# uses CJK package
@@ -639,6 +653,7 @@ Language danish
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd/MM/yyyy"
LangCode da_DK
+ SupportedBy cleveref,refstyle
End
# babel only provides a "bare minimum locale"
@@ -664,6 +679,7 @@ Language dutch
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|d-M-yyyy"
LangCode nl_NL
+ SupportedBy cleveref,zref
End
Language english
@@ -678,6 +694,7 @@ Language english
Encoding iso8859-15
FontEncoding ASCII
LangCode en_US
+ SupportedBy cleveref,refstyle,zref
End
# Esperanto has no country code because it is an auxiliary language.
@@ -692,6 +709,7 @@ Language esperanto
FontEncoding IL3|T1|OT1
DateFormats "'la' d 'de' MMMM yyyy|'la' d 'de' MMM yyyy|MM/dd/yyyy"
LangCode eo_EO
+ SupportedBy cleveref
End
Language estonian
@@ -755,6 +773,7 @@ Language french
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode fr_FR
+ SupportedBy cleveref,refstyle,zref
End
Language friulan
@@ -810,6 +829,7 @@ Language german
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de
LangVariety alt
+ SupportedBy cleveref,refstyle,zref
End
Language ngerman
@@ -825,6 +845,7 @@ Language ngerman
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_DE
+ SupportedBy cleveref,refstyle,zref
End
# In Babel, this is supported since release 2.7 of babel-german (Dec 2013)
@@ -843,6 +864,7 @@ Language german-ch
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_CH
+ SupportedBy zref
End
# In Babel, this is supported since release 2.7 of babel-german (Dec 2013)
@@ -860,6 +882,7 @@ Language german-ch-old
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_CH
+ SupportedBy zref
End
Language greek
@@ -973,6 +996,7 @@ Language italian
FontEncoding ASCII
DateFormats "dd MMMM yyyy|dd/MMM/yyyy|dd/MM/yyyy"
LangCode it_IT
+ SupportedBy cleveref,refstyle,zref
End
# Since 2016-12-18, babel-japanese works with non-TeX fonts (Xe/LuaTeX), too
@@ -1288,6 +1312,7 @@ Language newzealand
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode en_NZ
+ SupportedBy cleveref,refstyle,zref
End
Language nko
@@ -1315,6 +1340,7 @@ Language norsk
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd./MM./yyyy"
LangCode nb_NO
+ SupportedBy cleveref,refstyle
End
Language nynorsk
@@ -1329,6 +1355,7 @@ Language nynorsk
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
LangCode nn_NO
+ SupportedBy refstyle
End
Language occitan
@@ -1405,6 +1432,7 @@ Language portuguese
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d 'de' MMM 'de' yyyy|yyyy/MM/dd"
LangCode pt_PT
+ SupportedBy refstyle,zref
End
Language punjabi
@@ -1456,6 +1484,7 @@ Language russian
DateFormats "d MMMM yyyy 'г'.|d MMM yyyy 'г'.|dd.MM.yyyy"
LangCode ru_RU
Provides textcyrillic
+ SupportedBy cleveref,zref
End
# FontEncoding: no hyphenation, but diacritics
@@ -1571,6 +1600,7 @@ Language spanish
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode es_ES
+ SupportedBy cleveref,zref
End
# there are no spanish shorthands in polyglossia
@@ -1599,6 +1629,7 @@ Language swedish
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode sv_SE
+ SupportedBy cleveref,refstyle,zref
End
Language syriac
@@ -1725,6 +1756,7 @@ Language ukrainian
DateFormats "dd MMMM yyyy|d MM yyyy|dd.MM.yyyy"
LangCode uk_UA
Provides textcyrillic
+ SupportedBy cleveref
End
Language uppersorbian
diff --git a/po/lyx_pot.py b/po/lyx_pot.py
index 3959ddd297..9b07ef6abe 100755
--- a/po/lyx_pot.py
+++ b/po/lyx_pot.py
@@ -357,19 +357,24 @@ def layouts_l10n(input_files, output, base,
layouttranslations):
lres = CounterFormats.search(string)
if lres != None:
if layouttranslations:
- keyset.add(lres.group(1) + " " + lres.group(3))
- keyset.add(lres.group(1).lower() + " " + lres.group(3))
- keyset.add(lres.group(2) + " " + lres.group(3))
- keyset.add(lres.group(2).lower() + " " + lres.group(3))
+ keyset.add(lres.group(1))
+ keyset.add(lres.group(1).lower())
+ keyset.add(lres.group(2))
+ keyset.add(lres.group(2).lower())
else:
+ writeString(out, src, base, lineno, lres.group(1))
+ writeString(out, src, base, lineno,
lres.group(1).lower())
+ writeString(out, src, base, lineno, lres.group(2))
+ writeString(out, src, base, lineno,
lres.group(2).lower())
writeString(out, src, base, lineno, lres.group(1) + "
" + lres.group(3))
writeString(out, src, base, lineno,
lres.group(1).lower() + " " + lres.group(3))
writeString(out, src, base, lineno, lres.group(2) + "
" + lres.group(3))
writeString(out, src, base, lineno,
lres.group(2).lower() + " " + lres.group(3))
else:
if layouttranslations:
- keyset.add(string)
- keyset.add(string.lower())
+ if not "\\" in string:
+ keyset.add(string)
+ keyset.add(string.lower())
else:
writeString(out, src, base, lineno, string)
writeString(out, src, base, lineno, string.lower())
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 2beba6871d..b854a4f4c7 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -2299,17 +2299,18 @@ docstring const i18npreamble(docstring const & templ,
Language const * lang,
} // namespace
-docstring const LaTeXFeatures::getThmI18nDefs(Layout const & lay) const
+docstring const LaTeXFeatures::getThmI18nDefs(Layout const & lay, bool const
force) const
{
if (lay.thmName().empty() || !refPrefixUsed(lay.refprefix))
return docstring();
- if (params_.xref_package == "zref" && lay.thmZRefName() == "none" &&
!lay.thmXRefName().empty()
+ if (params_.xref_package == "zref"
+ && ((lay.thmZRefName() == "none" || force) &&
!lay.thmXRefName().empty())
&& (isRequired("zref-clever") || isRequired("zref-vario"))) {
docstring const tn = from_utf8(lay.thmXRefName());
docstring const tnp = from_utf8(lay.thmXRefNamePl());
odocstringstream ods;
- ods << "\\zcRefTypeSetup{"
- << from_utf8(lay.thmName()) << "}{\n"
+ ods << "\\zcLanguageSetup{$$lang}{\n"
+ << "type = " << from_utf8(lay.thmName()) << ",\n"
<< "Name-sg = _(" << tn << "),\n"
<< "name-sg = _(" << lowercase(tn) << "),\n"
<< "Name-pl = _(" << tnp << "),\n"
@@ -2474,9 +2475,9 @@ docstring const LaTeXFeatures::getXRefDefs(docstring
const & pr, docstring const
}
-docstring const LaTeXFeatures::getXRefI18nDefs(docstring const & pr, docstring
const & cnt) const
+docstring const LaTeXFeatures::getXRefI18nDefs(docstring const & pr, docstring
const & cnt, bool const force) const
{
- if (xref_defs_.find(pr) == xref_defs_.end())
+ if (pr.empty() || (!force && xref_defs_.find(pr) == xref_defs_.end()))
return docstring();
odocstringstream ods;
@@ -2516,7 +2517,8 @@ docstring const LaTeXFeatures::getXRefI18nDefs(docstring
const & pr, docstring c
else if (params_.xref_package == "zref" && (isRequired("zref-clever")
|| isRequired("zref-vario"))) {
docstring const tn = getFormattedLabel(fl, false);
docstring const tnp = getFormattedLabel(flp, false);
- ods << "\\zcRefTypeSetup{" << cnt << "}{\n"
+ ods << "\\zcLanguageSetup{$$lang}{\n"
+ << " type = " << cnt << ",\n"
<< " Name-sg = _(" << tn << "),\n"
<< " name-sg = _(" << lowercase(tn) << "),\n"
<< " Name-pl = _(" << tnp << "),\n"
@@ -2539,6 +2541,7 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool
use_babel,
// commands (would happen if e.g. both theorem and theorem* are used)
set<docstring> snippets;
typedef LanguageList::const_iterator lang_it;
+ string const xref_package = buffer().params().xref_package;
lang_it const lbeg = UsedLanguages_.begin();
lang_it const lend = UsedLanguages_.end();
list<docstring>::const_iterator cit = usedLayouts_.begin();
@@ -2559,18 +2562,32 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
- docstring const xxref = getXRefI18nDefs(tclass[*cit].refprefix,
cnt);
- if (!xxref.empty())
+ docstring xxref = getXRefI18nDefs(tclass[*cit].refprefix, cnt,
+
!buffer().language()->supportedBy(xref_package));
+ if (!xxref.empty()) {
+ if (xref_package == "zref" &&
!buffer().language()->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
buffer().language(),
+
buffer().params().encoding(),
+ use_polyglossia,
false));
snippets.insert(i18npreamble(xxref,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
- docstring const thmxref = getThmI18nDefs(tclass[*cit]);
- if (!thmxref.empty())
+ }
+ docstring thmxref = getThmI18nDefs(tclass[*cit],
+
!buffer().language()->supportedBy(xref_package));
+ if (!thmxref.empty()) {
+ if (xref_package == "zref" &&
!buffer().language()->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
buffer().language(),
+
buffer().params().encoding(),
+ use_polyglossia,
false));
snippets.insert(i18npreamble(thmxref,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
+ }
// commands for language changing (for multilanguage documents)
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
snippets.insert(i18npreamble(
@@ -2578,27 +2595,47 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
- if (!thmxref.empty())
+ if (!thmxref.empty() && xref_package != "zref")
snippets.insert(i18npreamble("\\addto\\captions$$lang{" + rtrim(thmxref, "\n")
+ "}\n",
buffer().language(),
buffer().params().encoding(),
use_polyglossia,
false));
- if (!xxref.empty())
+ if (!xxref.empty() && xref_package != "zref")
snippets.insert(i18npreamble("\\addto\\captions$$lang{" + rtrim(xxref, "\n") +
"}\n",
buffer().language(),
buffer().params().encoding(),
use_polyglossia,
false));
for (lang_it lit = lbeg; lit != lend; ++lit) {
- if (!thmxref.empty())
-
snippets.insert(i18npreamble("\\addto\\captions$$lang{" + rtrim(thmxref, "\n")
+ "}\n",
- *lit,
-
buffer().params().encoding(),
-
use_polyglossia, false));
- if (!xxref.empty())
-
snippets.insert(i18npreamble("\\addto\\captions$$lang{" + rtrim(xxref, "\n") +
"}\n",
+ thmxref = getThmI18nDefs(tclass[*cit],
+
!(*lit)->supportedBy(xref_package));
+ if (!thmxref.empty()) {
+ if (xref_package == "zref" &&
!(*lit)->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
*lit,
+
buffer().params().encoding(),
+
use_polyglossia, false));
+
snippets.insert(i18npreamble(xref_package == "zref" ?
+
thmxref
+ :
"\\addto\\captions$$lang{" + rtrim(thmxref, "\n") + "}\n",
*lit,
buffer().params().encoding(),
use_polyglossia, false));
+ }
+ xxref = getXRefI18nDefs(tclass[*cit].refprefix,
cnt,
+
!(*lit)->supportedBy(xref_package));
+ if (!xxref.empty()) {
+ if (xref_package == "zref" &&
!(*lit)->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
*lit,
+
buffer().params().encoding(),
+
use_polyglossia, false));
+
snippets.insert(i18npreamble(xref_package == "zref" ?
+ xxref
+ :
"\\addto\\captions$$lang{" + rtrim(xxref, "\n") + "}\n",
+ *lit,
+
buffer().params().encoding(),
+ use_polyglossia,
false));
+ }
snippets.insert(i18npreamble(
tclass[*cit].babelpreamble(),
*lit,
@@ -2616,18 +2653,25 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
docstring const float_defs =
getXRefDefs(from_ascii(fl.refPrefix()), from_ascii(fl.floattype()),
fl.needCrossrefDefs(),
fl.floattype(), true);
// and localizations
- docstring const floats_l7n_defs =
- getXRefI18nDefs(from_ascii(fl.refPrefix()),
from_ascii(fl.floattype()));
+ docstring floats_l7n_defs =
+ getXRefI18nDefs(from_ascii(fl.refPrefix()),
from_ascii(fl.floattype()),
+
!buffer().language()->supportedBy(xref_package));
if (!float_defs.empty())
snippets.insert(i18npreamble(float_defs,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
- if (!floats_l7n_defs.empty() && floats_l7n_defs != float_defs)
+ if (!floats_l7n_defs.empty() && floats_l7n_defs != float_defs) {
+ if (xref_package == "zref" &&
!buffer().language()->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
buffer().language(),
+
buffer().params().encoding(),
+ use_polyglossia,
false));
snippets.insert(i18npreamble(floats_l7n_defs,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
+ }
if (!UsedLanguages_.empty() && (use_babel || use_polyglossia)) {
docstring const type = from_ascii(fl.floattype());
docstring const flname = from_utf8(fl.name());
@@ -2654,11 +2698,21 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
type, name, *lit,
buffer().params().encoding(),
use_polyglossia));
- if (!floats_l7n_defs.empty())
-
snippets.insert(i18npreamble("\\addto\\captions$$lang{" +
rtrim(floats_l7n_defs, "\n") + "}\n",
+ floats_l7n_defs =
getXRefI18nDefs(from_ascii(fl.refPrefix()), from_ascii(fl.floattype()),
+
!(*lit)->supportedBy(xref_package));
+ if (!floats_l7n_defs.empty()) {
+ if (xref_package == "zref" &&
!(*lit)->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
*lit,
buffer().params().encoding(),
use_polyglossia, false));
+
snippets.insert(i18npreamble(xref_package == "zref" ?
+
floats_l7n_defs
+ :
"\\addto\\captions$$lang{" + rtrim(floats_l7n_defs, "\n") + "}\n",
+ *lit,
+
buffer().params().encoding(),
+
use_polyglossia, false));
+ }
}
}
}
@@ -2692,12 +2746,19 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
- docstring const xxref = getXRefI18nDefs(it->second.refprefix(),
it->second.counter());
- if (!xxref.empty())
+ docstring xxref = getXRefI18nDefs(it->second.refprefix(),
it->second.counter(),
+
!buffer().language()->supportedBy(xref_package));
+ if (!xxref.empty()) {
+ if (xref_package == "zref" &&
!buffer().language()->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
buffer().language(),
+
buffer().params().encoding(),
+ use_polyglossia,
false));
snippets.insert(i18npreamble(xxref,
buffer().language(),
buffer().params().encoding(),
use_polyglossia, false));
+ }
// commands for language changing (for multilanguage documents)
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
snippets.insert(i18npreamble(
@@ -2711,11 +2772,21 @@ docstring const
LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
*lit,
buffer().params().encoding(),
use_polyglossia,
need_fixedwidth));
- if (!xxref.empty())
-
snippets.insert(i18npreamble("\\addto\\captions$$lang{" + rtrim(xxref, "\n") +
"}\n",
+ xxref = getXRefI18nDefs(it->second.refprefix(),
it->second.counter(),
+
!(*lit)->supportedBy(xref_package));
+ if (!xxref.empty()) {
+ if (xref_package == "zref" &&
!(*lit)->supportedBy(xref_package))
+
snippets.insert(i18npreamble(from_ascii("\\zcDeclareLanguage{$$lang}\n"),
+
*lit,
+
buffer().params().encoding(),
+
use_polyglossia, false));
+
snippets.insert(i18npreamble(xref_package == "zref" ?
+
xxref
+ :
"\\addto\\captions$$lang{" + rtrim(xxref, "\n") + "}\n",
*lit,
buffer().params().encoding(),
use_polyglossia,
false));
+ }
}
}
}
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index 2d2f1f0170..101fe87730 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -91,12 +91,12 @@ public:
/// The definitions needed by the document's textclass
docstring const getTClassPreamble() const;
/// Localizations for theorem reference defs
- docstring const getThmI18nDefs(Layout const &) const;
+ docstring const getThmI18nDefs(Layout const &, bool const force =
false) const;
/// Extra reference defs for layouts
docstring const getXRefDefs(docstring const & pr, docstring const &,
std::set<std::string> const & ncd,
std::string const & ln, bool const env =
true) const;
- docstring const getXRefI18nDefs(docstring const &, docstring const &)
const;
+ docstring const getXRefI18nDefs(docstring const &, docstring const &,
bool const force = false) const;
/// The language dependent definitions needed by the document's
textclass
docstring const getTClassI18nPreamble(bool use_babel,
bool use_polyglossia, bool use_minted) const;
diff --git a/src/Language.cpp b/src/Language.cpp
index f380b93772..4c15d2d01e 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -57,6 +57,16 @@ bool Language::isBabelExclusive() const
}
+bool Language::supportedBy(std::string const & package) const
+{
+ for (auto const & p : supported_by_) {
+ if (p == package)
+ return true;
+ }
+ return false;
+}
+
+
docstring const Language::translateLayout(string const & msg) const
{
if (msg.empty())
@@ -151,6 +161,7 @@ bool Language::readLanguage(Lexer & lex)
LA_PREBABELPREAMBLE,
LA_PROVIDES,
LA_REQUIRES,
+ LA_SUPPORTED_BY,
LA_QUOTESTYLE,
LA_RTL,
LA_WORDWRAP,
@@ -170,7 +181,7 @@ bool Language::readLanguage(Lexer & lex)
{ "fontencoding", LA_FONTENC },
{ "guiname", LA_GUINAME },
{ "hasguisupport", LA_HAS_GUI_SUPPORT },
- { "imoffinmath", LA_IM_OFF_IN_MATH },
+ { "imoffinmath", LA_IM_OFF_IN_MATH },
{ "internalencoding", LA_INTERNAL_ENC },
{ "langcode", LA_LANG_CODE },
{ "langvariety", LA_LANG_VARIETY },
@@ -182,6 +193,7 @@ bool Language::readLanguage(Lexer & lex)
{ "quotestyle", LA_QUOTESTYLE },
{ "requires", LA_REQUIRES },
{ "rtl", LA_RTL },
+ { "supportedby", LA_SUPPORTED_BY },
{ "wordwrap", LA_WORDWRAP },
{ "xindyname", LA_XINDYNAME }
};
@@ -285,6 +297,13 @@ bool Language::readLanguage(Lexer & lex)
case LA_PROVIDES:
lex >> provides_;
break;
+ case LA_SUPPORTED_BY: {
+ lex.eatLine();
+ vector<string> const fe =
+ getVectorFromString(lex.getString(true));
+ supported_by_.insert(supported_by_.end(), fe.begin(),
fe.end());
+ break;
+ }
case LA_RTL:
lex >> rightToLeft_;
break;
diff --git a/src/Language.h b/src/Language.h
index 91577abb9b..c7e2c5c7ad 100644
--- a/src/Language.h
+++ b/src/Language.h
@@ -109,6 +109,8 @@ public:
docstring decimalSeparator() const;
/// This language corresponds to a translation of the GUI
bool hasGuiSupport() const { return has_gui_support_; }
+ /// Is this language supported by a specific package?
+ bool supportedBy(std::string const & package) const;
///
bool read(support::Lexer & lex);
///
@@ -163,6 +165,8 @@ private:
///
std::vector<std::string> dateformats_;
///
+ std::vector<std::string> supported_by_;
+ ///
bool internal_enc_;
///
bool has_gui_support_;
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs