The branch, master, has been updated.
- Log -
commit f71a55a279914247f986ada9f3b78ebfd29c460b
Author: Juergen Spitzmueller
Date: Sat Jun 9 11:32:34 2012 +0200
some less language hardcoding
diff --git a/lib/languages b/lib/languages
index 25169dc..92d23c1 100644
--- a/lib/languages
+++ b/lib/languages
@@ -21,6 +21,7 @@
# PostBabelPreamble
#
# EndPostBabelPreamble
+# Requires
# End
#
#
@@ -261,6 +262,7 @@ Language chinese-simplified
GuiName "Chinese (simplified)"
Encoding euc-cn
LangCode zh_CN
+ Requires CJK
End
# uses CJK package
@@ -268,6 +270,7 @@ Language chinese-traditional
GuiName "Chinese (traditional)"
Encodingutf8-cjk
LangCodezh_CN
+ Requires CJK
End
# not supported by babel
@@ -513,6 +516,7 @@ Language japanese
Encoding jis-plain
LangCode ja_JP
AsBabelOptions true
+ Requires japanese
End
# uses CJK package
@@ -520,6 +524,7 @@ Language japanese-cjk
GuiName "Japanese (CJK)"
Encodingeuc-jp
LangCodeja_JP
+ RequiresCJK
End
# not yet supported by polyglossia
@@ -534,6 +539,7 @@ Language korean
GuiName "Korean"
Encodingeuc-kr
LangCodeko_KR
+ RequiresCJK
End
# not supported by babel
@@ -873,6 +879,7 @@ Language vietnamese
Encoding utf8
LangCode vi_VN
AsBabelOptions true
+ Requires vietnamese
End
Language welsh
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 7237a94..ac028fc 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1250,10 +1250,8 @@ void BufferParams::validate(LaTeXFeatures & features)
const
|| useNonTeXFonts))
features.require("polyglossia");
- if (language->lang() == "vietnamese")
- features.require("vietnamese");
- else if (language->lang() == "japanese")
- features.require("japanese");
+ if (!language->requires().empty())
+ features.require(language->requires());
}
@@ -2688,9 +2686,6 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
// If the "japanese" package (i.e. pLaTeX) is used,
// inputenc must be omitted.
// see
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
- if (package == Encoding::japanese)
-features.require("japanese");
-
if ((!encodings.empty() || package == Encoding::inputenc)
&& !features.isRequired("japanese")) {
os << "\\usepackage[";
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index f75fdc4..c4b49e6 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -453,8 +453,8 @@ void LaTeXFeatures::useLanguage(Language const * lang)
{
if (!lang->babel().empty())
UsedLanguages_.insert(lang);
- if (lang->lang() == "vietnamese")
- require("vietnamese");
+ if (!lang->requires().empty())
+ require(lang->requires());
// CJK languages do not have a babel name.
// They use the CJK package
if (lang->encoding()->package() == Encoding::CJK)
diff --git a/src/Language.cpp b/src/Language.cpp
index cbe425d..ddb63e3 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -74,6 +74,7 @@ bool Language::readLanguage(Lexer & lex)
LA_POLYGLOSSIAOPTS,
LA_POSTBABELPREAMBLE,
LA_PREBABELPREAMBLE,
+ LA_REQUIRES,
LA_RTL
};
@@ -91,6 +92,7 @@ bool Language::readLanguage(Lexer & lex)
{ "polyglossiaopts", LA_POLYGLOSSIAOPTS },
{ "postbabelpreamble",LA_POSTBABELPREAMBLE },
{ "prebabelpreamble", LA_PREBABELPREAMBLE },
+ { "requires", LA_REQUIRES },
{ "rtl", LA_RTL }
};
@@ -152,6 +154,9 @@ bool Language::readLanguage(Lexer & lex)
babel_presettings_ =
lex.getLongString("EndPreBabelPreamble");
break;
+ case LA_REQUIRES:
+ lex >> requires_;
+ break;
case LA_RTL:
lex >> rightToLeft_;
break;
diff --git a/src/Language.h b/src/Language.h
index 537c7f7..955df26 100644
--- a/src/Language.h
+++ b/src/Language.h
@@ -40,6 +40,8 @@ public:
std::string const & polyglossia() const { return polyglossia_name_; }
/// polyglossia language options
std::string const & polyglossiaOpts() const { return p