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

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

Issue 2406203002: Use BCP47 compliant format for locale representation (Closed)
Patch Set: add more explanations about why Locale.getLanguage/toLanguageTag is not used Created 4 years, 2 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.content.SharedPreferences; 7 import android.content.SharedPreferences;
8 import android.content.pm.PackageInfo; 8 import android.content.pm.PackageInfo;
9 import android.content.pm.PackageManager; 9 import android.content.pm.PackageManager;
10 import android.os.AsyncTask; 10 import android.os.AsyncTask;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 private static ResourceExtractor sInstance; 166 private static ResourceExtractor sInstance;
167 167
168 public static ResourceExtractor get() { 168 public static ResourceExtractor get() {
169 if (sInstance == null) { 169 if (sInstance == null) {
170 sInstance = new ResourceExtractor(); 170 sInstance = new ResourceExtractor();
171 } 171 }
172 return sInstance; 172 return sInstance;
173 } 173 }
174 174
175 private static String[] detectFilesToExtract() { 175 private static String[] detectFilesToExtract() {
176 String language = LocaleUtils.getLanguage(Locale.getDefault()); 176 String language = LocaleUtils.getLocaleLanguage(Locale.getDefault());
177 // Currenty (Oct 2016), this array can be as big as 4 entries, so using a capacity 177 // Currenty (Oct 2016), this array can be as big as 4 entries, so using a capacity
178 // that allows a bit of growth, but is still in the right ballpark.. 178 // that allows a bit of growth, but is still in the right ballpark..
179 ArrayList<String> activeLocalePakFiles = new ArrayList<String>(6); 179 ArrayList<String> activeLocalePakFiles = new ArrayList<String>(6);
180 for (String locale : BuildConfig.COMPRESSED_LOCALES) { 180 for (String locale : BuildConfig.COMPRESSED_LOCALES) {
181 if (locale.startsWith(language)) { 181 if (locale.startsWith(language)) {
182 activeLocalePakFiles.add(locale + ".pak"); 182 activeLocalePakFiles.add(locale + ".pak");
183 } 183 }
184 } 184 }
185 return activeLocalePakFiles.toArray(new String[activeLocalePakFiles.size ()]); 185 return activeLocalePakFiles.toArray(new String[activeLocalePakFiles.size ()]);
186 } 186 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 } 307 }
308 308
309 /** 309 /**
310 * Pak extraction not necessarily required by the embedder. 310 * Pak extraction not necessarily required by the embedder.
311 */ 311 */
312 private static boolean shouldSkipPakExtraction() { 312 private static boolean shouldSkipPakExtraction() {
313 return get().mAssetsToExtract.length == 0; 313 return get().mAssetsToExtract.length == 0;
314 } 314 }
315 } 315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698