mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
some less language hardcoding
This commit is contained in:
parent
f84c8c56f5
commit
f71a55a279
@ -21,6 +21,7 @@
|
|||||||
# PostBabelPreamble
|
# PostBabelPreamble
|
||||||
# <extra latex code inserted after babel>
|
# <extra latex code inserted after babel>
|
||||||
# EndPostBabelPreamble
|
# EndPostBabelPreamble
|
||||||
|
# Requires <requirement>
|
||||||
# End
|
# End
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -261,6 +262,7 @@ Language chinese-simplified
|
|||||||
GuiName "Chinese (simplified)"
|
GuiName "Chinese (simplified)"
|
||||||
Encoding euc-cn
|
Encoding euc-cn
|
||||||
LangCode zh_CN
|
LangCode zh_CN
|
||||||
|
Requires CJK
|
||||||
End
|
End
|
||||||
|
|
||||||
# uses CJK package
|
# uses CJK package
|
||||||
@ -268,6 +270,7 @@ Language chinese-traditional
|
|||||||
GuiName "Chinese (traditional)"
|
GuiName "Chinese (traditional)"
|
||||||
Encoding utf8-cjk
|
Encoding utf8-cjk
|
||||||
LangCode zh_CN
|
LangCode zh_CN
|
||||||
|
Requires CJK
|
||||||
End
|
End
|
||||||
|
|
||||||
# not supported by babel
|
# not supported by babel
|
||||||
@ -513,6 +516,7 @@ Language japanese
|
|||||||
Encoding jis-plain
|
Encoding jis-plain
|
||||||
LangCode ja_JP
|
LangCode ja_JP
|
||||||
AsBabelOptions true
|
AsBabelOptions true
|
||||||
|
Requires japanese
|
||||||
End
|
End
|
||||||
|
|
||||||
# uses CJK package
|
# uses CJK package
|
||||||
@ -520,6 +524,7 @@ Language japanese-cjk
|
|||||||
GuiName "Japanese (CJK)"
|
GuiName "Japanese (CJK)"
|
||||||
Encoding euc-jp
|
Encoding euc-jp
|
||||||
LangCode ja_JP
|
LangCode ja_JP
|
||||||
|
Requires CJK
|
||||||
End
|
End
|
||||||
|
|
||||||
# not yet supported by polyglossia
|
# not yet supported by polyglossia
|
||||||
@ -534,6 +539,7 @@ Language korean
|
|||||||
GuiName "Korean"
|
GuiName "Korean"
|
||||||
Encoding euc-kr
|
Encoding euc-kr
|
||||||
LangCode ko_KR
|
LangCode ko_KR
|
||||||
|
Requires CJK
|
||||||
End
|
End
|
||||||
|
|
||||||
# not supported by babel
|
# not supported by babel
|
||||||
@ -873,6 +879,7 @@ Language vietnamese
|
|||||||
Encoding utf8
|
Encoding utf8
|
||||||
LangCode vi_VN
|
LangCode vi_VN
|
||||||
AsBabelOptions true
|
AsBabelOptions true
|
||||||
|
Requires vietnamese
|
||||||
End
|
End
|
||||||
|
|
||||||
Language welsh
|
Language welsh
|
||||||
|
@ -1250,10 +1250,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
|
|||||||
|| useNonTeXFonts))
|
|| useNonTeXFonts))
|
||||||
features.require("polyglossia");
|
features.require("polyglossia");
|
||||||
|
|
||||||
if (language->lang() == "vietnamese")
|
if (!language->requires().empty())
|
||||||
features.require("vietnamese");
|
features.require(language->requires());
|
||||||
else if (language->lang() == "japanese")
|
|
||||||
features.require("japanese");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2688,9 +2686,6 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
|
|||||||
// If the "japanese" package (i.e. pLaTeX) is used,
|
// If the "japanese" package (i.e. pLaTeX) is used,
|
||||||
// inputenc must be omitted.
|
// inputenc must be omitted.
|
||||||
// see http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
|
// 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)
|
if ((!encodings.empty() || package == Encoding::inputenc)
|
||||||
&& !features.isRequired("japanese")) {
|
&& !features.isRequired("japanese")) {
|
||||||
os << "\\usepackage[";
|
os << "\\usepackage[";
|
||||||
|
@ -453,8 +453,8 @@ void LaTeXFeatures::useLanguage(Language const * lang)
|
|||||||
{
|
{
|
||||||
if (!lang->babel().empty())
|
if (!lang->babel().empty())
|
||||||
UsedLanguages_.insert(lang);
|
UsedLanguages_.insert(lang);
|
||||||
if (lang->lang() == "vietnamese")
|
if (!lang->requires().empty())
|
||||||
require("vietnamese");
|
require(lang->requires());
|
||||||
// CJK languages do not have a babel name.
|
// CJK languages do not have a babel name.
|
||||||
// They use the CJK package
|
// They use the CJK package
|
||||||
if (lang->encoding()->package() == Encoding::CJK)
|
if (lang->encoding()->package() == Encoding::CJK)
|
||||||
|
@ -74,6 +74,7 @@ bool Language::readLanguage(Lexer & lex)
|
|||||||
LA_POLYGLOSSIAOPTS,
|
LA_POLYGLOSSIAOPTS,
|
||||||
LA_POSTBABELPREAMBLE,
|
LA_POSTBABELPREAMBLE,
|
||||||
LA_PREBABELPREAMBLE,
|
LA_PREBABELPREAMBLE,
|
||||||
|
LA_REQUIRES,
|
||||||
LA_RTL
|
LA_RTL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ bool Language::readLanguage(Lexer & lex)
|
|||||||
{ "polyglossiaopts", LA_POLYGLOSSIAOPTS },
|
{ "polyglossiaopts", LA_POLYGLOSSIAOPTS },
|
||||||
{ "postbabelpreamble", LA_POSTBABELPREAMBLE },
|
{ "postbabelpreamble", LA_POSTBABELPREAMBLE },
|
||||||
{ "prebabelpreamble", LA_PREBABELPREAMBLE },
|
{ "prebabelpreamble", LA_PREBABELPREAMBLE },
|
||||||
|
{ "requires", LA_REQUIRES },
|
||||||
{ "rtl", LA_RTL }
|
{ "rtl", LA_RTL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -152,6 +154,9 @@ bool Language::readLanguage(Lexer & lex)
|
|||||||
babel_presettings_ =
|
babel_presettings_ =
|
||||||
lex.getLongString("EndPreBabelPreamble");
|
lex.getLongString("EndPreBabelPreamble");
|
||||||
break;
|
break;
|
||||||
|
case LA_REQUIRES:
|
||||||
|
lex >> requires_;
|
||||||
|
break;
|
||||||
case LA_RTL:
|
case LA_RTL:
|
||||||
lex >> rightToLeft_;
|
lex >> rightToLeft_;
|
||||||
break;
|
break;
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
std::string const & polyglossia() const { return polyglossia_name_; }
|
std::string const & polyglossia() const { return polyglossia_name_; }
|
||||||
/// polyglossia language options
|
/// polyglossia language options
|
||||||
std::string const & polyglossiaOpts() const { return polyglossia_opts_; }
|
std::string const & polyglossiaOpts() const { return polyglossia_opts_; }
|
||||||
|
/// requirement (package, function)
|
||||||
|
std::string const & requires() const { return requires_; }
|
||||||
/// translatable GUI name
|
/// translatable GUI name
|
||||||
std::string const & display() const { return display_; }
|
std::string const & display() const { return display_; }
|
||||||
/// is this a RTL language?
|
/// is this a RTL language?
|
||||||
@ -93,6 +95,8 @@ private:
|
|||||||
///
|
///
|
||||||
std::string polyglossia_opts_;
|
std::string polyglossia_opts_;
|
||||||
///
|
///
|
||||||
|
std::string requires_;
|
||||||
|
///
|
||||||
std::string display_;
|
std::string display_;
|
||||||
///
|
///
|
||||||
bool rightToLeft_;
|
bool rightToLeft_;
|
||||||
|
Loading…
Reference in New Issue
Block a user