← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1537157 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1537157 into lp:widelands.

Commit message:
Changed msgxctxt variable for Productionsites from char* to std::string to fix problem with loading descname translations.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1537157 in widelands: "Translations for some building names  are missing"
  https://bugs.launchpad.net/widelands/+bug/1537157

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1537157/+merge/283724

Changed msgxctxt variable for Productionsites from char* to std::string to fix problem with loading descname translations.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1537157 into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc	2016-01-17 08:29:59 +0000
+++ src/logic/map_objects/tribes/productionsite.cc	2016-01-23 16:38:15 +0000
@@ -55,7 +55,7 @@
 */
 
 ProductionSiteDescr::ProductionSiteDescr
-	(const std::string& init_descname, const char* msgctxt, MapObjectType _type,
+	(const std::string& init_descname, const std::string& msgctxt, MapObjectType _type,
 	 const LuaTable& table, const EditorGameBase& egbase)
 	: BuildingDescr(init_descname, _type, table, egbase),
 	  m_out_of_resource_title(""),
@@ -70,7 +70,7 @@
 		items_table = table.get_table("out_of_resource_notification");
 		m_out_of_resource_title = _(items_table->get_string("title"));
 		m_out_of_resource_heading = _(items_table->get_string("heading"));
-		m_out_of_resource_message = pgettext_expr(msgctxt, items_table->get_string("message").c_str());
+		m_out_of_resource_message = pgettext_expr(msgctxt.c_str(), items_table->get_string("message").c_str());
 		if (items_table->has_key("productivity_threshold")) {
 			out_of_resource_productivity_threshold_ = items_table->get_int("productivity_threshold");
 		}
@@ -192,7 +192,7 @@
 
 ProductionSiteDescr::ProductionSiteDescr
 	(const std::string& init_descname,
-	 const char* msgctxt,
+	 const std::string& msgctxt,
 	 const LuaTable& table,
 	 const EditorGameBase& egbase)
 	: ProductionSiteDescr(init_descname, msgctxt, MapObjectType::PRODUCTIONSITE, table, egbase)

=== modified file 'src/logic/map_objects/tribes/productionsite.h'
--- src/logic/map_objects/tribes/productionsite.h	2015-12-11 19:06:50 +0000
+++ src/logic/map_objects/tribes/productionsite.h	2016-01-23 16:38:15 +0000
@@ -58,9 +58,9 @@
 public:
 	friend struct ProductionProgram; // To add animations
 
-	ProductionSiteDescr(const std::string& init_descname, const char* msgctxt, MapObjectType type,
+	ProductionSiteDescr(const std::string& init_descname, const std::string& msgctxt, MapObjectType type,
 							  const LuaTable& t, const EditorGameBase& egbase);
-	ProductionSiteDescr(const std::string& init_descname, const char* msgctxt,
+	ProductionSiteDescr(const std::string& init_descname, const std::string& msgctxt,
 							  const LuaTable& t, const EditorGameBase& egbase);
 
 	Building & create_object() const override;

=== modified file 'src/logic/map_objects/tribes/tribes.cc'
--- src/logic/map_objects/tribes/tribes.cc	2016-01-18 19:35:25 +0000
+++ src/logic/map_objects/tribes/tribes.cc	2016-01-23 16:38:15 +0000
@@ -108,10 +108,10 @@
 
 void Tribes::add_productionsite_type(const LuaTable& table, const EditorGameBase& egbase) {
 	i18n::Textdomain td("tribes");
-	const char* msgctxt = table.get_string("msgctxt").c_str();
+	const std::string msgctxt = table.get_string("msgctxt");
 	buildings_->add(
 				new ProductionSiteDescr(
-					pgettext_expr(msgctxt, table.get_string("descname").c_str()),
+					pgettext_expr(msgctxt.c_str(), table.get_string("descname").c_str()),
 					msgctxt,
 					table,
 					egbase));


Follow ups