[DEV] add translation module that work

This commit is contained in:
Edouard DUPIN 2014-05-08 13:33:29 +02:00
parent 54cd4828df
commit cb5582c54a
7 changed files with 61 additions and 18 deletions

6
data/translate/EN.json Normal file
View File

@ -0,0 +1,6 @@
{
"FileChooser":"File chooser ...",
"Cancel":"Cancel",
"Validate":"Validate",
"ShowHiddenFiles":"Show hiden files"
}

6
data/translate/FR.json Normal file
View File

@ -0,0 +1,6 @@
{
"FileChooser":"Sélection d'un fichier ...",
"Cancel":"Annuler",
"Validate":"Valider",
"ShowHiddenFiles":"Afficher les fichiers cachés"
}

2
external/agg vendored

@ -1 +1 @@
Subproject commit 31442b4615e43ebda829622b4da4961c32e01f26
Subproject commit 8bf2d17b61989d8fbe01cbd1228147ab52e19d23

2
external/enet vendored

@ -1 +1 @@
Subproject commit 488658aecf730231e265d7d6b6887d00b74f9dec
Subproject commit 77dd712c56d11f1a6e1b98180f2f717dec52ab96

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 467a412ccdfeee3e64ec57c82ba36fda275483b9
Subproject commit 95215e438d27f4ee715a1bf33fa491d89cb98f15

View File

@ -117,6 +117,45 @@ class LocalInstanceTranslation {
if (m_translateLoadad == true) {
return;
}
// start parse language for Major:
auto itMajor = m_listPath.find(m_major);
if (itMajor != m_listPath.end()) {
std::string filename(itMajor->second + "/" + m_language + ".json");
ejson::Document doc;
doc.load(filename);
for (auto element : doc.getKeys()) {
std::string val = doc.getStringValue(element);
m_translate.insert(make_pair(element, val));
}
filename = itMajor->second + "/" + m_languageDefault + ".json";
doc.load(filename);
for (auto element : doc.getKeys()) {
std::string val = doc.getStringValue(element);
auto itTrans = m_translate.find(element);
if (itTrans == m_translate.end()) {
m_translate.insert(make_pair(element, val));
}
}
}
// start parse language:
for (auto &it : m_listPath) {
if (it.first == m_major) {
continue;
}
std::string filename(it.second + "/" + m_languageDefault + ".json");
if (etk::FSNodeExist(filename) == false) {
continue;
}
ejson::Document doc;
doc.load(filename);
for (auto element : doc.getKeys()) {
std::string val = doc.getStringValue(element);
auto itTrans = m_translate.find(element);
if (itTrans == m_translate.end()) {
m_translate.insert(make_pair(element, val));
}
}
}
// start parse default language:
for (auto &it : m_listPath) {
if (it.first == m_major) {
@ -128,22 +167,14 @@ class LocalInstanceTranslation {
}
ejson::Document doc;
doc.load(filename);
}
// start parse default language for Major:
auto itMajor = m_listPath.find(m_major);
if (itMajor != m_listPath.end()) {
}
// start parse language:
for (auto &it : m_listPath) {
if (it.first == m_major) {
continue;
for (auto element : doc.getKeys()) {
std::string val = doc.getStringValue(element);
auto itTrans = m_translate.find(element);
if (itTrans == m_translate.end()) {
m_translate.insert(make_pair(element, val));
}
}
}
// start parse language for Major:
if (itMajor != m_listPath.end()) {
}
}
};

View File

@ -99,7 +99,7 @@ ewol::widget::FileChooser::FileChooser(void) {
+ " <entry name='[" + std::to_string(getId()) + "]file-shooser:entry-folder' expand='true,false' fill='true,false'/>\n"
+ " <image name='[" + std::to_string(getId()) + "]file-shooser:img-home' src='THEME:GUI:Home.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " </sizer>\n"
+ " <label name='[" + std::to_string(getId()) + "]file-shooser:title-label'>" + TRANSLATE("Cancel") + "</label>\n"
+ " <label name='[" + std::to_string(getId()) + "]file-shooser:title-label'>" + TRANSLATE("FileChooser") + "</label>\n"
+ " </sizer>\n"
+ "</popup>";
loadFromString(myDescription);