From bd14ef42b3ff2ad6319dc05502449de649dfaac8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 17 Nov 2020 01:22:46 +0100 Subject: [PATCH] FIRE-30495: Revert commit 3df26d1e240bb940462ac63b7715d778482d51e7 because it's 2020 and internationalization is still a thing... --- indra/llcommon/llstring.cpp | 8 ++++++-- indra/llui/llresmgr.cpp | 24 ++++-------------------- indra/llui/llresmgr.h | 5 +---- indra/newview/llavatarrendernotifier.cpp | 2 +- indra/newview/llfloaterinspect.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/llfloatersnapshot.cpp | 5 ++++- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/lloutfitslist.cpp | 4 ++-- indra/newview/llpanelmaininventory.cpp | 5 ++++- indra/newview/llpaneloutfitedit.cpp | 2 +- indra/newview/llpanelwearing.cpp | 4 ++-- indra/newview/llstartup.cpp | 8 +------- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llwearableitemslist.cpp | 2 +- 15 files changed, 31 insertions(+), 46 deletions(-) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 1c4d9e3509..3835d6649e 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -1298,7 +1298,9 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals) // std::locale() throws if the locale is unknown! (EXT-7926) try { - strStream.imbue(std::locale(sLocale.c_str())); + // Use user's system locale setting for number formatting + //strStream.imbue(std::locale(sLocale.c_str())); + strStream.imbue(std::locale("")); } catch (const std::exception &) { LL_WARNS_ONCE("Locale") << "Cannot set locale to " << sLocale << LL_ENDL; @@ -1335,7 +1337,9 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals) // std::locale() throws if the locale is unknown! (EXT-7926) try { - strStream.imbue(std::locale(sLocale.c_str())); + // Use user's system locale setting for number formatting + //strStream.imbue(std::locale(sLocale.c_str())); + strStream.imbue(std::locale("")); } catch (const std::exception &) { LL_WARNS_ONCE("Locale") << "Cannot set locale to " << sLocale << LL_ENDL; diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 09580dec24..5d3cbe6c78 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -291,24 +291,16 @@ void LLResMgr::getIntegerString( std::string& output, S32 input ) const } #if LL_WINDOWS -// Make user locale work properly -//const std::string LLLocale::USER_LOCALE("English_United States.1252");// = LLStringUtil::null; -std::string LLLocale::USER_LOCALE("");// = LLStringUtil::null; +const std::string LLLocale::USER_LOCALE("English_United States.1252");// = LLStringUtil::null; const std::string LLLocale::SYSTEM_LOCALE("English_United States.1252"); #elif LL_DARWIN -// Make user locale work properly -//const std::string LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLStringUtil::null; -std::string LLLocale::USER_LOCALE("");// = LLStringUtil::null; +const std::string LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLStringUtil::null; const std::string LLLocale::SYSTEM_LOCALE("en_US.iso8859-1"); #elif LL_SOLARIS -// Make user locale work properly -//const std::string LLLocale::USER_LOCALE("en_US.ISO8859-1"); -std::string LLLocale::USER_LOCALE(""); +const std::string LLLocale::USER_LOCALE("en_US.ISO8859-1"); const std::string LLLocale::SYSTEM_LOCALE("C"); #else // LL_LINUX likes this -// Make user locale work properly -//const std::string LLLocale::USER_LOCALE("en_US.utf8"); -std::string LLLocale::USER_LOCALE(""); +const std::string LLLocale::USER_LOCALE("en_US.utf8"); const std::string LLLocale::SYSTEM_LOCALE("C"); #endif @@ -335,11 +327,3 @@ LLLocale::~LLLocale() { setlocale( LC_ALL, mPrevLocaleString.c_str() ); } - -// Make user locale work properly -//static -void LLLocale::setUserLocale(const std::string& locale) -{ - USER_LOCALE = locale; -} -// diff --git a/indra/llui/llresmgr.h b/indra/llui/llresmgr.h index 8e8278649b..b19d8d40b8 100644 --- a/indra/llui/llresmgr.h +++ b/indra/llui/llresmgr.h @@ -67,10 +67,7 @@ public: LLLocale(const std::string& locale_string); virtual ~LLLocale(); - // Make user locale work properly - //static const std::string USER_LOCALE; - static void setUserLocale(const std::string& locale); - static std::string USER_LOCALE; + static const std::string USER_LOCALE; static const std::string SYSTEM_LOCALE; private: diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 514eddec9d..f006fa1d8f 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -121,7 +121,7 @@ void LLAvatarRenderNotifier::displayNotification(bool show_over_limit) // FIRE-19958: Add digit group separators to avatar complexity notification //args["AGENT_COMPLEXITY"] = LLSD::Integer(mLatestAgentComplexity); { - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); std::string complexity_string; LLResMgr::getInstance()->getIntegerString(complexity_string, mLatestAgentComplexity); args["AGENT_COMPLEXITY"] = complexity_string; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 6415d5f78d..701b057383 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -344,7 +344,7 @@ void LLFloaterInspect::refresh() std::string creator_name; S32 pos = mObjectList->getScrollPos(); // PoundLife - Improved Object Inspect - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr& res_mgr = LLResMgr::instance(); LLSelectMgr& sel_mgr = LLSelectMgr::instance(); S32 fcount = 0; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 94d9c19f88..aeddc0b7ec 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -3343,7 +3343,7 @@ void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box) // Proper number formatting with delimiter //text_box->setText(llformat("%d", value)); std::string output_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(output_string, value); text_box->setText(output_string); } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 3ee97d3fc6..3abdecf955 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -397,7 +397,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater) // *TODO: Separate maximum size for Web images from postcards LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; - LLLocale locale(LLLocale::USER_LOCALE); + // Use user-default locale from operating system + //LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); + // std::string bytes_string; if (got_snap) { diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5377b67f0e..6a920eabda 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2496,7 +2496,7 @@ std::string LLFolderBridge::getLabelSuffix() const //} if (cat_array.size() > 0 || item_array.size() > 0) { - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLStringUtil::format_map_t args; std::string count_str; LLResMgr::getInstance()->getIntegerString(count_str, item_array.size()); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 74d42a1d1c..c0662cddda 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -976,7 +976,7 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id) // FIRE-12939: Add outfit count to outfits list { std::string count_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(count_string, (S32)cat_array.size()); getChild("OutfitcountText")->setTextArg("COUNT", count_string); } @@ -1154,7 +1154,7 @@ void LLOutfitListBase::deselectOutfit(const LLUUID& category_id) void LLOutfitListBase::updateAvatarComplexity(U32 complexity) { std::string complexity_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(complexity_string, complexity); mAvatarComplexityLabel->setTextArg("[WEIGHT]", complexity_string); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 91c6608929..3621570aa2 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1055,7 +1055,10 @@ void LLPanelMainInventory::updateItemcountText() mItemCount = new_count; // mItemCountString = ""; - LLLocale locale(LLLocale::USER_LOCALE); + // Use user-default locale from operating system + //LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); + // LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount); // Include folders in inventory count diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index f3838b9c6d..a3aadf5cc6 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -1441,7 +1441,7 @@ void LLPanelOutfitEdit::saveListSelection() void LLPanelOutfitEdit::updateAvatarComplexity(U32 complexity) { std::string complexity_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(complexity_string, complexity); mAvatarComplexityLabel->setTextArg("[WEIGHT]", complexity_string); diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index ca75a1c1d2..76cb8fcf99 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -489,7 +489,7 @@ bool LLPanelWearing::populateAttachmentsList(bool update) } // Show avatar complexity in appearance floater std::string complexity_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(complexity_string, mTempItemComplexityMap[attachment->getID()]); row["columns"][2]["column"] = "weight"; row["columns"][2]["value"] = complexity_string; @@ -664,7 +664,7 @@ void LLPanelWearing::copyToClipboard() void LLPanelWearing::updateAvatarComplexity(U32 complexity, const std::map& item_complexity, const std::map& temp_item_complexity, U32 body_parts_complexity) { std::string complexity_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(complexity_string, complexity); mAvatarComplexityLabel->setTextArg("[WEIGHT]", complexity_string); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 05b3730a76..7a839d7b1b 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -244,7 +244,6 @@ #include "llnotificationmanager.h" #include "llpresetsmanager.h" #include "llprogressview.h" -#include "llresmgr.h" #include "lltoolbarview.h" #include "NACLantispam.h" #include "streamtitledisplay.h" @@ -619,12 +618,7 @@ bool idle_startup() system = osString.substr (begIdx, endIdx - begIdx); system += "Locale"; - // Make user locale work properly - //LLStringUtil::setLocale (LLTrans::getString(system)); - std::string user_locale = gSavedSettings.getString("Language") == "default" ? "" : LLTrans::getString(system); - LLStringUtil::setLocale(user_locale); - LLLocale::setUserLocale(user_locale); - // + LLStringUtil::setLocale (LLTrans::getString(system)); //note: Removing this line will cause incorrect button size in the login screen. -- bao. gTextureList.updateImages(0.01f) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 29bc5129ef..8fe1ecbb57 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3795,7 +3795,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) (!isSelf() && (!show_too_complex_only_arw_tag || isTooComplex())))) { std::string complexity_string; - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); // always show complexity, even if the reason for a jelly baby is the texture area // this is technically not 100% correct but the decision logic with all of the diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index f101d0a49b..18dccaea3a 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -477,7 +477,7 @@ void FSPanelCOFWearableOutfitListItem::updateItemWeight(U32 item_weight) std::string complexity_string; if (item_weight > 0) { - LLLocale locale(LLLocale::USER_LOCALE); + LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(complexity_string, item_weight); } mWeightCtrl->setText(complexity_string);