wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src game.cpp editor/editor_main.cpp


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src game.cpp editor/editor_main.cpp
Date: Sun, 31 Oct 2004 19:39:13 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    04/11/01 00:29:51

Modified files:
        src            : game.cpp 
        src/editor     : editor_main.cpp 

Log message:
        delayed initialization of gettext system until command-line has been 
parsed and get_intl_dir() returns what we expect it to

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.155&tr2=1.156&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_main.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text

Patches:
Index: wesnoth/src/editor/editor_main.cpp
diff -u wesnoth/src/editor/editor_main.cpp:1.20 
wesnoth/src/editor/editor_main.cpp:1.21
--- wesnoth/src/editor/editor_main.cpp:1.20     Mon Sep 13 18:48:07 2004
+++ wesnoth/src/editor/editor_main.cpp  Mon Nov  1 00:29:51 2004
@@ -34,16 +34,6 @@
 
 int main(int argc, char** argv)
 {
-       setlocale (LC_ALL, "");
-
-       const std::string& intl_dir = get_intl_dir();
-       bindtextdomain (PACKAGE "-editor", intl_dir.c_str());
-       bind_textdomain_codeset (PACKAGE "-editor", "UTF-8");
-       bindtextdomain (PACKAGE "-lib", intl_dir.c_str());
-       bind_textdomain_codeset (PACKAGE "-lib", "UTF-8");
-
-       textdomain (PACKAGE "-editor");
-
        game_config::editor = true;
 
        int arg;
@@ -141,6 +131,15 @@
                        }
                }
        }
+
+       setlocale (LC_ALL, "");
+       const std::string& intl_dir = get_intl_dir();
+       bindtextdomain (PACKAGE "-editor", intl_dir.c_str());
+       bind_textdomain_codeset (PACKAGE "-editor", "UTF-8");
+       bindtextdomain (PACKAGE "-lib", intl_dir.c_str());
+       bind_textdomain_codeset (PACKAGE "-lib", "UTF-8");
+       textdomain (PACKAGE "-editor");
+
        // Blatant cut and paste from game.cpp
        image::set_wm_icon();
        int video_flags = preferences::fullscreen() ? FULL_SCREEN : 0;
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.155 wesnoth/src/game.cpp:1.156
--- wesnoth/src/game.cpp:1.155  Sun Oct 31 20:42:16 2004
+++ wesnoth/src/game.cpp        Mon Nov  1 00:29:51 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.155 2004/10/31 20:42:16 gruikya Exp $ */
+/* $Id: game.cpp,v 1.156 2004/11/01 00:29:51 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -430,6 +430,7 @@
                        throw config::error("unknown option");
                } else {
 
+                 std::cerr << "Setting path using " << val;
                        if(val[0] == '/') {
                                game_config::path = val;
                        } else {
@@ -1422,6 +1423,19 @@
 
        game_controller game(argc,argv,use_sound);
 
+       // I would prefer to setup locale first so that early error
+       // messages can get localized, but we need the game_controller
+       // initialized to have get_intl_dir() to work.  Note: this
+       // setlocale() but this does not take GUI language setting
+       // into account.
+       setlocale (LC_ALL, "");
+       const std::string& intl_dir = get_intl_dir();
+       bindtextdomain (PACKAGE, intl_dir.c_str());
+       bind_textdomain_codeset (PACKAGE, "UTF-8");
+       bindtextdomain (PACKAGE "-lib", intl_dir.c_str());
+       bind_textdomain_codeset (PACKAGE "-lib", "UTF-8");
+       textdomain (PACKAGE);
+
        bool res;
 #ifdef WIN32
        res = game.init_config();
@@ -1528,27 +1542,15 @@
 
 int main(int argc, char** argv)
 {
-       // setup locale first so that early error messages can get localized
-       // but this does not take GUI language setting into account
-       setlocale (LC_ALL, "");
-
-       const std::string& intl_dir = get_intl_dir();
-       bindtextdomain (PACKAGE, intl_dir.c_str());
-       bind_textdomain_codeset (PACKAGE, "UTF-8");
-       bindtextdomain (PACKAGE "-lib", intl_dir.c_str());
-       bind_textdomain_codeset (PACKAGE "-lib", "UTF-8");
-
-       textdomain (PACKAGE);
-
        try {
                std::cerr << "started game: " << SDL_GetTicks() << "\n";
                const int res = play_game(argc,argv);
                std::cerr << "exiting with code " << res << "\n";
                return res;
        } catch(CVideo::error&) {
-               std::cerr << _("Could not initialize video. Exiting.\n");
+               std::cerr << "Could not initialize video. Exiting.\n";
        } catch(font::manager::error&) {
-               std::cerr << _("Could not initialize fonts. Exiting.\n");
+               std::cerr << "Could not initialize fonts. Exiting.\n";
        } catch(config::error& e) {
                std::cerr << e.message << "\n";
        } catch(gui::button::error&) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]