mail[Wesnoth-commits] r20265 - in /trunk/src: game.cpp multiplayer_create.cpp multiplayer_lobby.cpp playcampaign.cpp unit.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Soliton on September 10, 2007 - 13:44:
Author: soliton
Date: Mon Sep 10 13:44:02 2007
New Revision: 20265

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20265&view=rev
Log:
mark some more strings translatable and improve others to be more accurately 
translatable

Modified:
    trunk/src/game.cpp
    trunk/src/multiplayer_create.cpp
    trunk/src/multiplayer_lobby.cpp
    trunk/src/playcampaign.cpp
    trunk/src/unit.cpp

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=20265&r1=20264&r2=20265&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Mon Sep 10 13:44:02 2007
@@ -969,15 +969,11 @@
 
                                if(index < 0) return;
 
-                               const std::string confirm_message =
-                                       "Are you sure you want to remove the 
add-on \'"
-                                       + addons.at(index)
-                                       + "?\'";
-                               res = gui::dialog(
-                                               disp(),
-                                               _("Confirm"),
-                                               confirm_message,
-                                               gui::YES_NO).show();
+                               std::string confirm_message = _("Are you sure 
you want to remove the add-on '$addon|'?");
+                               utils::string_map symbols;
+                               symbols["addon"] = addons.at(index);
+                               confirm_message = 
utils::interpolate_variables_into_string(confirm_message, &symbols);
+                               res = gui::dialog(disp(), _("Confirm"), 
confirm_message, gui::YES_NO).show();
                        } while (res != 0);
 
                        bool delete_success = true;
@@ -986,14 +982,10 @@
                        std::string filename = addons.at(index);
                        std::replace(filename.begin(), filename.end(), ' ', 
'_');
                        delete_success &= delete_directory(campaign_dir + 
filename + ".cfg");
+                       //Report results
                        if (delete_success)
                        {
                                delete_success &= 
delete_directory(campaign_dir + filename);
-                       }
-
-                       //Report results
-                       if (delete_success)
-                       {
                                //force a reload of configuration information
                                const bool old_cache = use_caching_;
                                use_caching_ = false;
@@ -1004,11 +996,12 @@
                                paths_manager_.set_paths(game_config_);
                                clear_binary_paths_cache();
 
-                               std::string success_message = "Add-on \'" + 
addons.at(index) + "\' deleted.";
-
+                               std::string message = _("Add-on '$addon|' 
deleted.");
+                               utils::string_map symbols;
+                               symbols["addon"] = addons.at(index);
+                               message = 
utils::interpolate_variables_into_string(message, &symbols);
                                /* GCC-3.3 needs a temp var otherwise 
compilation fails */
-                               gui::dialog dlg(disp(), _("Add-on deleted"), 
success_message,
-                                               gui::OK_ONLY);
+                               gui::dialog dlg(disp(), _("Add-on deleted"), 
message, gui::OK_ONLY);
                                dlg.show();
                        }
                        else
@@ -1281,8 +1274,11 @@
                gui::show_error_message(disp(), _("Connection timed out"));
                return;
        } else if(data.child("error")) {
-               gui::show_error_message(disp(), _("The server responded with 
an error: \"") +
-                                       
(*data.child("error"))["message"].str() + '"');
+               std::string error_message = _("The server responded with an 
error: \"$error|\"");
+               utils::string_map symbols;
+               symbols["error"] = (*data.child("error"))["message"].str();
+               error_message = 
utils::interpolate_variables_into_string(error_message, &symbols);
+               gui::show_error_message(disp(), error_message);
                return;
        } else if(data.child("message")) {
                const int res = 
gui::dialog(disp(),_("Terms"),(*data.child("message"))["message"],gui::OK_CANCEL).show();

Modified: trunk/src/multiplayer_create.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_create.cpp?rev=20265&r1=20264&r2=20265&view=diff
==============================================================================
--- trunk/src/multiplayer_create.cpp (original)
+++ trunk/src/multiplayer_create.cpp Mon Sep 10 13:44:02 2007
@@ -90,7 +90,7 @@
        std::string help_sep = " ";
        help_sep[0] = HELP_STRING_SEPARATOR;
        std::string menu_help_str = help_sep + _("Load Game");
-       map_options_.push_back(markup_txt + _("Load Game") + 
std::string("...") + menu_help_str);
+       map_options_.push_back(markup_txt + _("Load Game...") + 
menu_help_str);
 
        //user maps
        get_files_in_dir(get_user_data_dir() + 
"/editor/maps",&user_maps_,NULL,FILE_NAME_ONLY);

Modified: trunk/src/multiplayer_lobby.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_lobby.cpp?rev=20265&r1=20264&r2=20265&view=diff
==============================================================================
--- trunk/src/multiplayer_lobby.cpp (original)
+++ trunk/src/multiplayer_lobby.cpp Mon Sep 10 13:44:02 2007
@@ -444,7 +444,7 @@
                                const std::string current_turn = 
turn.substr(0, index);
                                games_.back().current_turn = 
lexical_cast<unsigned int>(current_turn);
                        }
