X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flanguage.C;h=c811aac9a9c5bfe41897eb6425d4f1ec54c4f079;hb=7f68b94d8a7fba6942890b7733403192b98b040a;hp=09e4c0e8079c8c4e21973a6c7a2db6692dde7805;hpb=d32d0cbb9552186e0d69ee2320baf2570402fc72;p=lyx.git diff --git a/src/language.C b/src/language.C index 09e4c0e807..c811aac9a9 100644 --- a/src/language.C +++ b/src/language.C @@ -1,80 +1,80 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. +/** + * \file language.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * ====================================================== */ + * \author Lars Gullik Bjønnes + * \author Jean-Marc Lasgouttes + * \author Dekel Tsur + * + * Full author contact details are available in file CREDITS. + */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "language.h" -#include "gettext.h" + +#include "debug.h" #include "encoding.h" -#include "lyxrc.h" -#include "lyx_gui_misc.h" #include "lyxlex.h" -#include "debug.h" +#include "lyxrc.h" using std::endl; +using std::string; + Languages languages; Language const * english_language; Language const * default_language; Language ignore_lang("ignore", "ignore", "Ignore", false, 0, "ignore", ""); Language const * ignore_language = &ignore_lang; -Language inherit_lang("inherit", "inherit", "Inherit", false, 0, "inherit", ""); -Language const * inherit_language = &inherit_lang; - -void Languages::setDefaults() -{ - languagelist["english"] = Language("english", "english", N_("English"), - false, - encodings.getEncoding("iso8859-1"), - "en", ""); - english_language = default_language = &languagelist["english"]; -} +Language latex_lang("latex", "latex", "Latex", false, 0, "latex", ""); +Language const * latex_language = &latex_lang; void Languages::read(string const & filename) { + // We need to set the encoding of latex_lang + latex_lang = Language("latex", "latex", "Latex", false, + encodings.getEncoding("iso8859-1"), + "latex", ""); + LyXLex lex(0, 0); lex.setFile(filename); - while (lex.IsOK()) { - string lang, babel, display, encoding_str, code, latex_options; + while (lex.isOK()) { + string lang; + string babel; + string display; + string encoding_str; + string code; + string latex_options; bool rtl = false; if (lex.next()) - lang = lex.GetString(); + lang = lex.getString(); else break; lyxerr[Debug::INIT] << "Reading language " << lang << endl; if (lex.next()) - babel = lex.GetString(); + babel = lex.getString(); if (lex.next()) - display = lex.GetString(); + display = lex.getString(); if (lex.next()) - rtl = lex.GetBool(); + rtl = lex.getBool(); if (lex.next()) - encoding_str = lex.GetString(); + encoding_str = lex.getString(); if (lex.next()) - code = lex.GetString(); + code = lex.getString(); if (lex.next()) - latex_options = lex.GetString(); + latex_options = lex.getString(); Encoding const * encoding = encodings.getEncoding(encoding_str); if (!encoding) { encoding = encodings.getEncoding("iso8859-1"); - lyxerr << "Unknown encoding " << encoding_str << endl; + lyxerr << "Unknown encoding " << encoding_str << endl; } - languagelist[lang] = Language(lang, babel, display, rtl, + languagelist[lang] = Language(lang, babel, display, rtl, encoding, code, latex_options); } @@ -95,7 +95,7 @@ void Languages::read(string const & filename) Language const * Languages::getLanguage(string const & language) const { - const_iterator it = languagelist.find(language); + const_iterator it = languagelist.find(language); if (it != languagelist.end()) return &it->second; else