Do not crash if user config contains an invalid langage, fixes #1905
This commit is contained in:
parent
73a20508ef
commit
2e14a8fe20
@ -38,6 +38,7 @@
|
|||||||
# include <fribidi/fribidi.h>
|
# include <fribidi/fribidi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "config/user_config.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "utils/constants.hpp"
|
#include "utils/constants.hpp"
|
||||||
#include "utils/log.hpp"
|
#include "utils/log.hpp"
|
||||||
@ -234,13 +235,20 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log::verbose("translation", "Language '%s'.",
|
Language& tgtLang = Language::from_env(language);
|
||||||
Language::from_env(language).get_name().c_str());
|
if (!tgtLang)
|
||||||
|
{
|
||||||
m_current_language_name = Language::from_env(language).get_name() ;
|
Log::warn("Translation", "Unsupported langage '%s'", language.c_str());
|
||||||
|
UserConfigParams::m_language = "system";
|
||||||
m_dictionary = m_dictionary_manager.get_dictionary(
|
m_current_language_name = "Default language";
|
||||||
Language::from_env(language) );
|
m_dictionary = m_dictionary_manager.get_dictionary();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_current_language_name = tgtLang.get_name();
|
||||||
|
Log::verbose("translation", "Language '%s'.", m_current_language_name.c_str());
|
||||||
|
m_dictionary = m_dictionary_manager.get_dictionary(tgtLang);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user