summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2008-11-19 23:26:29 +0000
committerJames Cook <james@lindenlab.com>2008-11-19 23:26:29 +0000
commit2a44e81675d22aa5ed0844d5a4ac18bb9bd49f64 (patch)
tree595dd4b8b7beac938fc0e14ee075e5cfeb1f129b /indra/llui
parent2d2d427158ca2465e2d70d84b4499cab57e2e208 (diff)
QAR-1018 Lightweight Windows Setup App (windows-setup-3). svn merge -r102882:102883 svn+ssh://svn.lindenlab.com/svn/linden/branches/windows-setup/windows-setup-3-merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp1
-rw-r--r--indra/llui/llui.cpp36
-rw-r--r--indra/llui/llui.h19
-rw-r--r--indra/llui/lluictrlfactory.cpp10
4 files changed, 40 insertions, 26 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 3f6338006f..47b7067f63 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -38,6 +38,7 @@
#include "llstring.h"
// Project includes
+#include "llhtmlhelp.h"
#include "llkeyboard.h"
#include "llui.h"
#include "lluiconstants.h"
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 472f8606b1..f1e7b98a60 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -30,8 +30,6 @@
*/
// Utilities functions the user interface needs
-
-//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include <string>
@@ -1647,6 +1645,34 @@ void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y)
setCursorPositionScreen(screen_x, screen_y);
}
+// On Windows, the user typically sets the language when they install the
+// app (by running it with a shortcut that sets InstallLanguage). On Mac,
+// or on Windows if the SecondLife.exe executable is run directly, the
+// language follows the OS language. In all cases the user can override
+// the language manually in preferences. JC
+// static
+std::string LLUI::getLanguage()
+{
+ std::string language = "en-us";
+ if (sConfigGroup)
+ {
+ language = sConfigGroup->getString("Language");
+ if (language.empty() || language == "default")
+ {
+ language = sConfigGroup->getString("InstallLanguage");
+ }
+ if (language.empty() || language == "default")
+ {
+ language = sConfigGroup->getString("SystemLanguage");
+ }
+ if (language.empty() || language == "default")
+ {
+ language = "en-us";
+ }
+ }
+ return language;
+}
+
//static
std::string LLUI::locateSkin(const std::string& filename)
{
@@ -1660,11 +1686,7 @@ std::string LLUI::locateSkin(const std::string& filename)
{
if (!gDirUtilp->fileExists(found_file))
{
- std::string localization(sConfigGroup->getString("Language"));
- if(localization == "default")
- {
- localization = sConfigGroup->getString("SystemLanguage");
- }
+ std::string localization = getLanguage();
std::string local_skin = "xui" + slash + localization + slash + filename;
found_file = gDirUtilp->findSkinnedFilename(local_skin);
}
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index d434dbd6d1..aa3cff433e 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -38,15 +38,17 @@
#include "llcontrol.h"
#include "llrect.h"
#include "llcoord.h"
-#include "llhtmlhelp.h"
-#include "llgl.h"
+//#include "llhtmlhelp.h"
+#include "llgl.h" // *TODO: break this dependency
#include <stack>
-#include "llimagegl.h"
+//#include "llimagegl.h"
// LLUIFactory
#include "llsd.h"
class LLColor4;
+class LLHtmlHelp;
+class LLImageGL;
class LLVector3;
class LLVector2;
class LLUUID;
@@ -139,13 +141,6 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL
gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled );
}
-// No longer used
-// Initializes translation table
-// void init_tr();
-
-// Returns a string from the string table in the correct language
-// std::string tr(const std::string& english_chars);
-
// Used to hide the flashing text cursor when window doesn't have focus.
extern BOOL gShowTextEditCursor;
@@ -172,6 +167,10 @@ public:
static void loadIdentity();
static void translate(F32 x, F32 y, F32 z = 0.0f);
+ // Return the ISO639 language name ("en", "ko", etc.) for the viewer UI.
+ // http://www.loc.gov/standards/iso639-2/php/code_list.php
+ static std::string getLanguage();
+
//helper functions (should probably move free standing rendering helper functions here)
static std::string locateSkin(const std::string& filename);
static void setCursorPositionScreen(S32 x, S32 y);
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index eaaa9990a0..da718c8a33 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -130,15 +130,7 @@ void LLUICtrlFactory::setupPaths()
for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling())
{
LLUIString path_val_ui(path->getValue());
- std::string language = "en-us";
- if (LLUI::sConfigGroup)
- {
- language = LLUI::sConfigGroup->getString("Language");
- if(language == "default")
- {
- language = LLUI::sConfigGroup->getString("SystemLanguage");
- }
- }
+ std::string language = LLUI::getLanguage();
path_val_ui.setArg("[LANGUAGE]", language);
if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui.getString()) == sXUIPaths.end())