metaforce/specter/include/Specter/Translator.hpp

37 lines
982 B
C++
Raw Normal View History

#ifndef SPECTER_TRANSLATOR_HPP
#define SPECTER_TRANSLATOR_HPP
#include <string>
#include <Athena/DNAYaml.hpp>
namespace Specter
{
class Locale
{
std::string m_name;
std::string m_fullName;
std::unique_ptr<Athena::io::YAMLNode> m_rootNode;
2015-12-31 03:19:03 +00:00
const Athena::io::YAMLNode* m_langNode;
public:
Locale(const std::string& name, const std::string& fullName,
const unsigned char* yamlSource, size_t yamlLength);
const std::string& name() const {return m_name;}
const std::string& fullName() const {return m_fullName;}
const Athena::io::YAMLNode* rootNode() const {return m_langNode;}
};
class Translator
{
const Locale* m_targetLocale;
public:
Translator(const Locale* targetLocale) {setLocale(targetLocale);}
void setLocale(const Locale* targetLocale);
2015-12-31 03:19:03 +00:00
const std::string* translate(const std::string& key) const;
std::string translateOr(const std::string& key, const char* vor) const;
};
}
#endif // SPECTER_TRANSLATOR_HPP