Make strings translatable in unit_attack.cpp and abilities.cpp (#7642)
Gettext doesn't detect strings to extract to the .pot file when dsgettext is used directly instead of the _(string) macro.
This commit is contained in:
parent
ba93decfcb
commit
337a9435ed
2 changed files with 15 additions and 16 deletions
|
@ -13,7 +13,6 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "gui/dialogs/unit_attack.hpp"
|
||||
|
||||
|
@ -142,7 +141,7 @@ void unit_attack::pre_show(window& window)
|
|||
attw_specials_cth = " " + attw_specials_cth;
|
||||
}
|
||||
if(!attw_specials_others.empty()) {
|
||||
attw_specials_others = "\n" + ("<b>"+translation::dsgettext("wesnoth", "Other aspects: ")+"</b>") + "\n" + ("<i>"+attw_specials_others+"</i>");
|
||||
attw_specials_others = "\n" + ("<b>" + _("Other aspects: ") + "</b>") + "\n" + ("<i>"+attw_specials_others+"</i>");
|
||||
}
|
||||
if(!defw_specials.empty()) {
|
||||
defw_specials = " " + defw_specials;
|
||||
|
@ -157,7 +156,7 @@ void unit_attack::pre_show(window& window)
|
|||
defw_specials_cth = " " + defw_specials_cth;
|
||||
}
|
||||
if(!defw_specials_others.empty()) {
|
||||
defw_specials_others = "\n" + ("<b>"+translation::dsgettext("wesnoth", "Other aspects: ")+"</b>") + "\n" + ("<i>"+defw_specials_others+"</i>");
|
||||
defw_specials_others = "\n" + ("<b>" + _("Other aspects: ") + "</b>") + "\n" + ("<i>"+defw_specials_others+"</i>");
|
||||
}
|
||||
|
||||
std::stringstream attacker_stats, defender_stats, attacker_tooltip, defender_tooltip;
|
||||
|
@ -168,10 +167,10 @@ void unit_attack::pre_show(window& window)
|
|||
<< attw_specials << "\n"
|
||||
<< font::span_color(a_cth_color) << attacker.chance_to_hit << "%</span>";
|
||||
|
||||
attacker_tooltip << translation::dsgettext("wesnoth", "Weapon: ") << "<b>" << attw_name << "</b>" << "\n"
|
||||
<< translation::dsgettext("wesnoth", "Damage: ") << attacker.damage << "<i>" << attw_specials_dmg << "</i>" << "\n"
|
||||
<< translation::dsgettext("wesnoth", "Attacks: ") << attacker.num_blows << "<i>" << attw_specials_atk << "</i>" << "\n"
|
||||
<< translation::dsgettext("wesnoth-lib", "Chance to hit") << ": " << font::span_color(a_cth_color) << attacker.chance_to_hit << "%</span>"<< "<i>" << attw_specials_cth << "</i>"
|
||||
attacker_tooltip << _("Weapon: ") << "<b>" << attw_name << "</b>" << "\n"
|
||||
<< _("Damage: ") << attacker.damage << "<i>" << attw_specials_dmg << "</i>" << "\n"
|
||||
<< _("Attacks: ") << attacker.num_blows << "<i>" << attw_specials_atk << "</i>" << "\n"
|
||||
<< _("Chance to hit: ") << font::span_color(a_cth_color) << attacker.chance_to_hit << "%</span>"<< "<i>" << attw_specials_cth << "</i>"
|
||||
<< attw_specials_others;
|
||||
|
||||
defender_stats << "<b>" << defw_name << "</b>" << "\n"
|
||||
|
@ -179,10 +178,10 @@ void unit_attack::pre_show(window& window)
|
|||
<< defw_specials << "\n"
|
||||
<< font::span_color(d_cth_color) << defender.chance_to_hit << "%</span>";
|
||||
|
||||
defender_tooltip << translation::dsgettext("wesnoth", "Weapon: ") << "<b>" << defw_name << "</b>" << "\n"
|
||||
<< translation::dsgettext("wesnoth", "Damage: ") << defender.damage << "<i>" << defw_specials_dmg << "</i>" << "\n"
|
||||
<< translation::dsgettext("wesnoth", "Attacks: ") << defender.num_blows << "<i>" << defw_specials_atk << "</i>" << "\n"
|
||||
<< translation::dsgettext("wesnoth-lib", "Chance to hit") << ": " << font::span_color(d_cth_color) << defender.chance_to_hit << "%</span>"<< "<i>" << defw_specials_cth << "</i>"
|
||||
defender_tooltip << _("Weapon: ") << "<b>" << defw_name << "</b>" << "\n"
|
||||
<< _("Damage: ") << defender.damage << "<i>" << defw_specials_dmg << "</i>" << "\n"
|
||||
<< _("Attacks: ") << defender.num_blows << "<i>" << defw_specials_atk << "</i>" << "\n"
|
||||
<< _("Chance to hit: ") << font::span_color(d_cth_color) << defender.chance_to_hit << "%</span>"<< "<i>" << defw_specials_cth << "</i>"
|
||||
<< defw_specials_others;
|
||||
|
||||
widget_data data;
|
||||
|
|
|
@ -890,7 +890,7 @@ std::string attack_type::weapon_specials() const
|
|||
static void add_name_list(std::string& temp_string, std::string& weapon_abilities, std::set<std::string>& checking_name, const std::string from_str)
|
||||
{
|
||||
if(!temp_string.empty()){
|
||||
temp_string = translation::dsgettext("wesnoth", from_str.c_str()) + temp_string;
|
||||
temp_string = from_str.c_str() + temp_string;
|
||||
weapon_abilities += (!weapon_abilities.empty() && !temp_string.empty()) ? "\n" : "";
|
||||
weapon_abilities += temp_string;
|
||||
temp_string.clear();
|
||||
|
@ -912,13 +912,13 @@ std::string attack_type::weapon_specials_value(const std::set<std::string> check
|
|||
add_name_list(temp_string, weapon_abilities, checking_name, "");
|
||||
|
||||
weapon_specials_impl_self(temp_string, self_, shared_from_this(), other_attack_, self_loc_, AFFECT_SELF, checking_name, checking_tags, true);
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, "Owned: ");
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, _("Owned: "));
|
||||
|
||||
weapon_specials_impl_adj(temp_string, self_, shared_from_this(), other_attack_, self_loc_, AFFECT_SELF, checking_name, checking_tags, "affect_allies", true);
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, "Taught: ");
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, _("Taught: "));
|
||||
|
||||
weapon_specials_impl_adj(temp_string, self_, shared_from_this(), other_attack_, self_loc_, AFFECT_SELF, checking_name, checking_tags, "affect_enemies", true);
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, "Taught: (by an enemy): ");
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, _("Taught: (by an enemy): "));
|
||||
|
||||
|
||||
if(other_attack_) {
|
||||
|
@ -931,7 +931,7 @@ std::string attack_type::weapon_specials_value(const std::set<std::string> check
|
|||
}
|
||||
weapon_specials_impl_self(temp_string, other_, other_attack_, shared_from_this(), other_loc_, AFFECT_OTHER, checking_name, checking_tags);
|
||||
weapon_specials_impl_adj(temp_string, other_, other_attack_, shared_from_this(), other_loc_, AFFECT_OTHER, checking_name, checking_tags);
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, "Used by opponent: ");
|
||||
add_name_list(temp_string, weapon_abilities, checking_name, _("Used by opponent: "));
|
||||
|
||||
return weapon_abilities;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue