Better translation support relating to client initialization/login.

This commit is contained in:
Shyotl
2012-01-09 01:40:30 -06:00
parent bf28f6514f
commit e9bd6a3b0d
18 changed files with 495 additions and 375 deletions

View File

@@ -130,7 +130,7 @@
#include "llviewermenu.h"
#include "llselectmgr.h"
#include "lltrans.h"
#include "lluitrans.h"
#include "lltrans.h"
#include "lltracker.h"
#include "llviewerparcelmgr.h"
#include "llworldmapview.h"
@@ -365,6 +365,20 @@ class LLDeferredTaskList: public LLSingleton<LLDeferredTaskList>
signal_t mSignal;
};
//----------------------------------------------------------------------------
// List of entries from strings.xml to always replace
static std::set<std::string> default_trans_args;
void init_default_trans_args()
{
default_trans_args.insert("SECOND_LIFE"); // World
default_trans_args.insert("APP_NAME");
default_trans_args.insert("CAPITALIZED_APP_NAME");
default_trans_args.insert("SECOND_LIFE_GRID");
default_trans_args.insert("SUPPORT_SITE");
}
//----------------------------------------------------------------------------
// File scope definitons
const char *VFS_DATA_FILE_BASE = "data.db2.x.";
@@ -598,7 +612,10 @@ bool LLAppViewer::init()
//
// OK to write stuff to logs now, we've now crash reported if necessary
//
if (!initConfiguration())
init_default_trans_args();
if (!initConfiguration())
return false;
LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
@@ -688,12 +705,13 @@ bool LLAppViewer::init()
);
LLWeb::initClass(); // do this after LLUI
LLUICtrlFactory::getInstance()->setupPaths(); // update paths with correct language set
LLTrans::parseStrings("strings.xml", default_trans_args);
LLTextEditor::setURLCallbacks(&LLWeb::loadURL,
&LLURLDispatcher::dispatchFromTextEditor,
&LLURLDispatcher::dispatchFromTextEditor);
LLUICtrlFactory::getInstance()->setupPaths(); // update paths with correct language set
/////////////////////////////////////////////////
//
// Load settings files
@@ -753,18 +771,8 @@ bool LLAppViewer::init()
if (!initCache())
{
std::ostringstream msg;
msg <<
gSecondLife << " is unable to access a file that it needs.\n"
"\n"
"This can be because you somehow have multiple copies running, "
"or your system incorrectly thinks a file is open. "
"If this message persists, restart your computer and try again. "
"If it continues to persist, you may need to completely uninstall " <<
gSecondLife << " and reinstall it.";
OSMessageBox(
msg.str(),
LLStringUtil::null,
OSMB_OK);
msg << LLTrans::getString("MBUnableToAccessFile");
OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK);
return 1;
}
LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ;
@@ -1964,6 +1972,9 @@ bool LLAppViewer::initConfiguration()
return false;
}
LLUICtrlFactory::getInstance()->setupPaths(); // setup paths for LLTrans based on settings files only
LLTrans::parseStrings("strings.xml", default_trans_args);
//COA vars in gSavedSettings will be linked to gSavedPerAccountSettings entries that will be created if not present.
//Signals will be shared between linked vars.
gSavedSettings.connectCOAVars(gSavedPerAccountSettings);
@@ -2048,15 +2059,8 @@ bool LLAppViewer::initConfiguration()
llinfos << "Command line usage:\n" << clp << llendl;
std::ostringstream msg;
msg << "Second Life found an error parsing the command line. \n"
<< "Please see: http://wiki.secondlife.com/wiki/Client_parameters \n"
<< "Error: " << clp.getErrorMessage();
OSMessageBox(
msg.str(),
LLStringUtil::null,
OSMB_OK);
msg << LLTrans::getString("MBCmdLineError") << clp.getErrorMessage();
OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK);
return false;
}
@@ -2100,7 +2104,7 @@ bool LLAppViewer::initConfiguration()
if(clp.hasOption("help"))
{
std::ostringstream msg;
msg << "Command line usage:\n" << clp;
msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp;
llinfos << msg.str() << llendl;
OSMessageBox(
@@ -2264,7 +2268,7 @@ bool LLAppViewer::initConfiguration()
#if LL_DARWIN
// Initialize apple menubar and various callbacks
init_apple_menu(gSecondLife.c_str());
init_apple_menu(LLTrans::getString("APP_NAME").c_str());
#if __ppc__
// If the CPU doesn't have Altivec (i.e. it's not at least a G4), don't go any further.
@@ -2272,7 +2276,7 @@ bool LLAppViewer::initConfiguration()
if(!gSysCPU.hasAltivec())
{
std::ostringstream msg;
msg << gSecondLife << " requires a processor with AltiVec (G4 or later).";
msg << LLTrans::getString("MBRequiresAltiVec");
OSMessageBox(
msg.str(),
LLStringUtil::null,
@@ -2286,10 +2290,11 @@ bool LLAppViewer::initConfiguration()
// Display splash screen. Must be after above check for previous
// crash as this dialog is always frontmost.
std::ostringstream splash_msg;
splash_msg << "Loading " << gSecondLife << "...";
std::string splash_msg;
LLStringUtil::format_map_t args;
splash_msg = LLTrans::getString("StartupLoading", args);
LLSplashScreen::show();
LLSplashScreen::update(splash_msg.str());
LLSplashScreen::update(splash_msg);
//LLVolumeMgr::initClass();
LLVolumeMgr* volume_manager = new LLVolumeMgr();
@@ -2303,12 +2308,11 @@ bool LLAppViewer::initConfiguration()
//
// Set the name of the window
//
#if LL_RELEASE_FOR_DOWNLOAD
gWindowTitle = gSecondLife;
#elif LL_DEBUG
gWindowTitle = gSecondLife + std::string(" [DEBUG] ") + gArgs;
gWindowTitle = LLTrans::getString("APP_NAME");
#if LL_DEBUG
gWindowTitle += std::string(" [DEBUG] ") + gArgs;
#else
gWindowTitle = gSecondLife + std::string(" ") + gArgs;
gWindowTitle += std::string(" ") + gArgs;
#endif
LLStringUtil::truncate(gWindowTitle, 255);
@@ -2345,11 +2349,7 @@ bool LLAppViewer::initConfiguration()
if (mSecondInstance)
{
std::ostringstream msg;
msg <<
gSecondLife << " is already running.\n"
"\n"
"Check your task bar for a minimized copy of the program.\n"
"If this message persists, restart your computer.",
msg << LLTrans::getString("MBAlreadyRunning");
OSMessageBox(
msg.str(),
LLStringUtil::null,
@@ -2418,20 +2418,17 @@ void LLAppViewer::checkForCrash(void)
// Pop up a freeze or crash warning dialog
//
S32 choice;
if(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) == CRASH_BEHAVIOR_ASK)
const S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING);
if(cb == CRASH_BEHAVIOR_ASK)
{
std::ostringstream msg;
msg << gSecondLife
<< " appears to have frozen or crashed on the previous run.\n"
<< "Would you like to send a crash report?";
std::string alert;
alert = gSecondLife;
alert += " Alert";
msg << LLTrans::getString("MBFrozenCrashed");
std::string alert = LLTrans::getString("APP_NAME") + " " + LLTrans::getString("MBAlert");
choice = OSMessageBox(msg.str(),
alert,
OSMB_YESNO);
}
else if(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) == CRASH_BEHAVIOR_NEVER_SEND)
else if(cb == CRASH_BEHAVIOR_NEVER_SEND)
{
choice = OSBTN_NO;
}
@@ -2512,9 +2509,6 @@ bool LLAppViewer::initWindow()
LLUI::sWindow = gViewerWindow->getWindow();
LLTrans::parseStrings("strings.xml");
LLUITrans::parseStrings("ui_strings.xml");
// Show watch cursor
gViewerWindow->setCursor(UI_CURSOR_WAIT);
@@ -2637,7 +2631,7 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true;
// Dump some debugging info
LL_INFOS("SystemInfo") << gSecondLife
LL_INFOS("SystemInfo") << LLTrans::getString("APP_NAME")
<< " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH
<< LL_ENDL;
@@ -3237,14 +3231,14 @@ bool LLAppViewer::initCache()
if (mPurgeCache && !read_only)
{
LLSplashScreen::update("Clearing cache...");
LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
purgeCache();
// <edit>
texture_cache_mismatch = false;
// </edit>
}
LLSplashScreen::update("Initializing Texture Cache...");
LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
// Init the texture cache
// Allocate 80% of the cache size for textures
@@ -3272,7 +3266,7 @@ bool LLAppViewer::initCache()
LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ;
LLSplashScreen::update("Initializing VFS...");
LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS"));
// Init the VFS
vfs_size = llmin(vfs_size + extra, MAX_VFS_SIZE);
@@ -3433,7 +3427,7 @@ void LLAppViewer::addOnIdleCallback(const boost::function<void()>& cb)
void LLAppViewer::purgeCache()
{
LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << llendl;
LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << LL_ENDL;
LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE);
LLVOCache::getInstance()->removeCache(LL_PATH_CACHE);
std::string mask = "*.*";
@@ -4076,7 +4070,7 @@ void LLAppViewer::idleShutdown()
S32 finished_uploads = total_uploads - pending_uploads;
F32 percent = 100.f * finished_uploads / total_uploads;
gViewerWindow->setProgressPercent(percent);
gViewerWindow->setProgressString("Saving final data...");
gViewerWindow->setProgressString(LLTrans::getString("SavingSettings"));
return;
}
@@ -4088,7 +4082,7 @@ void LLAppViewer::idleShutdown()
// Wait for a LogoutReply message
gViewerWindow->setShowProgress(!gSavedSettings.getBOOL("AscentDisableLogoutScreens"));
gViewerWindow->setProgressPercent(100.f);
gViewerWindow->setProgressString("Logging out...");
gViewerWindow->setProgressString(LLTrans::getString("LoggingOut"));
return;
}
@@ -4300,8 +4294,8 @@ void LLAppViewer::idleNetwork()
{
LLUUID this_region_id = agent_region->getRegionID();
bool this_region_alive = agent_region->isAlive();
if (mAgentRegionLastAlive && !this_region_alive // newly dead
&& mAgentRegionLastID == this_region_id) // same region
if ((mAgentRegionLastAlive && !this_region_alive) // newly dead
&& (mAgentRegionLastID == this_region_id)) // same region
{
forceDisconnect(LLTrans::getString("AgentLostConnection"));
}