From dba05505ee0d5ad23cd7b2fab44271b3487b2712 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Mon, 22 Nov 2010 17:18:59 +0200
Subject: [PATCH] STORM-517 FIXED Warn user that language change will only take
 effect after restarting viewer.

The warning is shown only once (until the preferences floater is reopened).
---
 indra/newview/llfloaterpreference.cpp          | 18 ++++++++++++++++++
 indra/newview/llfloaterpreference.h            |  2 ++
 .../skins/default/xui/en/notifications.xml     |  7 +++++++
 3 files changed, 27 insertions(+)

diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index ac940f4f77..6a7b5171b5 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -283,6 +283,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	: LLFloater(key),
 	mGotPersonalInfo(false),
 	mOriginalIMViaEmail(false),
+	mLanguageChanged(false),
 	mDoubleClickActionDirty(false)
 {
 	//Build Floater is now Called from 	LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
@@ -351,6 +352,8 @@ BOOL LLFloaterPreference::postBuild()
 	std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
 	setCacheLocation(cache_location);
 
+	getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
+
 	// if floater is opened before login set default localized busy message
 	if (LLStartUp::getStartupState() < STATE_STARTED)
 	{
@@ -570,6 +573,9 @@ void LLFloaterPreference::onOpen(const LLSD& key)
 		getChildView("maturity_desired_combobox")->setVisible( false);
 	}
 
+	// Forget previous language changes.
+	mLanguageChanged = false;
+
 	// Display selected maturity icons.
 	onChangeMaturity();
 	
@@ -727,6 +733,18 @@ void LLFloaterPreference::onClickBrowserClearCache()
 	LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache);
 }
 
+// Called when user changes language via the combobox.
+void LLFloaterPreference::onLanguageChange()
+{
+	// Let the user know that the change will only take effect after restart.
+	// Do it only once so that we're not too irritating.
+	if (!mLanguageChanged)
+	{
+		LLNotificationsUtil::add("ChangeLanguage");
+		mLanguageChanged = true;
+	}
+}
+
 void LLFloaterPreference::onClickSetCache()
 {
 	std::string cur_name(gSavedSettings.getString("CacheLocation"));
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 46f50d9a4d..bb871e7e25 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -83,6 +83,7 @@ protected:
 	void		onBtnApply();
 
 	void		onClickBrowserClearCache();
+	void		onLanguageChange();
 
 	// set value of "BusyResponseChanged" in account settings depending on whether busy response
 	// string differs from default after user changes.
@@ -158,6 +159,7 @@ private:
 	bool mDoubleClickActionDirty;
 	bool mGotPersonalInfo;
 	bool mOriginalIMViaEmail;
+	bool mLanguageChanged;
 	
 	bool mOriginalHideOnlineStatus;
 	std::string mDirectoryVisibility;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 9536bf2cf7..60b876d163 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -907,6 +907,13 @@ Port settings take effect after you restart [APP_NAME].
 The new skin will appear after you restart [APP_NAME].
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="ChangeLanguage"
+   type="alertmodal">
+Changing language will take effect after you restart [APP_NAME].
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="GoToAuctionPage"
-- 
GitLab