60 #ifdef ENABLE_CUSTOMNLS
61 void TranslationManager::loadGettextLang()
63 delete mainTranslator;
76 const std::string &subName,
95 return parser.
load(name, subName + name, dict);
96 logger->
log(
"can't find client data translation");
106 if ((dict ==
nullptr) ||
fileName.empty())
113 if (fileContents ==
nullptr)
118 std::string str = std::string(fileContents, contentsLength);
120 size_t oldPos1 = std::string::npos;
123 while ((pos1 = str.find(
"<<")) != std::string::npos)
127 const size_t pos2 = str.find(
">>", pos1 + 2);
128 if (pos2 == std::string::npos)
130 const std::string key(str.substr(pos1 + 2, pos2 - pos1 - 2));
131 const std::string key2(
"<<" + str.substr(
132 pos1 + 2, pos2 - pos1 - 2) +
">>");
133 const std::string val(dict->
getStr(key));
138 std::istringstream iss(str);
141 while (getline(iss, line))
142 lines.push_back(line);
144 delete [] fileContents;
153 revDict->
set((*it).second, (*it).first);
void log(const char *const log_text,...)
const std::string getStr(const std::string &str)
void set(const std::string &key, const std::string &value)
PoDict * load(const std::string &lang, const std::string &fileName, PoDict *const dict)
static PoDict * getEmptyDict()
static bool checkLang(const std::string &lang)
static void loadCurrentLang()
static PoDict * reverseLang(const PoDict *const dict)
static PoDict * loadLang(const LangVect &lang, const std::string &subName, PoDict *const dict)
static bool translateFile(const std::string &fileName, PoDict *const dict, StringVect &lines)
static void loadDictionaryLang()
#define FOR_EACH(type, iter, array)
LangVect::const_iterator LangIter
std::vector< std::string > LangVect
const char * loadFile(std::string filename, int &fileSize)
PoDict * reverseDictionary
std::string & replaceAll(std::string &context, const std::string &from, const std::string &to)
std::vector< std::string > StringVect