class EE::System::Translator

#include <translator.hpp>

class Translator {
public:
    // typedefs

    typedef std::unordered_map<std::string, String> StringDictionary;
    typedef std::unordered_map<std::string, StringDictionary> StringLocaleDictionary;

    // methods

    bool loadFromDirectory(std::string dirPath, std::string ext = "xml");
    bool loadFromFile(const std::string& path, std::string lang = "");
    bool loadFromString(const std::string& string, std::string lang = "");
    bool loadFromMemory(const void* buffer, Int32 bufferSize, std::string lang = "");
    bool loadFromStream(IOStream& stream, std::string lang = "");
    bool loadFromPack(Pack* pack, const std::string& FilePackPath, std::string lang = "");
    String getString(const std::string& key, const String& defaultValue = String());
    void setString(const std::string& lang, const std::string& key, const String& val);

    template <typename... Args>
    String getStringf(const char* key, Args&&... args);

    std::string getDefaultLanguage() const;
    void setDefaultLanguage(const std::string& defaultLanguage);
    std::string getCurrentLanguage() const;
    void setCurrentLanguage(const std::string& currentLanguage);
    void setSaveDefaultValues(bool set);
    bool isSetDefaultValues() const;
    void saveToStream(IOStream& stream, std::string lang = "");
    const StringLocaleDictionary& getDictionary() const;
    StringLocaleDictionary& getDictionary();
    void setLanguageName(const std::string& id, const std::string& name);
    std::unordered_map<std::string, std::string> getLanguageNames() const;
};