Index: base/android/java/org/chromium/base/LocaleUtils.java |
diff --git a/base/android/java/org/chromium/base/LocaleUtils.java b/base/android/java/org/chromium/base/LocaleUtils.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6bca1f70bd4b348533eebc844002a7c0ea78b908 |
--- /dev/null |
+++ b/base/android/java/org/chromium/base/LocaleUtils.java |
@@ -0,0 +1,26 @@ |
+// 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.base; |
+ |
+import java.util.Locale; |
+ |
+/** |
+ * This class provides the locale related methods for the native library. |
+ */ |
+class LocaleUtils { |
+ |
+ private LocaleUtils() { /* cannot be instantiated */ } |
+ |
+ /** |
+ * @return the default locale. |
+ */ |
+ @CalledByNative |
+ public static String getDefaultLocale() { |
+ Locale locale = Locale.getDefault(); |
+ String language = locale.getLanguage(); |
+ String country = locale.getCountry(); |
+ return country.isEmpty() ? language : language + "-" + country; |
+ } |
+} |