Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: ui/android/java/src/org/chromium/ui/LocalizationUtils.java

Issue 70843003: ui: Android changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dom_distiller fixes Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/android/java/src/org/chromium/ui/LocalizationUtils.java
diff --git a/ui/android/java/src/org/chromium/ui/LocalizationUtils.java b/ui/android/java/src/org/chromium/ui/LocalizationUtils.java
deleted file mode 100644
index f421d8939f18e8c9a90ec9913cfa761636fc6931..0000000000000000000000000000000000000000
--- a/ui/android/java/src/org/chromium/ui/LocalizationUtils.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.ui;
-
-import org.chromium.base.CalledByNative;
-import org.chromium.base.JNINamespace;
-
-import android.os.Build;
-import android.text.TextUtils;
-import android.view.View;
-
-import java.util.Locale;
-
-/**
- * This class provides the locale related methods for the native library.
- */
-@JNINamespace("l10n_util")
-public class LocalizationUtils {
-
- // This is mirrored from base/i18n/rtl.h. Please keep in sync.
- public static final int UNKNOWN_DIRECTION = 0;
- public static final int RIGHT_TO_LEFT = 1;
- public static final int LEFT_TO_RIGHT = 2;
-
- private LocalizationUtils() { /* cannot be instantiated */ }
-
- /**
- * @return the default locale, translating Android deprecated
- * language codes into the modern ones used by Chromium.
- */
- @CalledByNative
- public static String getDefaultLocale() {
- Locale locale = Locale.getDefault();
- String language = locale.getLanguage();
- String country = locale.getCountry();
-
- // Android uses deprecated lanuages codes for Hebrew and Indonesian but Chromium uses the
- // updated codes. Also, Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino.
- // So apply a mapping.
- // See http://developer.android.com/reference/java/util/Locale.html
- if ("iw".equals(language)) {
- language = "he";
- } else if ("in".equals(language)) {
- language = "id";
- } else if ("tl".equals(language)) {
- language = "fil";
- }
- return country.isEmpty() ? language : language + "-" + country;
- }
-
- @CalledByNative
- private static Locale getJavaLocale(String language, String country, String variant) {
- return new Locale(language, country, variant);
- }
-
- @CalledByNative
- private static String getDisplayNameForLocale(Locale locale, Locale displayLocale) {
- return locale.getDisplayName(displayLocale);
- }
-
- /**
- * @return true if the system default layout direction is RTL, false otherwise.
- * RTL layout support is from Jelly Bean MR1, so if the version is lower
- * than that, it is always false.
- */
- public static boolean isSystemLayoutDirectionRtl() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
- == View.LAYOUT_DIRECTION_RTL;
- }
- return false;
- }
-
- /**
- * Jni binding to base::i18n::IsRTL.
- * @return true if the current locale is right to left.
- */
- public static boolean isRtl() {
- return nativeIsRTL();
- }
-
- /**
- * Jni binding to base::i18n::GetFirstStrongCharacterDirection
- * @param string String to decide the direction.
- * @return One of the UNKNOWN_DIRECTION, RIGHT_TO_LEFT, and LEFT_TO_RIGHT.
- */
- public static int getFirstStrongCharacterDirection(String string) {
- return nativeGetFirstStrongCharacterDirection(string);
- }
-
- private static native boolean nativeIsRTL();
-
- private static native int nativeGetFirstStrongCharacterDirection(String string);
-}
« no previous file with comments | « ui/android/java/src/org/chromium/ui/Clipboard.java ('k') | ui/android/java/src/org/chromium/ui/SelectFileDialog.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698