32 lines
516 B
C++
32 lines
516 B
C++
#ifndef TR_H
|
|
#define TR_H
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
typedef std::unordered_map<std::string, std::string> Translations_t;
|
|
|
|
class tr
|
|
{
|
|
private:
|
|
std::unordered_map<std::string, Translations_t *> _translations;
|
|
std::string _lang;
|
|
|
|
private:
|
|
void add(const char *sentence, ...);
|
|
|
|
public:
|
|
const char *translate(const char *str);
|
|
|
|
public:
|
|
void setLang(const std::string &l);
|
|
|
|
public:
|
|
tr();
|
|
};
|
|
|
|
const char *_(const char *str);
|
|
void setLang(const std::string &lang);
|
|
|
|
#endif // TR_H
|