From 0ccf2b5a1c08c897326c0ce47caa48e30ec4b5fa Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Wed, 21 Dec 2011 14:10:02 +0200
Subject: [PATCH] EXP-1693 FIXED the date localization in Item Profile window,
 Voice Morphs window and in scroll list widget in general. - Added a
 customizable date format string to be used for scroll list cell of "date"
 type. - The date localization does not change the value of a scroll list cell
 changing only its string representation. - Added using localized week days
 and month names from strings.xml for all locales not only Ja and Pl as it was
 before. - Changed the date format in Item Profile window (French locale) as
 noted in the issue description. - For this fix the French locale still needs
 the localization of the following strings in strings.xml: 	<string
 name="dateTimeWeekdaysNames"> 	<string name="dateTimeWeekdaysShortNames"> 
 <string name="dateTimeMonthNames"> 	<string
 name="dateTimeMonthShortNames"> 	<string name="dateTimeDayFormat"> 
 <string name="dateTimeAM"> 	<string name="dateTimePM">

---
 indra/llcommon/llstring.cpp                   |  5 ++++
 indra/llui/llscrolllistcell.cpp               | 10 +++++++-
 indra/newview/llappviewer.cpp                 | 23 +++++++------------
 .../newview/skins/default/xui/en/strings.xml  |  3 +++
 .../default/xui/fr/sidepanel_item_info.xml    |  2 +-
 5 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index e7fe6568085..1193a4ef8db 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -1122,6 +1122,11 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
 		struct tm * gmt = gmtime (&loc_seconds);
 		replacement = LLStringOps::sMonthList[gmt->tm_mon];
 	}
+	else if(LLStringOps::sMonthShortList.size() == 12 && code == "%b")
+	{
+		struct tm * gmt = gmtime (&loc_seconds);
+		replacement = LLStringOps::sMonthShortList[gmt->tm_mon];
+	}
 	else if( !LLStringOps::sDayFormat.empty() && code == "%d" )
 	{
 		struct tm * gmt = gmtime (&loc_seconds);
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 9d25c7180dd..786e18b1878 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -29,6 +29,8 @@
 
 #include "llscrolllistcell.h"
 
+#include "lltrans.h"
+
 #include "llcheckboxctrl.h"
 #include "llui.h"	// LLUIImage
 #include "lluictrlfactory.h"
@@ -428,7 +430,13 @@ LLScrollListDate::LLScrollListDate( const LLScrollListCell::Params& p)
 void LLScrollListDate::setValue(const LLSD& value)
 {
 	mDate = value.asDate();
-	LLScrollListText::setValue(mDate.asRFC1123());
+
+	std::string date_str = LLTrans::getString("ScrollListCellDateFormat");
+	LLSD substitution;
+	substitution["datetime"] = mDate.secondsSinceEpoch();
+	LLStringUtil::format(date_str, substitution);
+
+	LLScrollListText::setValue(date_str);
 }
 
 const LLSD LLScrollListDate::getValue() const
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index b45f9c55fba..9595e82a076 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1043,21 +1043,14 @@ bool LLAppViewer::init()
 
 	LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
 
-	//EXT-7013 - On windows for some locale (Japanese) standard 
-	//datetime formatting functions didn't support some parameters such as "weekday".
-	//Names for days and months localized in xml are also useful for Polish locale(STORM-107).
-	std::string language = gSavedSettings.getString("Language");
-	if(language == "ja" || language == "pl")
-	{
-		LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames"));
-		LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames"));
-		LLStringOps::setupMonthNames(LLTrans::getString("dateTimeMonthNames"));
-		LLStringOps::setupMonthShortNames(LLTrans::getString("dateTimeMonthShortNames"));
-		LLStringOps::setupDayFormat(LLTrans::getString("dateTimeDayFormat"));
-
-		LLStringOps::sAM = LLTrans::getString("dateTimeAM");
-		LLStringOps::sPM = LLTrans::getString("dateTimePM");
-	}
+	LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames"));
+	LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames"));
+	LLStringOps::setupMonthNames(LLTrans::getString("dateTimeMonthNames"));
+	LLStringOps::setupMonthShortNames(LLTrans::getString("dateTimeMonthShortNames"));
+	LLStringOps::setupDayFormat(LLTrans::getString("dateTimeDayFormat"));
+
+	LLStringOps::sAM = LLTrans::getString("dateTimeAM");
+	LLStringOps::sPM = LLTrans::getString("dateTimePM");
 
 	LLAgentLanguage::init();
 
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index ac5b027ea1c..e31fd167bc5 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3498,6 +3498,9 @@ Abuse Report</string>
   <string name="dateTimeDayFormat">[MDAY]</string>
   <string name="dateTimeAM">AM</string>
   <string name="dateTimePM">PM</string>
+  
+  <!-- Format string for displaying a localized date in a scroll list cell of type "date" -->
+  <string name="ScrollListCellDateFormat">[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]</string>
 
   <!--  currency formatting -->
   <string name="LocalEstimateUSD">US$ [AMOUNT]</string>
diff --git a/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml b/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml
index 95649d39348..0b5333fc80e 100644
--- a/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml
@@ -13,7 +13,7 @@
 		Le propriétaire peut :
 	</panel.string>
 	<panel.string name="acquiredDate">
-		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
+		[wkday,datetime,local] [day,datetime,local] [mth,datetime,local] [year,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local]
 	</panel.string>
 	<panel.string name="origin_inventory">
 		(inventaire)
-- 
GitLab