summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authorjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-16 00:02:31 +0000
committerjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-16 00:02:31 +0000
commit86b0c51cdf413e0ad66000aed3df7c76a320bd48 (patch)
treed6dd322e387ad0938a57f97d1e29df1325283dcc /webkit/port
parent6d5a5e92652f07e86ad7a397d198437853a5f210 (diff)
downloadchromium_src-86b0c51cdf413e0ad66000aed3df7c76a320bd48.zip
chromium_src-86b0c51cdf413e0ad66000aed3df7c76a320bd48.tar.gz
chromium_src-86b0c51cdf413e0ad66000aed3df7c76a320bd48.tar.bz2
Make navigator.language depend on the current UI language of Chrome rather than
the UI language of the Windows. BUG=1862 TEST=Switch the Chrome UI language to pt-PT, fr, ja, etc and try 1862test.html (attached to issue 1862). navigator.language should be pt-PT, fr, ja. Review URL: http://codereview.chromium.org/3073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/platform/Language.cpp29
1 files changed, 4 insertions, 25 deletions
diff --git a/webkit/port/platform/Language.cpp b/webkit/port/platform/Language.cpp
index c6f3ccf..412da20 100644
--- a/webkit/port/platform/Language.cpp
+++ b/webkit/port/platform/Language.cpp
@@ -29,41 +29,20 @@
#include "CString.h"
#include "PlatformString.h"
+#include "webkit/glue/glue_util.h"
+#include "webkit/glue/webkit_glue.h"
namespace WebCore {
-static String localeInfo(LCTYPE localeType, const String& fallback)
-{
- LANGID langID = GetUserDefaultUILanguage();
- int localeChars = GetLocaleInfo(langID, localeType, 0, 0);
- if (!localeChars)
- return fallback;
- Vector<WCHAR> localeNameBuf(localeChars);
- localeChars = GetLocaleInfo(langID, localeType, localeNameBuf.data(), localeChars);
- if (!localeChars)
- return fallback;
- String localeName = String::adopt(localeNameBuf);
- if (localeName.isEmpty())
- return fallback;
-
- return localeName;
-}
-
String defaultLanguage()
{
static String computedDefaultLanguage;
if (!computedDefaultLanguage.isEmpty())
return computedDefaultLanguage;
- String languageName = localeInfo(LOCALE_SISO639LANGNAME, "en");
- String countryName = localeInfo(LOCALE_SISO3166CTRYNAME, String());
-
- if (countryName.isEmpty())
- computedDefaultLanguage = languageName;
- else
- computedDefaultLanguage = String::format("%s-%s", languageName.latin1().data(), countryName.latin1().data());
-
+ computedDefaultLanguage =
+ webkit_glue::StdWStringToString(webkit_glue::GetWebKitLocale());
return computedDefaultLanguage;
}