From e6f107c80eaa8fd97f7427671fee7e6c8d05a66c Mon Sep 17 00:00:00 2001 From: GunChleoc Date: Thu, 9 Feb 2017 13:50:24 +0000 Subject: [PATCH] Replace _ with vgettext in attack_type.cpp Replace _ with vgettext in attack_type.cpp to get rid of hard-coded word order. --- src/units/attack_type.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/units/attack_type.cpp b/src/units/attack_type.cpp index 293cf1437a2b..647f9784df19 100644 --- a/src/units/attack_type.cpp +++ b/src/units/attack_type.cpp @@ -348,7 +348,7 @@ bool attack_type::describe_modification(const config& cfg,std::string* descripti std::stringstream desc; - if(increase_damage.empty() == false) { + if(!increase_damage.empty()) { utils::string_map symbols; symbols["damage"] = utils::print_modifier(increase_damage); add_and(desc); @@ -388,34 +388,28 @@ bool attack_type::describe_modification(const config& cfg,std::string* descripti std::stoi(set_attacks), symbols); } - if(set_accuracy.empty() == false) { - int accuracy = std::stoi(set_accuracy); - + if(!set_accuracy.empty()) { add_and(desc); - // xgettext:no-c-format - desc << accuracy << " " << _("% accuracy"); + desc << vgettext("$percent|% accuracy", + utils::string_map({{"percent", set_accuracy}})); } - if(increase_accuracy.empty() == false) { + if(!increase_accuracy.empty()) { add_and(desc); - int inc_acc = std::stoi(increase_accuracy); - // Help xgettext with a directive to recognize the string as a non C printf-like string - // xgettext:no-c-format - desc << utils::signed_value(inc_acc) << _("% accuracy"); + desc << vgettext("$percent|% accuracy", + utils::string_map({{"percent", utils::print_modifier(increase_accuracy)}})); } - if(set_parry.empty() == false) { - int parry = std::stoi(set_parry); - + if(!set_parry.empty()) { add_and(desc); - desc << parry << _(" parry"); + desc << vgettext("$number parry", + utils::string_map({{"number", set_parry}})); } - if(increase_parry.empty() == false) { + if(!increase_parry.empty()) { add_and(desc); - int inc_parry = std::stoi(increase_parry); - // xgettext:no-c-format - desc << utils::signed_value(inc_parry) << _("% parry"); + desc << vgettext("$number parry", + utils::string_map({{"number", utils::print_modifier(increase_parry)}})); } if(!set_movement.empty()) {