summaryrefslogtreecommitdiffstats
path: root/app/l10n_util.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 08:27:32 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 08:27:32 +0000
commitf8f606ef03a8afd7564c7f5a1bf82b54e6a6b392 (patch)
treebebb9be6f4b3a4a090917db063177fb5fb58f1dc /app/l10n_util.cc
parent2cf57c8de64c62ec4f9c18ebf30b30961b208c3e (diff)
downloadchromium_src-f8f606ef03a8afd7564c7f5a1bf82b54e6a6b392.zip
chromium_src-f8f606ef03a8afd7564c7f5a1bf82b54e6a6b392.tar.gz
chromium_src-f8f606ef03a8afd7564c7f5a1bf82b54e6a6b392.tar.bz2
linux: use ICU direction for determining text direction in renderer
We use the GTK text direction in the browser process, but that is not available in the renderer. BUG=36624 TEST=Arabic error pages are properly RTL Review URL: http://codereview.chromium.org/660176 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/l10n_util.cc')
-rw-r--r--app/l10n_util.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/app/l10n_util.cc b/app/l10n_util.cc
index 8d418d2..727fe25 100644
--- a/app/l10n_util.cc
+++ b/app/l10n_util.cc
@@ -434,8 +434,8 @@ void SplitAndNormalizeLanguageList(const std::string& env_language,
namespace l10n_util {
-// Represents the locale-specific text direction.
-static TextDirection g_text_direction = UNKNOWN_DIRECTION;
+// Represents the locale-specific ICU text direction.
+static TextDirection g_icu_text_direction = UNKNOWN_DIRECTION;
std::string GetApplicationLocale(const std::wstring& pref_locale) {
#if !defined(OS_MACOSX)
@@ -809,21 +809,21 @@ string16 ToUpper(const string16& string) {
return result;
}
-// Returns the text direction for the default ICU locale. It is assumed
-// that SetICUDefaultLocale has been called to set the default locale to
-// the UI locale of Chrome.
+TextDirection GetICUTextDirection() {
+ if (g_icu_text_direction == UNKNOWN_DIRECTION) {
+ const icu::Locale& locale = icu::Locale::getDefault();
+ g_icu_text_direction = GetTextDirectionForLocale(locale.getName());
+ }
+ return g_icu_text_direction;
+}
+
TextDirection GetTextDirection() {
- if (g_text_direction == UNKNOWN_DIRECTION) {
#if defined(TOOLKIT_GTK)
- GtkTextDirection gtk_dir = gtk_widget_get_default_direction();
- g_text_direction =
- (gtk_dir == GTK_TEXT_DIR_LTR) ? LEFT_TO_RIGHT : RIGHT_TO_LEFT;
+ GtkTextDirection gtk_dir = gtk_widget_get_default_direction();
+ return (gtk_dir == GTK_TEXT_DIR_LTR) ? LEFT_TO_RIGHT : RIGHT_TO_LEFT;
#else
- const icu::Locale& locale = icu::Locale::getDefault();
- g_text_direction = GetTextDirectionForLocale(locale.getName());
+ return GetICUTextDirection();
#endif
- }
- return g_text_direction;
}
TextDirection GetTextDirectionForLocale(const char* locale_name) {