[DEBUG] correct the language translation error

This commit is contained in:
Edouard DUPIN 2016-10-13 21:08:15 +02:00
parent ccaf9e4bba
commit adbc99df96
4 changed files with 34 additions and 5 deletions

View File

@ -104,7 +104,6 @@ namespace ewol {
*/
void forceRedrawAll();
// TODO : Later ...
/**
* @brief This is to transfert the event from one widget to another one
* @param source the widget where the event came from

View File

@ -145,6 +145,7 @@ class LocalInstanceTranslation {
if (m_translateLoadad == true) {
return;
}
EWOL_VERBOSE("Load Translation MAJOR='" << m_major << "' LANG='" << m_language << "' default=" << m_languageDefault );
// start parse language for Major:
auto itMajor = m_listPath.find(m_major);
if (itMajor != m_listPath.end()) {
@ -237,7 +238,35 @@ const std::string& ewol::translate::getLanguage() {
}
void ewol::translate::autoDetectLanguage() {
EWOL_INFO("Auto-detect language of system");
EWOL_VERBOSE("Auto-detect language of system");
std::string nonameLocalName = std::locale(std::locale(), new std::ctype<char>).name();
std::string userLocalName = std::locale("").name();
std::string globalLocalName = std::locale().name();
EWOL_VERBOSE(" The default locale is '" << globalLocalName << "'");
EWOL_VERBOSE(" The user's locale is '" << userLocalName << "'");
EWOL_VERBOSE(" A nameless locale is '" << nonameLocalName << "'");
std::string lang = nonameLocalName;
if ( lang == "*"
|| lang == "") {
lang = userLocalName;
}
if ( lang == "*"
|| lang == "") {
lang = globalLocalName;
}
if ( lang == "C"
|| lang == ""
|| lang.size() < 2) {
lang = "EN";
}
lang = std::string(lang.begin(), lang.begin()+2);
lang = etk::toupper(lang);
EWOL_INFO("Select Language : '" << lang << "'");
getInstanceTranslation().setLanguage(lang);
return;
// dead code ...
#if defined(__TARGET_OS__Linux)
char *s = getenv("LANG");
if (s == nullptr || strlen(s) < 2) {
@ -251,6 +280,7 @@ void ewol::translate::autoDetectLanguage() {
}
#else
EWOL_INFO("Can not auto-detect language ...");
getInstanceTranslation().setLanguage("EN");
#endif
}

View File

@ -73,7 +73,7 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
// nothing to do ...
return;
}
EWOL_VERBOSE("focusKeep=" << _newWidget->getId() );
EWOL_DEBUG("focusKeep=" << _newWidget->getId() );
//elog::displayBacktrace();
auto focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (_newWidget == focusWidgetCurrent) {

View File

@ -49,7 +49,7 @@ void appl::MainWindows::init() {
externSubBind(m_composer, ewol::widget::Button, "appl-move", signalPressed, sharedFromThis(), &appl::MainWindows::onCallbackMove);
externSubBind(m_composer, ewol::widget::Button, "appl-full-screen", signalValue, sharedFromThis(), &appl::MainWindows::onCallbackFullScreen);
m_listConnection.push_back(getObjectManager().periodicCall.connect(this, &appl::MainWindows::forceFocusCall));
//m_listConnection.push_back(getObjectManager().periodicCall.connect(this, &appl::MainWindows::forceFocusCall));
keepFocus();
//shortCutAdd("F12", "menu:reloade-shader");
//signalShortcut.connect(sharedFromThis(), &appl::MainWindows::onCallbackShortCut);
@ -118,6 +118,6 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
}
void appl::MainWindows::forceFocusCall(const ewol::event::Time& _event) {
keepFocus();
//keepFocus();
}