Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LANGUAGE_HPP_INCLUDED
00016 #define LANGUAGE_HPP_INCLUDED
00017
00018 #include "tstring.hpp"
00019 #include "serialization/string_utils.hpp"
00020
00021 #include <iterator>
00022
00023
00024
00025 class config;
00026
00027 struct language_def
00028 {
00029 language_def() :
00030 localename(),
00031 alternates(),
00032 language(),
00033 sort_name(),
00034 rtl(false)
00035 {}
00036
00037 language_def(const std::string& name, const t_string& lang, const std::string& dir,
00038 const std::string &salternates = "", const std::string& sort_name = "") :
00039 localename(name),
00040 alternates(utils::split(salternates)),
00041 language(lang),
00042 sort_name(sort_name.empty() ? std::string(lang) : sort_name),
00043 rtl(dir == "rtl")
00044 {
00045 }
00046
00047 std::string localename;
00048 std::vector<std::string> alternates;
00049 t_string language;
00050 std::string sort_name;
00051 bool rtl;
00052 bool operator== (const language_def&) const;
00053 bool operator< (const language_def& a) const
00054 { return sort_name < a.sort_name; }
00055 };
00056
00057 typedef std::vector<language_def> language_list;
00058
00059 struct symbol_table
00060 {
00061 const t_string& operator[](const std::string& key) const;
00062 const t_string& operator[](const char* key) const;
00063 };
00064
00065
00066
00067
00068 extern symbol_table string_table;
00069
00070
00071
00072 std::vector<language_def> get_languages();
00073
00074
00075
00076
00077
00078 void set_language(const language_def& locale);
00079
00080
00081 const language_def& get_language();
00082 bool current_language_rtl();
00083
00084
00085 const language_def& get_locale();
00086
00087
00088 void init_textdomains(const config& cfg);
00089
00090
00091 bool init_strings(const config& cfg);
00092
00093 bool load_language_list();
00094
00095 #endif