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

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

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


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src help.cpp
Date: Tue, 19 Oct 2004 16:36:59 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/10/19 20:29:36

Modified files:
        src            : help.cpp 

Log message:
        Completely translate unit descriptions. I'm not really fond of abusing 
gettext though: it won't make the help system any faster.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text

Patches:
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.36 wesnoth/src/help.cpp:1.37
--- wesnoth/src/help.cpp:1.36   Tue Oct 19 05:52:13 2004
+++ wesnoth/src/help.cpp        Tue Oct 19 20:29:36 2004
@@ -575,16 +575,13 @@
                                for (std::vector<std::string>::const_iterator 
advance_it = next_units.begin();
                                         advance_it != next_units.end(); 
advance_it++) {
                                        std::string unit_id = *advance_it;
+                                       std::string lang_unit = 
gettext(unit_id.c_str());
                                        // Remove the spaces, which will create 
the ID to
                                        // reference to. This relies a bit on 
that we know
                                        // that unit_type::id() does this.
                                        
unit_id.erase(std::remove(unit_id.begin(), unit_id.end(), ' '),
                                                                  
unit_id.end());
                                        std::string ref_id = 
std::string("unit_") + unit_id;
-                                       std::string lang_unit = 
string_table[unit_id];
-                                       if (lang_unit == "") {
-                                               lang_unit = *advance_it;
-                                       }
                                        ss << "<ref>dst='" << escape(ref_id) << 
"' text='" << escape(lang_unit)
                                           << "'</ref>";
                                        if (advance_it + 1 != next_units.end()) 
{
@@ -670,16 +667,8 @@
                                // Print information about every attack.
                                for (std::vector<attack_type>::const_iterator 
attack_it =attacks.begin();
                                         attack_it != attacks.end(); 
attack_it++) {
-                                       std::string lang_weapon
-                                               = string_table["weapon_name_" + 
attack_it->name()];
-                                       if (lang_weapon == "") {
-                                               lang_weapon = attack_it->name();
-                                       }
-                                       std::string lang_type
-                                               = string_table["weapon_type_" + 
attack_it->type()];
-                                       if (lang_type == "") {
-                                               lang_type = attack_it->type();
-                                       }
+                                       std::string lang_weapon = 
gettext(attack_it->name().c_str());
+                                       std::string lang_type = 
gettext(attack_it->type().c_str());
                                        std::vector<std::pair<std::string, 
unsigned> > row;
                                        std::stringstream attack_ss;
                                        attack_ss << "<img>src='" << 
(*attack_it).icon() << "'</img>";
@@ -702,11 +691,7 @@
                                        if ((*attack_it).special() != "") {
                                                const std::string ref_id = 
std::string("weaponspecial_")
                                                        + 
(*attack_it).special();
-                                               std::string lang_special
-                                                       = 
string_table["weapon_special_" + attack_it->special()];
-                                               if (lang_special == "") {
-                                                       lang_special = 
attack_it->special();
-                                               }
+                                               std::string lang_special = 
gettext(attack_it->special().c_str());
                                                attack_ss << "<ref>dst='" << 
escape(ref_id) << "' text='"
                                                                  << 
escape(lang_special) << "'</ref>";
                                                
row.push_back(std::make_pair(attack_ss.str(),
@@ -743,10 +728,7 @@
                                if (resistance < 0) {
                                        color = "red";
                                }
-                               std::string lang_weapon = 
string_table["weapon_type_" + (*dam_it).first];
-                               if (lang_weapon == "") {
-                                       lang_weapon = (*dam_it).first;
-                               }
+                               std::string lang_weapon = 
gettext(dam_it->first.c_str());
                                push_tab_pair(row, lang_weapon);
                                std::stringstream str;
                                str << "<format>color=" << color << " text='"<< 
resistance << "%'</format>";




reply via email to

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