nuked more calls to the old translation API

This commit is contained in:
Yann Dirson 2004-08-17 21:09:35 +00:00
parent af8b4f4e7d
commit 8a26b5b46a
5 changed files with 23 additions and 38 deletions

View file

@ -154,10 +154,8 @@ void show_objectives(display& disp, config& level_info)
{
static const std::string no_objectives(_("No objectives available"));
const std::string& id = level_info["id"];
const std::string& lang_name = string_table[id];
const std::string& name = lang_name.empty() ? level_info["name"] :
lang_name;
const std::string& lang_objectives = string_table[id + "_objectives"];
const std::string& name = level_info["name"];
const std::string& lang_objectives = level_info["objectives"];
const std::string& objectives = lang_objectives.empty() ?
level_info["objectives"] : lang_objectives;
@ -371,7 +369,7 @@ void save_preview_pane::draw()
} else if(campaign_type == "tutorial") {
str << _("Tutorial");
} else {
str << translate_string(campaign_type);
str << campaign_type;
}
str << "\n";
@ -720,7 +718,7 @@ void unit_preview_pane::draw()
const std::vector<std::string>& abilities = u.type().abilities();
for(std::vector<std::string>::const_iterator a = abilities.begin(); a != abilities.end(); ++a) {
details << translate_string_default("ability_" + *a, *a);
details << *a;
if(a+1 != abilities.end()) {
details << ",";
}
@ -759,9 +757,9 @@ void unit_preview_pane::draw()
for(std::vector<attack_type>::const_iterator at_it = attacks.begin();
at_it != attacks.end(); ++at_it) {
const std::string& lang_weapon = string_table["weapon_name_" + at_it->name()];
const std::string& lang_type = string_table["weapon_type_" + at_it->type()];
const std::string& lang_special = string_table["weapon_special_" + at_it->special()];
const std::string& lang_weapon = at_it->name();
const std::string& lang_type = at_it->type();
const std::string& lang_special = at_it->special();
details << "\n"
<< (lang_weapon.empty() ? at_it->name():lang_weapon) << " ("
<< (lang_type.empty() ? at_it->type():lang_type) << ")\n"
@ -841,8 +839,7 @@ void show_unit_resistance(display& disp, const unit& u)
//if resistance is less than 0, display in red
const char prefix = resistance < 0 ? font::BAD_TEXT : font::NULL_MARKUP;
const std::string& lang_weapon = string_table["weapon_type_" + i->first];
const std::string& weap = lang_weapon.empty() ? i->first : lang_weapon;
const std::string& weap = i->first;
std::stringstream str;
str << weap << "," << prefix << resistance << "%";

View file

@ -889,7 +889,7 @@ void display::draw_unit_details(int x, int y, const gamemap::location& loc,
const std::vector<std::string>& abilities = u.type().abilities();
for(std::vector<std::string>::const_iterator a = abilities.begin(); a != abilities.end(); ++a) {
details << translate_string_default("ability_" + *a, *a) << "\n";
details << *a << "\n";
}
//display in green/white/red depending on hitpoints
@ -922,9 +922,9 @@ void display::draw_unit_details(int x, int y, const gamemap::location& loc,
for(std::vector<attack_type>::const_iterator at_it = attacks.begin();
at_it != attacks.end(); ++at_it) {
const std::string& lang_weapon = string_table["weapon_name_" + at_it->name()];
const std::string& lang_type = string_table["weapon_type_" + at_it->type()];
const std::string& lang_special = string_table["weapon_special_" + at_it->special()];
const std::string& lang_weapon = at_it->name();
const std::string& lang_type = at_it->type();
const std::string& lang_special = at_it->special();
details << "\n"
<< (lang_weapon.empty() ? at_it->name():lang_weapon) << " ("
<< (lang_type.empty() ? at_it->type():lang_type) << ")\n"

View file

@ -46,11 +46,7 @@ void show_intro(display& screen, const config& data, const config& level)
bool showing = true;
const std::string& scenario_id = level["id"];
const std::string& scenario_name = string_table[scenario_id];
const std::string& scenario = scenario_name.empty() ? level["name"] :
scenario_name;
const std::string& scenario = level["name"];
for(config::all_children_iterator i = data.ordered_begin();
i != data.ordered_end() && showing; i++) {
@ -209,9 +205,7 @@ bool show_intro_part(display& screen, const config& part,
}
}
const std::string& id = part["id"];
const std::string& lang_story = string_table[id];
const std::string& story = lang_story.empty() ? part["story"] : lang_story;
const std::string& story = part["story"];
const std::vector<std::string> story_chars = split_utf8_string(story);
std::cerr << story << std::endl;

View file

@ -75,13 +75,7 @@ multiplayer_game_setup_dialog::multiplayer_game_setup_dialog(
const config::child_list& levels = cfg.get_children("multiplayer");
for(config::child_list::const_iterator i = levels.begin(); i != levels.end(); ++i){
const std::string& id = (**i)["id"];
const std::string& lang_name = string_table[id];
if(lang_name.empty() == false)
options.push_back(lang_name);
else
options.push_back((**i)["name"]);
options.push_back((**i)["name"]);
}
//add the 'load game' option

View file

@ -606,12 +606,12 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
const battle_stats& st = stats.back();
const std::string& attack_name = translate_string_default("weapon_name_"+st.attack_name,st.attack_name);
const std::string& attack_type = translate_string_default("weapon_type_"+st.attack_type,st.attack_type);
const std::string& attack_special = translate_string_default("weapon_special_"+st.attack_special,st.attack_special);
const std::string& defend_name = translate_string_default("weapon_name_"+st.defend_name,st.defend_name);
const std::string& defend_type = translate_string_default("weapon_type_"+st.defend_type,st.defend_type);
const std::string& defend_special = translate_string_default("weapon_special_"+st.defend_special,st.defend_special);
const std::string& attack_name = st.attack_name;
const std::string& attack_type = st.attack_type;
const std::string& attack_special = st.attack_special;
const std::string& defend_name = st.defend_name;
const std::string& defend_type = st.defend_type;
const std::string& defend_special = st.defend_special;
const std::string& range = gettext(st.range == "Melee" ? N_("melee") : N_("ranged"));
@ -1679,7 +1679,7 @@ gui::dialog_button_action::RESULT delete_recall_unit::button_pressed(int menu_se
if(message != "") {
string_map symbols;
symbols["noun"] = string_table[u.gender() == unit_race::MALE ? "noun_male" : "noun_female"];
symbols["noun"] = (u.gender() == unit_race::MALE ? _("him") : _("her"));
message = config::interpolate_variables_into_string(message,&symbols);
const int res = gui::show_dialog(disp_,NULL,"",message,gui::YES_NO);
@ -2052,7 +2052,7 @@ void turn_info::search()
void turn_info::user_command()
{
create_textbox(floating_textbox::TEXTBOX_COMMAND,string_table["command_prompt"] + ":");
create_textbox(floating_textbox::TEXTBOX_COMMAND,_("prompt|Command:"));
}
void turn_info::show_help()