FIRE-30495: Revert commit 3df26d1e24 because it's 2020 and internationalization is still a thing...

master
Ansariel 2020-11-17 01:22:46 +01:00
parent 6ff52d3284
commit bd14ef42b3
15 changed files with 31 additions and 46 deletions

View File

@ -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()));
// <FS:Ansariel> 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()));
// <FS:Ansariel> 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;

View File

@ -291,24 +291,16 @@ void LLResMgr::getIntegerString( std::string& output, S32 input ) const
}
#if LL_WINDOWS
// <FS:Ansariel> 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
// <FS:Ansariel> 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
// <FS:Ansariel> 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
// <FS:Ansariel> 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() );
}
// <FS:Ansariel> Make user locale work properly
//static
void LLLocale::setUserLocale(const std::string& locale)
{
USER_LOCALE = locale;
}
// </FS:Ansariel>

View File

@ -67,10 +67,7 @@ public:
LLLocale(const std::string& locale_string);
virtual ~LLLocale();
// <FS:Ansariel> 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:

View File

@ -121,7 +121,7 @@ void LLAvatarRenderNotifier::displayNotification(bool show_over_limit)
// <FS:Ansariel> 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;

View File

@ -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;

View File

@ -3343,7 +3343,7 @@ void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box)
// <FS:Ansariel> 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);
}

View File

@ -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);
// <FS:Ansariel> Use user-default locale from operating system
//LLLocale locale(LLLocale::USER_LOCALE);
LLLocale locale("");
// </FS:Ansariel>
std::string bytes_string;
if (got_snap)
{

View File

@ -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());

View File

@ -976,7 +976,7 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
// <FS:Ansariel> 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<LLTextBox>("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);

View File

@ -1055,7 +1055,10 @@ void LLPanelMainInventory::updateItemcountText()
mItemCount = new_count;
// </FS:Ansariel>
mItemCountString = "";
LLLocale locale(LLLocale::USER_LOCALE);
// <FS:Ansariel> Use user-default locale from operating system
//LLLocale locale(LLLocale::USER_LOCALE);
LLLocale locale("");
// </FS:Ansariel>
LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
// <FS:Ansariel> Include folders in inventory count

View File

@ -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);

View File

@ -489,7 +489,7 @@ bool LLPanelWearing::populateAttachmentsList(bool update)
}
// <FS:Ansariel> 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<LLUUID, U32>& item_complexity, const std::map<LLUUID, U32>& 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);

View File

@ -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";
// <FS:Ansariel> 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);
// </FS:Ansariel>
LLStringUtil::setLocale (LLTrans::getString(system));
//note: Removing this line will cause incorrect button size in the login screen. -- bao.
gTextureList.updateImages(0.01f) ;

View File

@ -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

View File

@ -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);