3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
27 Language const * english_language;
28 Language const * default_language;
29 Language ignore_lang("ignore", "ignore", "Ignore", false, 0, "ignore", "");
30 Language const * ignore_language = &ignore_lang;
31 Language latex_lang("latex", "latex", "Latex", false, 0, "latex", "");
32 Language const * latex_language = &latex_lang;
34 void Languages::read(string const & filename)
36 // We need to set the encoding of latex_lang
37 latex_lang = Language("latex", "latex", "Latex", false,
38 encodings.getEncoding("iso8859-1"),
42 lex.setFile(filename);
53 lang = lex.getString();
56 lyxerr[Debug::INIT] << "Reading language " << lang << endl;
59 babel = lex.getString();
61 display = lex.getString();
65 encoding_str = lex.getString();
67 code = lex.getString();
69 latex_options = lex.getString();
71 Encoding const * encoding = encodings.getEncoding(encoding_str);
73 encoding = encodings.getEncoding("iso8859-1");
74 lyxerr << "Unknown encoding " << encoding_str << endl;
77 languagelist[lang] = Language(lang, babel, display, rtl,
78 encoding, code, latex_options);
81 default_language = getLanguage(lyxrc.default_language);
82 if (!default_language) {
83 lyxerr << "Default language \"" << lyxrc.default_language
84 << "\" not found!" << endl;
85 default_language = getLanguage("english");
86 if (!default_language)
87 default_language = &(*languagelist.begin()).second;
88 lyxerr << "Using \"" << default_language->lang()
89 << "\" instead!" << endl;
91 english_language = getLanguage("english");
92 if (!english_language)
93 english_language = default_language;
96 Language const * Languages::getLanguage(string const & language) const
98 const_iterator it = languagelist.find(language);
99 if (it != languagelist.end())