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

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

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


From: Isaac Clerencia
Subject: [Wesnoth-cvs-commits] wesnoth src/editor/editor.cpp src/editor/editor...
Date: Thu, 02 Sep 2004 07:39:33 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Isaac Clerencia <address@hidden>        04/09/02 11:34:28

Modified files:
        src/editor     : editor.cpp editor_dialogs.cpp editor_main.cpp 
                         editor_palettes.cpp 
        data/translations: english.cfg 

Log message:
        First steps towards a gettext translatable editor ;)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.80&tr2=1.81&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_dialogs.cpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_main.cpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/translations/english.cfg.diff?tr1=1.160&tr2=1.161&r1=text&r2=text

Patches:
Index: wesnoth/data/translations/english.cfg
diff -u wesnoth/data/translations/english.cfg:1.160 
wesnoth/data/translations/english.cfg:1.161
--- wesnoth/data/translations/english.cfg:1.160 Sun Aug 29 20:33:01 2004
+++ wesnoth/data/translations/english.cfg       Thu Sep  2 11:34:28 2004
@@ -179,14 +179,6 @@
 #Map editor strings.
 
 edit_choose_file_save_as= _ "Choose a File to Save As"
-edit_save_as_confirm_overwrite= _ "The map already exists. Do you want to 
overwrite it?"
-edit_which_player_title= _ "Which Player?"
-edit_which_player= _ "Which player should start here?"
-edit_choose_map_to_load= _ "Choose a Map to Load"
-edit_not_valid_map= _ "The file does not contain a valid map."
-edit_file_not_exists_or_cant_be_read= _ "'$filename' does not exist or can not 
be read as a file."
-edit_load_failed= _ "Load failed: "
-edit_must_have_hex_selected= _ "You must have a hex selected on the board."
 edit_save_before_quit= _ "Do you want to save the map before quitting?"
 edit_save_confirmed= _ "Map saved."
 edit_save_failed= _ "Could not save the map: $msg"
@@ -198,13 +190,8 @@
 edit_random_generator_settings= _ "Random Generator Settings"
 edit_map_creation_failed= _ "Map creation failed."
 edit_resize_map_title= _ "Resize Map"
-edit_x_axis= _ "X-Axis"
-edit_y_axis= _ "Y-Axis"
-edit_flip_around= _ "Flip around (this may change the dimensions of the map):"
 edit_operations_menu= _ "Edit"
 edit_main_menu= _ "File"
-edit_foreground_short= _ "FG"
-edit_background_short= _ "BG"
 
 show_next_tip= _ "Next tip"
 tip_of_day= _ "Tip of the Day"
Index: wesnoth/src/editor/editor.cpp
diff -u wesnoth/src/editor/editor.cpp:1.80 wesnoth/src/editor/editor.cpp:1.81
--- wesnoth/src/editor/editor.cpp:1.80  Sun Jun 20 21:31:31 2004
+++ wesnoth/src/editor/editor.cpp       Thu Sep  2 11:34:27 2004
@@ -309,11 +309,11 @@
        int overwrite = 0;
        do {
                res = dialogs::show_file_chooser_dialog(gui_, input_name,
-                                                                               
                translate_string("edit_choose_file_save_as"));
+                                                                               
                _("Choose a Map to Load"));
                if (res == 0) {
                        if (file_exists(input_name)) {
                                overwrite = gui::show_dialog(gui_, NULL,
-                                                                               
         "", translate_string("edit_save_as_confirm_overwrite"),
+                                                                               
         "", _("The map already exists. Do you want to overwrite it?"),
                                                                                
         gui::YES_NO);
                        }
                        else
@@ -334,8 +334,8 @@
                str << "Player " << i;
                players.push_back(str.str());
        }
