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

Side by Side Diff: base/android/java/src/org/chromium/base/LocaleUtils.java

Issue 548023002: Migrate ResourceExtractor.java inside org.chromium.base package. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments addressed. Created 6 years, 3 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.base;
6
7 import java.util.Locale;
8
9 /**
10 * This class provides the locale related methods.
11 */
12 public abstract class LocaleUtils {
Ted C 2014/09/09 23:18:42 I think for non-instantiatable we typically use th
13
14 /**
15 * @return the default locale, translating Android deprecated
16 * language codes into the modern ones used by Chromium.
17 */
18 public static String getDefaultLocale() {
19 Locale locale = Locale.getDefault();
20 String language = locale.getLanguage();
21 String country = locale.getCountry();
22
23 // Android uses deprecated lanuages codes for Hebrew and Indonesian but Chromium uses the
24 // updated codes. Also, Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino.
25 // So apply a mapping.
26 // See http://developer.android.com/reference/java/util/Locale.html
27 if ("iw".equals(language)) {
28 language = "he";
29 } else if ("in".equals(language)) {
30 language = "id";
31 } else if ("tl".equals(language)) {
32 language = "fil";
33 }
34 return country.isEmpty() ? language : language + "-" + country;
35 }
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698