20#ifndef HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP
21#define HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP
27#include <unordered_map>
42 typedef std::unordered_map<Language, Dictionary*, Language_hash>
Dictionaries;
86 void add_directory(
const std::string& pathname,
bool precedence =
false);
Manager class for dictionaries, you give it a bunch of directories with .po files and it will then au...
Definition: dictionary_manager.hpp:40
void set_use_fuzzy(bool t)
Definition: dictionary_manager.cpp:225
Dictionaries dictionaries
Definition: dictionary_manager.hpp:43
std::string charset
Definition: dictionary_manager.hpp:48
DictionaryManager(const DictionaryManager &)
void set_filesystem(std::unique_ptr< FileSystem > filesystem)
Definition: dictionary_manager.cpp:259
void add_directory(const std::string &pathname, bool precedence=false)
Add a directory to the search path for dictionaries, earlier added directories have higher priority t...
Definition: dictionary_manager.cpp:238
~DictionaryManager()
Definition: dictionary_manager.cpp:57
Dictionary * current_dict
Definition: dictionary_manager.hpp:52
Dictionary empty_dict
Definition: dictionary_manager.hpp:54
bool use_fuzzy
Definition: dictionary_manager.hpp:49
std::string convertFilename2Language(const std::string &s_in) const
This function converts a .po filename (e.g.
Definition: dictionary_manager.cpp:271
void clear_cache()
Definition: dictionary_manager.cpp:66
void set_charset(const std::string &charset)
Set a charset that will be set on the returned dictionaries.
Definition: dictionary_manager.cpp:218
bool get_use_fuzzy() const
Definition: dictionary_manager.cpp:232
Language current_language
Definition: dictionary_manager.hpp:51
Language get_language() const
returns the (normalized) country code of the currently used language
Definition: dictionary_manager.cpp:212
std::unique_ptr< FileSystem > filesystem
Definition: dictionary_manager.hpp:56
void set_language(const Language &language)
Set a language based on a four? letter country code.
Definition: dictionary_manager.cpp:202
std::set< Language > get_languages()
Return a set of the available languages in their country code.
Definition: dictionary_manager.cpp:182
void remove_directory(const std::string &pathname)
Remove a directory from the search path.
Definition: dictionary_manager.cpp:248
SearchPath search_path
Definition: dictionary_manager.hpp:46
DictionaryManager(const std::string &charset_="UTF-8")
Definition: dictionary_manager.cpp:45
DictionaryManager & operator=(const DictionaryManager &)
Dictionary & get_dictionary()
Return the currently active dictionary, if none is set, an empty dictionary is returned.
Definition: dictionary_manager.cpp:78
std::unordered_map< Language, Dictionary *, Language_hash > Dictionaries
Definition: dictionary_manager.hpp:42
std::deque< std::string > SearchPath
Definition: dictionary_manager.hpp:45
A simple dictionary class that mimics gettext() behaviour.
Definition: dictionary.hpp:35
Lightweight wrapper around LanguageSpec.
Definition: language.hpp:32