-       const int res = gui::show_dialog(gui_, NULL, 
translate_string("edit_which_player_title"),
-                                                                        
translate_string("edit_which_player"),
+       const int res = gui::show_dialog(gui_, NULL, _("Which Player?"),
+                                                                        
_("Which player should start here?"),
                                                                         
gui::OK_CANCEL, &players);
        if (res >= 0) {
                set_starting_position(res, selected_hex_);
@@ -386,7 +386,7 @@
        std::string fn = filename_ == "" ?
                get_dir(get_dir(get_user_data_dir() + "/editor") + "/maps/") : 
filename_;
        int res = dialogs::show_file_chooser_dialog(gui_, fn,
-                                                                               
                translate_string("edit_choose_map_to_load"));
+                                                                               
                _("Choose a Map to Load"));
        if (res == 0) {
                std::string new_map;
                try {
@@ -403,7 +403,7 @@
                        }
                }
                else {
-                       gui::show_dialog(gui_, NULL, "", 
translate_string("edit_not_valid_map"), gui::OK_ONLY);
+                       gui::show_dialog(gui_, NULL, "", _("The file does not 
contain a valid map."), gui::OK_ONLY);
                }
        }
 }
@@ -482,7 +482,7 @@
                throw new_map_exception(new_map, filename_);
        }
        else {
-               gui::show_dialog(gui_, NULL, "", 
translate_string("edit_not_valid_map"), gui::OK_ONLY);
+               gui::show_dialog(gui_, NULL, "", _("The file does not contain a 
valid map."), gui::OK_ONLY);
        }
 }
 
@@ -540,7 +540,7 @@
        symbols["filename"] = filename;
        if (!file_exists(filename) || is_directory(filename)) {
                load_successful = false;
-               msg = translate_string("edit_file_not_exists_or_cant_be_read");
+               msg = vgettext("'$filename' does not exist or can not be read 
as a file.", symbols);
        }
        else {
                try {
@@ -552,7 +552,7 @@
                }
        }
        if (!load_successful) {
-               const std::string failed_msg = 
translate_string("edit_load_failed");
+               const std::string failed_msg = _("Load failed: ");
                const std::string show_msg = failed_msg +
                        config::interpolate_variables_into_string(msg, 
&symbols);
                gui::show_dialog(gui_, NULL, "", show_msg, gui::OK_ONLY);
@@ -747,7 +747,7 @@
        }
        else {
                gui::show_dialog(gui_, NULL, "",
-                                                
translate_string("edit_must_have_hex_selected"), gui::OK_ONLY);
+                                                _("You must have a hex 
selected on the board."), gui::OK_ONLY);
        }
 }
 
@@ -999,12 +999,12 @@
 
 bool map_editor::confirm_exit_and_save() {
        if (gui::show_dialog(gui_, NULL, "",
-                                                
translate_string("quit_message"), gui::YES_NO) != 0) {
+                                                _("Quit Editor"), gui::YES_NO) 
!= 0) {
                return false;
        }
        if (changed_since_save() &&
                gui::show_dialog(gui_, NULL, "",
-                                                
translate_string("edit_save_before_quit"), gui::YES_NO) == 0) {
+                                                _("Do you want to save the map 
before quitting?"), gui::YES_NO) == 0) {
                if (!save_map("", false)) {
                        return false;
                }
@@ -1024,16 +1024,15 @@
                write_file(filename, map_.write());
                num_operations_since_save_ = 0;
                if (display_confirmation) {
-                       gui::show_dialog(gui_, NULL, "", 
translate_string("edit_save_confirmed"),
+                       gui::show_dialog(gui_, NULL, "", _("Map saved."),
                                                         gui::OK_ONLY);
                }
        }
        catch (io_exception e) {
-               const std::string msg = translate_string("edit_save_failed");
                string_map symbols;
                symbols["msg"] = e.what();
-               const std::string show_msg = 
config::interpolate_variables_into_string(msg, &symbols);
-               gui::show_dialog(gui_, NULL, "", show_msg, gui::OK_ONLY);
+               const std::string msg = vgettext("Could not save the map: 
$msg",symbols);
+               gui::show_dialog(gui_, NULL, "", msg, gui::OK_ONLY);
                return false;
        }
        return true;
@@ -1099,7 +1098,7 @@
                gamemap::location loc = map_.starting_position(i);
                if (loc.valid()) {
                        std::stringstream ss;
-                       ss << translate_string("edit_player") << i;
+                       ss << _("Player") << i;
                        gui_.labels().set_label(loc, ss.str());
                        starting_positions_.push_back(loc);
                }
Index: wesnoth/src/editor/editor_dialogs.cpp
diff -u wesnoth/src/editor/editor_dialogs.cpp:1.14 
wesnoth/src/editor/editor_dialogs.cpp:1.15
--- wesnoth/src/editor/editor_dialogs.cpp:1.14  Sun Jun 20 21:25:11 2004
+++ wesnoth/src/editor/editor_dialogs.cpp       Thu Sep  2 11:34:28 2004
@@ -481,9 +481,9 @@
 
 FLIP_AXIS flip_dialog(display &disp) {
        std::vector<std::string> items;
-       items.push_back(translate_string("edit_x_axis"));
-       items.push_back(translate_string("edit_y_axis"));
-       const std::string msg = translate_string("edit_flip_around");
+       items.push_back(_("X-Axis"));
+       items.push_back(_("Y-Axis"));
+       const std::string msg = _("Flip around (this may change the dimensions 
of the map):");
        const int res =
                gui::show_dialog(disp, NULL, "",
                                                 font::word_wrap_text(msg, 12, 
180),
Index: wesnoth/src/editor/editor_main.cpp
diff -u wesnoth/src/editor/editor_main.cpp:1.16 
wesnoth/src/editor/editor_main.cpp:1.17
--- wesnoth/src/editor/editor_main.cpp:1.16     Sat Aug 28 19:34:02 2004
+++ wesnoth/src/editor/editor_main.cpp  Thu Sep  2 11:34:28 2004
@@ -14,6 +14,7 @@
 #include "editor.hpp"
 #include "../config.hpp"
 #include "../game_config.hpp"
+#include "../gettext.hpp"
 #include "../filesystem.hpp"
 #include "../font.hpp"
 #include "../image.hpp"
@@ -32,6 +33,13 @@
 
 int main(int argc, char** argv)
 {
+       setlocale (LC_ALL, "");
+
+       const std::string& intl_dir = get_intl_dir();
+       bindtextdomain ("wesnoth-editor", intl_dir.c_str());
+       textdomain ("wesnoth-editor");
+       bind_textdomain_codeset ("wesnoth-editor", "UTF-8");
+
        game_config::editor = true;
 
        int arg;
Index: wesnoth/src/editor/editor_palettes.cpp
diff -u wesnoth/src/editor/editor_palettes.cpp:1.15 
wesnoth/src/editor/editor_palettes.cpp:1.16
--- wesnoth/src/editor/editor_palettes.cpp:1.15 Sun Jul 18 21:08:17 2004
+++ wesnoth/src/editor/editor_palettes.cpp      Thu Sep  2 11:34:28 2004
@@ -310,9 +310,9 @@
 }
 
 void terrain_palette::update_report() {
-       const std::string msg = translate_string("edit_foreground_short") + ": "
+       const std::string msg = std::string(_("FG")) + ": "
                + get_terrain_string(selected_fg_terrain()) + "\n"
-               + translate_string("edit_background_short") +
+               + std::string(_("BG")) +
                ": " + get_terrain_string(selected_bg_terrain());
        reports::set_report_content(reports::SELECTED_TERRAIN, msg);
 }




reply via email to

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