From c645e9e59e9e0a83a25f2c782ac79c21d519939e Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Mon, 25 Jul 2011 17:34:06 +0300
Subject: [PATCH] STORM-1220 FIXED Localized sim product name (e.g. "Estate /
 Full Region") everywhere.

---
 indra/newview/llfloaterbuyland.cpp    |  2 +-
 indra/newview/llfloaterland.cpp       | 13 ++-----------
 indra/newview/llfloaterregioninfo.cpp |  9 +++------
 indra/newview/llpanelplaceprofile.cpp |  2 +-
 indra/newview/llviewerregion.cpp      |  6 ++++++
 indra/newview/llviewerregion.h        |  1 +
 6 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 610142b5a9c..5cfdd69f7b6 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -529,7 +529,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo()
 	LLTextBox* region_type = getChild<LLTextBox>("region_type_text");
 	if (region_type)
 	{
-		region_type->setText(region->getSimProductName());
+		region_type->setText(region->getLocalizedSimProductName());
 	}
 	
 	LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 9b7593ce615..4746f930092 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -566,10 +566,7 @@ void LLPanelLandGeneral::refresh()
 		if (regionp)
 		{
 			insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY);
-
-			std::string land_type;
-			bool is_land_type_localized = LLTrans::findString(land_type, regionp->getSimProductName());
-			mLandType->setText(is_land_type_localized ? land_type : regionp->getSimProductName());
+			mLandType->setText(regionp->getLocalizedSimProductName());
 		}
 
 		// estate owner/manager cannot edit other parts of the parcel
@@ -2883,13 +2880,7 @@ void LLPanelLandCovenant::refresh()
 	}
 
 	LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text");
-	if (region_landtype)
-	{
-		std::string land_type;
-		bool is_land_type_localized = LLTrans::findString(land_type, region->getSimProductName());
-
-		region_landtype->setText(is_land_type_localized ? land_type : region->getSimProductName());
-	}
+	region_landtype->setText(region->getLocalizedSimProductName());
 	
 	LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text");
 	if (region_maturity)
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 538c5e3b884..9a99417e938 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -336,7 +336,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
 	LLViewerRegion* region = gAgent.getRegion();
 	BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
 
-	// *TODO: Replace parcing msg with accessing the region info model.
+	// *TODO: Replace parsing msg with accessing the region info model.
 	LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
 
 	// extract message
@@ -368,6 +368,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
 		msg->getSize("RegionInfo2", "ProductName") > 0)
 	{
 		msg->getString("RegionInfo2", "ProductName", sim_type);
+		LLTrans::findString(sim_type, sim_type); // try localizing sim product name
 	}
 
 	// GENERAL PANEL
@@ -2409,11 +2410,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
 	}
 	
 	LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text");
-	if (region_landtype)
-	{
-		region_landtype->setText(region->getSimProductName());
-	}
-	
+	region_landtype->setText(region->getLocalizedSimProductName());
 	
 	// let the parent class handle the general data collection. 
 	bool rv = LLPanelRegionInfo::refreshFromRegion(region);
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 1e9ce582373..b3c2fe25521 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -434,7 +434,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
 	}
 
 	mRegionNameText->setText(region->getName());
-	mRegionTypeText->setText(region->getSimProductName());
+	mRegionTypeText->setText(region->getLocalizedSimProductName());
 
 	// Determine parcel owner
 	if (parcel->isPublic())
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index bb7170e0f73..c33b39b449a 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -558,6 +558,12 @@ const std::string LLViewerRegion::getSimAccessString() const
 	return accessToString(mSimAccess);
 }
 
+std::string LLViewerRegion::getLocalizedSimProductName() const
+{
+	const std::string& spn = getSimProductName();
+	std::string localized_spn;
+	return LLTrans::findString(localized_spn, spn) ? localized_spn : spn;
+}
 
 // static
 std::string LLViewerRegion::regionFlagsToString(U32 flags)
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index f68b51ea658..dbc12f548be 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -193,6 +193,7 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface
 	const std::string& getSimColoName()    const { return mColoName; }
 	const std::string& getSimProductSKU()  const { return mProductSKU; }
 	const std::string& getSimProductName() const { return mProductName; }
+	std::string getLocalizedSimProductName() const;
 
 	// Returns "Sandbox", "Expensive", etc.
 	static std::string regionFlagsToString(U32 flags);
-- 
GitLab