From c74f87015118a6da7036623d026fc512f46af9d5 Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Thu, 18 Mar 2010 19:42:38 +0200
Subject: [PATCH] (EXT-5982) [FRAGMENTATION] L$ kaufen window (Buy L$) - Moved
 hardcoded strings in LLFloaterBuyCurrency::buyCurrency() calls to strings.xml

Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/56/

--HG--
branch : product-engine
---
 indra/newview/llassetuploadresponders.cpp           |  5 ++++-
 indra/newview/llfloaterbuycurrency.cpp              |  3 +--
 indra/newview/llpanelobjectinventory.cpp            |  4 +++-
 indra/newview/llpanelplaceprofile.cpp               |  8 ++++++--
 indra/newview/llviewermenu.cpp                      |  8 ++++++--
 indra/newview/llviewermenufile.cpp                  | 12 +++++++-----
 indra/newview/llviewermessage.cpp                   |  4 +++-
 .../skins/default/xui/en/floater_buy_currency.xml   |  2 +-
 indra/newview/skins/default/xui/en/strings.xml      | 13 +++++++------
 9 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 80cf8f1d61f..84417962194 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -182,7 +182,10 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
 	// deal with L$ errors
 	if (reason == "insufficient funds")
 	{
-		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs"), LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
+		S32 price = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+		LLStringUtil::format_map_t args;
+		args["AMOUNT"] = llformat("%d", price);
+		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs", args), price);
 	}
 	else
 	{
diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp
index 1642e6725ee..7fddd1fc5fa 100644
--- a/indra/newview/llfloaterbuycurrency.cpp
+++ b/indra/newview/llfloaterbuycurrency.cpp
@@ -234,8 +234,7 @@ void LLFloaterBuyCurrencyUI::updateUI()
 			if (mHasTarget)
 			{
 				childSetVisible("buy_action", true);
-				childSetTextArg("buy_action", "[NAME]", mTargetName);
-				childSetTextArg("buy_action", "[PRICE]", llformat("%d",mTargetPrice));
+				childSetTextArg("buy_action", "[ACTION]", mTargetName);
 			}
 		}
 		
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 69b8571bfb5..c43cbf5819a 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -609,7 +609,9 @@ void LLTaskInvFVBridge::performAction(LLFolderView* folder, LLInventoryModel* mo
 		{
 			if (price > 0 && price > gStatusBar->getBalance())
 			{
-				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_costs"), price);
+				LLStringUtil::format_map_t args;
+				args["AMOUNT"] = llformat("%d", price);
+				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_costs", args), price);
 			}
 			else
 			{
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index cdd79b15592..1a1650c38b2 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -567,9 +567,13 @@ void LLPanelPlaceProfile::onForSaleBannerClick()
 		if(parcel->getLocalID() == mSelectedParcelID &&
 				mLastSelectedRegionID ==selected_region->getRegionID())
 		{
-			if(parcel->getSalePrice() - gStatusBar->getBalance() > 0)
+			S32 price = parcel->getSalePrice();
+
+			if(price - gStatusBar->getBalance() > 0)
 			{
-				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("buying_selected_land"), parcel->getSalePrice());
+				LLStringUtil::format_map_t args;
+				args["AMOUNT"] = llformat("%d", price);
+				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("buying_selected_land", args), price);
 			}
 			else
 			{
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 5c40d02f8d0..dc8185c770f 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3274,7 +3274,9 @@ void handle_buy_object(LLSaleInfo sale_info)
 	
 	if (price > 0 && price > gStatusBar->getBalance())
 	{
-		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs"), price);
+		LLStringUtil::format_map_t args;
+		args["AMOUNT"] = llformat("%d", price);
+		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs", args), price);
 		return;
 	}
 
@@ -4404,8 +4406,10 @@ void handle_buy_or_take()
 		}
 		else
 		{
+			LLStringUtil::format_map_t args;
+			args["AMOUNT"] = llformat("%d", total_price);
 			LLFloaterBuyCurrency::buyCurrency(
-				"Buying this costs", total_price);
+					LLTrans::getString("BuyingCosts", args), total_price);
 		}
 	}
 	else
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 00762894cda..dfde9a9d1d1 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -811,10 +811,10 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
 				
 				if(!(can_afford_transaction(expected_upload_cost)))
 				{
-					LLFloaterBuyCurrency::buyCurrency(
-									  llformat(LLTrans::getString("UploadingCosts").c_str(),
-										   data->mAssetInfo.getName().c_str()),
-									  expected_upload_cost);
+					LLStringUtil::format_map_t args;
+					args["NAME"] = data->mAssetInfo.getName();
+					args["AMOUNT"] = llformat("%d", expected_upload_cost);
+					LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("UploadingCosts", args), expected_upload_cost);
 					is_balance_sufficient = FALSE;
 				}
 				else if(region)
@@ -1001,7 +1001,9 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
 			if (balance < expected_upload_cost)
 			{
 				// insufficient funds, bail on this upload
-				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs"), expected_upload_cost);
+				LLStringUtil::format_map_t args;
+				args["AMOUNT"] = llformat("%d", expected_upload_cost);
+				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs", args), expected_upload_cost);
 				return;
 			}
 		}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index bd0012057ce..210557f68fd 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -272,7 +272,9 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_
 	}
 	else
 	{
-		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving"), amount);
+		LLStringUtil::format_map_t args;
+		args["AMOUNT"] = llformat("%d", amount);
+		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving", args), amount);
 	}
 }
 
diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
index 961bd6b5e43..e02d32596a1 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
@@ -182,7 +182,7 @@
      width="180"
      layout="topleft"
      name="buy_action">
-        [NAME] L$ [PRICE]
+        [ACTION]
     </text>
     <text
      type="string"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 934b3c8c5c5..47386bd332d 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2202,7 +2202,8 @@ Clears (deletes) the media and all params from the given face.
 	<!-- Viewer menu -->
 	<string name="AcquiredItems">Acquired Items</string>
 	<string name="Cancel">Cancel</string>
-	<string name="UploadingCosts">Uploading %s costs</string>
+	<string name="UploadingCosts">Uploading [NAME] costs L$ [AMOUNT]</string>
+	<string name="BuyingCosts">Buying this costs L$ [AMOUNT]</string>
 	<string name="UnknownFileExtension">
 		Unknown file extension .%s
 Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh
@@ -3060,11 +3061,11 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="to join a group">to join a group</string>
   <string name="to upload">to upload</string>
   
-  <string name="giving">Giving</string>
-  <string name="uploading_costs">Uploading costs</string>
-  <string name="this_costs">This costs</string>
-  <string name="buying_selected_land">Buying selected land</string>
-  <string name="this_object_costs">This object costs"</string>
+  <string name="giving">Giving L$ [AMOUNT]</string>
+  <string name="uploading_costs">Uploading costs L$ [AMOUNT]</string>
+  <string name="this_costs">This costs L$ [AMOUNT]</string>
+  <string name="buying_selected_land">Buying selected land L$ [AMOUNT]</string>
+  <string name="this_object_costs">This object costs L$ [AMOUNT]</string>
   
   <string name="group_role_everyone">Everyone</string>
   <string name="group_role_officers">Officers</string>
-- 
GitLab