diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 17:37:10 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 17:37:10 +0000 |
commit | 5d8d87aaf188a80d6876b2e03167658f308fcd64 (patch) | |
tree | 70e97f52984fd65a72814c7248d4a884d996183b /app | |
parent | 628e3c57a3ca2649d9018982c526142013b60a52 (diff) | |
download | chromium_src-5d8d87aaf188a80d6876b2e03167658f308fcd64.zip chromium_src-5d8d87aaf188a80d6876b2e03167658f308fcd64.tar.gz chromium_src-5d8d87aaf188a80d6876b2e03167658f308fcd64.tar.bz2 |
Decide if we're in RTL or LTR mode by asking GTK+. This prevents
the UI from ever being completely broken.
It's still possible to get a different Chrome language and GTK+
language, but that seems to be true of any GTK+ app.
BUG=16862
Review URL: http://codereview.chromium.org/155776
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21079 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/l10n_util.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/l10n_util.cc b/app/l10n_util.cc index 70755fe..4cda0506 100644 --- a/app/l10n_util.cc +++ b/app/l10n_util.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "build/build_config.h" - #include "app/l10n_util.h" #include "app/app_paths.h" @@ -18,8 +16,13 @@ #include "base/string_piece.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" +#include "build/build_config.h" #include "unicode/uscript.h" +#if defined(TOOLKIT_GTK) +#include <gtk/gtk.h> +#endif + // TODO(playmobil): remove this undef once SkPostConfig.h is fixed. // skia/include/corecg/SkPostConfig.h #defines strcasecmp() so we can't use // base::strcasecmp() without #undefing it here. @@ -510,8 +513,14 @@ string16 ToLower(const string16& string) { // the UI locale of Chrome. 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; +#else const Locale& locale = Locale::getDefault(); g_text_direction = GetTextDirectionForLocale(locale.getName()); +#endif } return g_text_direction; } |