4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * \author Jürgen Vigna
12 * Full author contact details are available in file CREDITS.
24 namespace support { class FileName; }
33 Language() : rightToLeft_(false) {}
35 std::string const & lang() const { return lang_; }
37 std::string const & babel() const { return babel_; }
39 std::string const & display() const { return display_; }
41 bool rightToLeft() const { return rightToLeft_; }
43 Encoding const * encoding() const { return encoding_; }
45 std::string const & encodingStr() const { return encodingStr_; }
47 std::string const & code() const { return code_; }
48 /// set code (needed for rc.spellchecker_alt_lang)
49 void setCode(std::string const c) { code_ = c; }
51 std::string const & variety() const { return variety_; }
52 /// set variety (needed for rc.spellchecker_alt_lang)
53 void setVariety(std::string const v) { variety_ = v; }
55 std::string const & babel_postsettings() const { return babel_postsettings_; }
57 bool internalFontEncoding() const { return internal_enc_; }
59 bool read(Lexer & lex);
61 bool readLanguage(Lexer & lex);
62 // for the use in std::map
63 friend bool operator<(Language const & p, Language const & q);
74 std::string encodingStr_;
76 Encoding const * encoding_;
82 std::string babel_postsettings_;
88 inline bool operator<(Language const & p, Language const & q)
90 return q.lang() > p.lang();
98 typedef std::map<std::string, Language> LanguageList;
100 typedef LanguageList::const_iterator const_iterator;
102 typedef LanguageList::size_type size_type;
104 void read(support::FileName const & filename);
106 Language const * getLanguage(std::string const & language) const;
108 size_type size() const { return languagelist.size(); }
110 const_iterator begin() const { return languagelist.begin(); }
112 const_iterator end() const { return languagelist.end(); }
117 LanguageList languagelist;
120 /// Global singleton instance.
121 extern Languages languages;
122 /// Default language defined in LyXRC
123 extern Language const * default_language;
124 /// Used to indicate that the language should be left unchanged when
125 /// applying a font change.
126 extern Language const * ignore_language;
127 /// Default language defined in LyXRC
128 extern Language const * latex_language;
129 /// Used to indicate that the language should be reset to the Buffer
130 // language when applying a font change.
131 extern Language const * reset_language;