Reverted part of revision 02c347cdae86.
[supertux.git] / src / supertux / main.cpp
index 41dc622..d878c29 100644 (file)
@@ -23,6 +23,9 @@
 #include <binreloc.h>
 #include <tinygettext/log.hpp>
 #include <boost/format.hpp>
+extern "C" {
+#include <findlocale.h>
+}
 
 #include "supertux/main.hpp"
 
@@ -84,6 +87,12 @@ Main::init_tinygettext()
   if (g_config->locale != "") 
   {
     dictionary_manager->set_language(tinygettext::Language::from_name(g_config->locale));
+  } else {
+    FL_Locale *locale;
+    FL_FindLocale(&locale);
+    tinygettext::Language language = tinygettext::Language::from_spec( locale->lang?locale->lang:"", locale->country?locale->country:"", locale->variant?locale->variant:"");
+    FL_FreeLocale(&locale);
+    dictionary_manager->set_language(language);
   }
 }
 
@@ -573,8 +582,8 @@ Main::run(int argc, char** argv)
     if(pre_parse_commandline(argc, argv))
       return 0;
 
-    Console::instance = new Console();
     init_sdl();
+    Console::instance = new Console();
 
     timelog("controller");
     g_jk_controller = new JoystickKeyboardController();
@@ -582,23 +591,20 @@ Main::run(int argc, char** argv)
     timelog("config");
     init_config();
 
-    timelog("addons");
-    AddonManager::get_instance().load_addons();
-
-    timelog("tinygettext");
-    init_tinygettext();
-
     timelog("commandline");
     if(parse_commandline(argc, argv))
       return 0;
 
-    timelog("audio");
-    init_audio();
-
     timelog("video");
     DrawingContext context;
     context_pointer = &context;
     init_video();
+    
+    timelog("audio");
+    init_audio();
+    
+    timelog("tinygettext");
+    init_tinygettext();
 
     Console::instance->init_graphics();
 
@@ -607,6 +613,9 @@ Main::run(int argc, char** argv)
 
     timelog("resources");
     Resources::load_shared();
+    
+    timelog("addons");
+    AddonManager::get_instance().load_addons();
 
     timelog(0);