Add a way to surpass special English treatment in useBabel

Normally, we do not load babel when English is the only language. However, if we check if babel is used from Font::validate, we need to surpass this test, else no secondary language is registered if English is the main language.
This commit is contained in:
Juergen Spitzmueller 2012-08-08 17:02:12 +02:00
parent 8f451fdbef
commit 1db9ff9b1a
3 changed files with 8 additions and 6 deletions

View File

@ -703,7 +703,7 @@ void Font::validate(LaTeXFeatures & features) const
// FIXME: Do something for background and soul package?
if (((features.usePolyglossia() && lang_->polyglossia() != doc_language->polyglossia())
|| (features.useBabel() && lang_->babel() != doc_language->babel()))
|| (features.useBabel(true) && lang_->babel() != doc_language->babel()))
&& lang_ != ignore_language
&& lang_ != latex_language)
{

View File

@ -290,7 +290,7 @@ LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p,
{}
LaTeXFeatures::LangPackage LaTeXFeatures::langPackage() const
LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const
{
string const local_lp = bufferParams().lang_package;
@ -317,7 +317,7 @@ LaTeXFeatures::LangPackage LaTeXFeatures::langPackage() const
&& !params_.documentClass().provides("babel")
&& this->hasOnlyPolyglossiaLanguages();
bool const babel_required =
(bufferParams().language->lang() != "english"
((englishbabel || bufferParams().language->lang() != "english")
&& !bufferParams().language->babel().empty())
|| !this->getBabelLanguages().empty();

View File

@ -132,10 +132,12 @@ public:
void setBuffer(Buffer const &);
///
BufferParams const & bufferParams() const;
/// Which language package do we need?
LangPackage langPackage() const;
/* Which language package do we require? \p englishbabel determines
* if we require babel even if English is the only language.
*/
LangPackage langPackage(bool englishbabel = false) const;
/// Convenience function to test if we use babel
bool useBabel() const { return langPackage() == LANG_PACK_BABEL; }
bool useBabel(bool englishbabel = false) const { return langPackage(englishbabel) == LANG_PACK_BABEL; }
/// Convenience function to test if we use polyglossia
bool usePolyglossia() const { return langPackage() == LANG_PACK_POLYGLOSSIA; }
/// are we in a float?