[DEV] continue removing STL
This commit is contained in:
parent
64c33467e1
commit
af2bfb5e0a
@ -9,6 +9,8 @@
|
|||||||
#include <etk/Map.hpp>
|
#include <etk/Map.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <etk/os/FSNode.hpp>
|
||||||
#include <ejson/ejson.hpp>
|
#include <ejson/ejson.hpp>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
|
||||||
class LocalInstanceTranslation {
|
class LocalInstanceTranslation {
|
||||||
private:
|
private:
|
||||||
@ -28,12 +30,7 @@ class LocalInstanceTranslation {
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void addPath(const etk::String& _lib, const etk::String& _path, bool _major) {
|
void addPath(const etk::String& _lib, const etk::String& _path, bool _major) {
|
||||||
auto it = m_listPath.find(_lib);
|
m_listPath.set(_lib, _path);
|
||||||
if (it == m_listPath.end()) {
|
|
||||||
m_listPath.insert(make_pair(_lib, _path));
|
|
||||||
} else {
|
|
||||||
it->second = _path;
|
|
||||||
}
|
|
||||||
if (_major == true) {
|
if (_major == true) {
|
||||||
m_major = _lib;
|
m_major = _lib;
|
||||||
ETRANSLATE_INFO("Change major translation : '" << m_major << "'");
|
ETRANSLATE_INFO("Change major translation : '" << m_major << "'");
|
||||||
@ -154,16 +151,13 @@ class LocalInstanceTranslation {
|
|||||||
doc.load(filename);
|
doc.load(filename);
|
||||||
for (auto element : doc.getKeys()) {
|
for (auto element : doc.getKeys()) {
|
||||||
etk::String val = doc[element].toString().get();
|
etk::String val = doc[element].toString().get();
|
||||||
m_translate.insert(make_pair(element, val));
|
m_translate.set(element, val);
|
||||||
}
|
}
|
||||||
filename = itMajor->second + "/" + m_languageDefault + ".json";
|
filename = itMajor->second + "/" + m_languageDefault + ".json";
|
||||||
doc.load(filename);
|
doc.load(filename);
|
||||||
for (auto element : doc.getKeys()) {
|
for (auto element : doc.getKeys()) {
|
||||||
etk::String val = doc[element].toString().get();
|
etk::String val = doc[element].toString().get();
|
||||||
auto itTrans = m_translate.find(element);
|
m_translate.set(element, val);
|
||||||
if (itTrans == m_translate.end()) {
|
|
||||||
m_translate.insert(make_pair(element, val));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// start parse language:
|
// start parse language:
|
||||||
@ -179,10 +173,7 @@ class LocalInstanceTranslation {
|
|||||||
doc.load(filename);
|
doc.load(filename);
|
||||||
for (auto element : doc.getKeys()) {
|
for (auto element : doc.getKeys()) {
|
||||||
etk::String val = doc[element].toString().get();
|
etk::String val = doc[element].toString().get();
|
||||||
auto itTrans = m_translate.find(element);
|
m_translate.set(element, val);
|
||||||
if (itTrans == m_translate.end()) {
|
|
||||||
m_translate.insert(make_pair(element, val));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// start parse default language:
|
// start parse default language:
|
||||||
@ -198,10 +189,7 @@ class LocalInstanceTranslation {
|
|||||||
doc.load(filename);
|
doc.load(filename);
|
||||||
for (auto element : doc.getKeys()) {
|
for (auto element : doc.getKeys()) {
|
||||||
etk::String val = doc[element].toString().get();
|
etk::String val = doc[element].toString().get();
|
||||||
auto itTrans = m_translate.find(element);
|
m_translate.set(element, val);
|
||||||
if (itTrans == m_translate.end()) {
|
|
||||||
m_translate.insert(make_pair(element, val));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,12 +285,12 @@ void etranslate::autoDetectLanguage() {
|
|||||||
etk::String userLocalName;
|
etk::String userLocalName;
|
||||||
etk::String globalLocalName;
|
etk::String globalLocalName;
|
||||||
try {
|
try {
|
||||||
nonameLocalName = std::locale(std::locale(), new std::ctype<char>).name();
|
nonameLocalName = setlocale(LC_ALL, "");
|
||||||
userLocalName = std::locale("").name();
|
userLocalName = setlocale(LC_MESSAGES, "");
|
||||||
globalLocalName = std::locale().name();
|
globalLocalName = setlocale(LC_CTYPE, "");
|
||||||
ETRANSLATE_VERBOSE(" The default locale is '" << globalLocalName << "'");
|
ETRANSLATE_ERROR(" The default locale is '" << globalLocalName << "'");
|
||||||
ETRANSLATE_VERBOSE(" The user's locale is '" << userLocalName << "'");
|
ETRANSLATE_ERROR(" The user's locale is '" << userLocalName << "'");
|
||||||
ETRANSLATE_VERBOSE(" A nameless locale is '" << nonameLocalName << "'");
|
ETRANSLATE_ERROR(" A nameless locale is '" << nonameLocalName << "'");
|
||||||
} catch (std::runtime_error e) {
|
} catch (std::runtime_error e) {
|
||||||
ETRANSLATE_ERROR("Can not get Locals ==> set English ...");
|
ETRANSLATE_ERROR("Can not get Locals ==> set English ...");
|
||||||
nonameLocalName = "EN";
|
nonameLocalName = "EN";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user