-                       games_.back().status = _("Turn") + (" " + turn);
+                       games_.back().status = _("Turn ") + turn;
                } else {
                        games_.back().started = false;
                        if(slots != "")

Modified: trunk/src/playcampaign.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playcampaign.cpp?rev=20265&r1=20264&r2=20265&view=diff
==============================================================================
--- trunk/src/playcampaign.cpp (original)
+++ trunk/src/playcampaign.cpp Mon Sep 10 13:44:02 2007
@@ -546,7 +546,11 @@
        }
 
        if (!gamestate.scenario.empty() && gamestate.scenario != "null") {
-               gui::show_error_message(disp, _("Unknown scenario: '") + 
gamestate.scenario + '\'');
+               std::string message = _("Unknown scenario: '$scenario|'");
+               utils::string_map symbols;
+               symbols["scenario"] = gamestate.scenario;
+               message = utils::interpolate_variables_into_string(message, 
&symbols);
+               gui::show_error_message(disp, message);
                return QUIT;
        }
 

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=20265&r1=20264&r2=20265&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Mon Sep 10 13:44:02 2007
@@ -368,7 +368,12 @@
        const game_data::unit_type_map::const_iterator type = 
gamedata_->unit_types.find(id());
        // Calculate the unit's traits
         if (type == gamedata_->unit_types.end()) {
-               throw game::game_error("Unknown unit type '" + id() + "'");
+               std::string error_message = _("Unknown unit type '$type|'");
+               utils::string_map symbols;
+               symbols["type"] = id();
+               error_message = 
utils::interpolate_variables_into_string(error_message, &symbols);
+               LOG_STREAM(err, engine) << "unit of type " << id() << " not 
found!\n";
+               throw game::game_error(error_message);
         }
        std::vector<config*> candidate_traits = 
type->second.possible_traits();
        std::vector<config*> traits;
@@ -1142,8 +1147,12 @@
                        advance_to(&i->second.get_gender_unit_type(gender_));
                        type_set = true;
                } else {
+                       std::string error_message = _("Unknown unit type 
'$type|'");
+                       utils::string_map symbols;
+                       symbols["type"] = cfg["type"];
+                       error_message = 
utils::interpolate_variables_into_string(error_message, &symbols);
                        LOG_STREAM(err, engine) << "unit of type " << 
cfg["type"] << " not found!\n";
-                       throw game::game_error("Unknown unit type '" + 
cfg["type"] + "'");
+                       throw game::game_error(error_message);
                }
                attacks_left_ = max_attacks_;
                if(cfg["moves"]=="") {
@@ -2518,7 +2527,12 @@
                                        wassert(gamedata_ != NULL);
                                        const 
game_data::unit_type_map::const_iterator var = 
gamedata_->unit_types.find(id());
                                         if(var == 
gamedata_->unit_types.end()) {
-                                               throw 
game::game_error("Unknown unit type '" + id() + "'");
+                                               std::string error_message = 
_("Unknown unit type '$type|'");
+                                               utils::string_map symbols;
+                                               symbols["type"] = id();
+                                               error_message = 
utils::interpolate_variables_into_string(error_message, &symbols);
+                                               LOG_STREAM(err, engine) << 
"unit of type " << id() << " not found!\n";
+                                               throw 
game::game_error(error_message);
                                         }
                                        
advance_to(&var->second.get_variation(variation_));
                                } else if(apply_to == "profile") {




Related Messages


Powered by MHonArc, Updated Mon Sep 10 14:00:26 2007