merge with Dev

This commit is contained in:
Desmis
2018-02-10 17:24:11 +01:00
6 changed files with 229 additions and 233 deletions

View File

@@ -219,13 +219,6 @@ int processLineParams ( int argc, char **argv )
bool init_rt()
{
try {
Options::load();
} catch (Options::Error &e) {
std::cout << "ERROR: " << e.get_msg() << std::endl;
return false;
}
extProgStore->init();
SoundManager::init();
@@ -488,9 +481,6 @@ int main (int argc, char **argv)
argv2 = "";
Glib::init(); // called by Gtk::Main, but this may be important for thread handling, so we call it ourselves now
gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave)));
gdk_threads_init();
gtk_init (&argc, &argv); // use the "--g-fatal-warnings" command line flag to make warnings fatal
Gio::init ();
@@ -531,7 +521,7 @@ int main (int argc, char **argv)
}
options.rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH;
#else
argv0 = DATA_SEARCH_PATH;
creditsPath = CREDITS_SEARCH_PATH;
@@ -650,6 +640,19 @@ int main (int argc, char **argv)
int ret = 0;
try {
Options::load();
} catch (Options::Error &e) {
std::cout << "ERROR: " << e.get_msg() << std::endl;
std::cerr << "Fatal error!" << std::endl;
std::cerr << "The RT_SETTINGS and/or RT_PATH environment variables are set, but use a relative path. The path must be absolute!" << std::endl;
return -2;
}
gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave)));
gdk_threads_init();
gtk_init (&argc, &argv); // use the "--g-fatal-warnings" command line flag to make warnings fatal
if (remote) {
char *app_argv[2] = { const_cast<char *> (argv0.c_str()) };
int app_argc = 1;

View File

@@ -19,6 +19,7 @@
#include "multilangmgr.h"
#include <fstream>
#include <glib.h>
#ifdef WIN32
#include <windows.h>
@@ -38,30 +39,30 @@ struct LocaleToLang : private std::map<std::pair<Glib::ustring, Glib::ustring>,
LocaleToLang ()
{
emplace (key ("ca"), "Catala");
emplace (key ("cs"), "Czech");
emplace (key ("da"), "Dansk");
emplace (key ("de"), "Deutsch");
emplace (key ("es"), "Espanol");
emplace (key ("eu"), "Euskara");
emplace (key ("fr"), "Francais");
emplace (key ("el"), "Greek");
emplace (key ("he"), "Hebrew");
emplace (key ("it"), "Italiano");
emplace (key ("ja"), "Japanese");
emplace (key ("lv"), "Latvian");
emplace (key ("hu"), "Magyar");
emplace (key ("nl"), "Nederlands");
emplace (key ("nn"), "Norsk BM");
emplace (key ("nb"), "Norsk BM");
emplace (key ("pl"), "Polish");
emplace (key ("pt"), "Portugues (Brasil)");
emplace (key ("ru"), "Russian");
emplace (key ("sr"), "Serbian (Cyrilic Characters)");
emplace (key ("sk"), "Slovak");
emplace (key ("fi"), "Suomi");
emplace (key ("sv"), "Swedish");
emplace (key ("tr"), "Turkish");
emplace (key ("ca", "ES"), "Catala");
emplace (key ("cs", "CZ"), "Czech");
emplace (key ("da", "DK"), "Dansk");
emplace (key ("de", "DE"), "Deutsch");
emplace (key ("es", "ES"), "Espanol");
emplace (key ("eu", "ES"), "Euskara");
emplace (key ("fr", "FR"), "Francais");
emplace (key ("el", "GR"), "Greek");
emplace (key ("he", "IL"), "Hebrew");
emplace (key ("it", "IT"), "Italiano");
emplace (key ("ja", "JP"), "Japanese");
emplace (key ("lv", "LV"), "Latvian");
emplace (key ("hu", "HU"), "Magyar");
emplace (key ("nl", "NL"), "Nederlands");
emplace (key ("nn", "NO"), "Norsk BM");
emplace (key ("nb", "NO"), "Norsk BM");
emplace (key ("pl", "PL"), "Polish");
emplace (key ("pt", "PT"), "Portugues (Brasil)");
emplace (key ("ru", "RU"), "Russian");
emplace (key ("sr", "RS"), "Serbian (Cyrilic Characters)");
emplace (key ("sk", "SK"), "Slovak");
emplace (key ("fi", "FI"), "Suomi");
emplace (key ("sv", "SE"), "Swedish");
emplace (key ("tr", "TR"), "Turkish");
emplace (key ("zh", "CN"), "Chinese (Simplified)");
emplace (key ("zh", "SG"), "Chinese (Traditional)");
}
@@ -114,12 +115,19 @@ const LocaleToLang localeToLang;
void setGtkLanguage(const Glib::ustring &language)
{
auto l = localeToLang.getLocale(language);
#ifdef WIN32
putenv(("LANG=" + l).c_str());
#else
setenv("LANG", l.c_str(), true);
#endif
std::string lang = localeToLang.getLocale(language);
const gchar *env_langc = g_getenv("LANG");
if(env_langc) {
const std::string env_lang(env_langc);
if (!env_lang.empty()) {
const std::string::size_type suffix_pos = env_lang.find_first_of(".");
if (suffix_pos != std::string::npos) {
lang += env_lang.substr(suffix_pos);
}
}
}
g_setenv("LANG", lang.c_str(), true);
}
}