X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLanguage.cpp;h=e588218047aea9c790753aa0d94b1a118188bd99;hb=c7e6a677c4df14b0f2f7d701e1f1976c4005a629;hp=219021557f352006d14b32d1e24b7b10b8daa9c5;hpb=12c7e7dde3851ad894380fd42ba741dd3d0cbcc7;p=lyx.git diff --git a/src/Language.cpp b/src/Language.cpp index 219021557f..e588218047 100644 --- a/src/Language.cpp +++ b/src/Language.cpp @@ -22,6 +22,7 @@ #include "support/debug.h" #include "support/FileName.h" #include "support/lstrings.h" +#include "support/Messages.h" using namespace std; using namespace lyx::support; @@ -41,13 +42,16 @@ Language const * reset_language = 0; bool Language::readLanguage(Lexer & lex) { enum LanguageTags { - LA_BABELNAME = 1, + LA_AS_BABELOPTS = 1, + LA_BABELNAME, LA_ENCODING, LA_END, LA_GUINAME, LA_INTERNAL_ENC, LA_LANG_CODE, LA_LANG_VARIETY, + LA_POLYGLOSSIANAME, + LA_POLYGLOSSIAOPTS, LA_POSTBABELPREAMBLE, LA_PREBABELPREAMBLE, LA_RTL @@ -55,6 +59,7 @@ bool Language::readLanguage(Lexer & lex) // Keep these sorted alphabetically! LexerKeyword languageTags[] = { + { "asbabeloptions", LA_AS_BABELOPTS }, { "babelname", LA_BABELNAME }, { "encoding", LA_ENCODING }, { "end", LA_END }, @@ -62,6 +67,8 @@ bool Language::readLanguage(Lexer & lex) { "internalencoding", LA_INTERNAL_ENC }, { "langcode", LA_LANG_CODE }, { "langvariety", LA_LANG_VARIETY }, + { "polyglossianame", LA_POLYGLOSSIANAME }, + { "polyglossiaopts", LA_POLYGLOSSIAOPTS }, { "postbabelpreamble", LA_POSTBABELPREAMBLE }, { "prebabelpreamble", LA_PREBABELPREAMBLE }, { "rtl", LA_RTL } @@ -90,9 +97,18 @@ bool Language::readLanguage(Lexer & lex) case LA_END: // end of structure finished = true; break; + case LA_AS_BABELOPTS: + lex >> as_babel_options_; + break; case LA_BABELNAME: lex >> babel_; break; + case LA_POLYGLOSSIANAME: + lex >> polyglossia_name_; + break; + case LA_POLYGLOSSIAOPTS: + lex >> polyglossia_opts_; + break; case LA_ENCODING: lex >> encodingStr_; break; @@ -128,6 +144,7 @@ bool Language::readLanguage(Lexer & lex) bool Language::read(Lexer & lex) { + as_babel_options_ = 0; encoding_ = 0; internal_enc_ = 0; rightToLeft_ = 0; @@ -149,6 +166,10 @@ bool Language::read(Lexer & lex) encoding_ = encodings.fromLyXName("iso8859-1"); LYXERR0("Unknown encoding " << encodingStr_); } + // cache translation status. Calling getMessages() directly in + // PrefLanguage::PrefLanguage() did only work if the gui language + // was set to auto (otherwise all languages would be marked as available). + translated_ = getMessages(code()).available(); return true; }