Loading core/java/android/os/LocaleList.java +5 −1 Original line number Diff line number Diff line Loading @@ -295,7 +295,11 @@ public final class LocaleList implements Parcelable { return STRING_EN_XA.equals(locale) || STRING_AR_XB.equals(locale); } private static boolean isPseudoLocale(Locale locale) { /** * Returns true if locale is a pseudo-locale, false otherwise. * {@hide} */ public static boolean isPseudoLocale(Locale locale) { return LOCALE_EN_XA.equals(locale) || LOCALE_AR_XB.equals(locale); } Loading core/java/com/android/internal/app/LocaleHelper.java +10 −1 Original line number Diff line number Diff line Loading @@ -136,7 +136,16 @@ public class LocaleHelper { * @return the localized country name. */ public static String getDisplayCountry(Locale locale, Locale displayLocale) { return ULocale.getDisplayCountry(locale.toLanguageTag(), ULocale.forLocale(displayLocale)); final String languageTag = locale.toLanguageTag(); final ULocale uDisplayLocale = ULocale.forLocale(displayLocale); final String country = ULocale.getDisplayCountry(languageTag, uDisplayLocale); final String numberingSystem = locale.getUnicodeLocaleType("nu"); if (numberingSystem != null) { return String.format("%s (%s)", country, ULocale.getDisplayKeywordValue(languageTag, "numbers", uDisplayLocale)); } else { return country; } } /** Loading core/java/com/android/internal/app/LocalePicker.java +4 −11 Original line number Diff line number Diff line Loading @@ -93,10 +93,6 @@ public class LocalePicker extends ListFragment { return context.getResources().getStringArray(R.array.supported_locales); } public static String[] getPseudoLocales() { return pseudoLocales; } public static List<LocaleInfo> getAllAssetLocales(Context context, boolean isInDeveloperMode) { final Resources resources = context.getResources(); Loading @@ -104,13 +100,6 @@ public class LocalePicker extends ListFragment { List<String> localeList = new ArrayList<String>(locales.length); Collections.addAll(localeList, locales); // Don't show the pseudolocales unless we're in developer mode. http://b/17190407. if (!isInDeveloperMode) { for (String locale : pseudoLocales) { localeList.remove(locale); } } Collections.sort(localeList); final String[] specialLocaleCodes = resources.getStringArray(R.array.special_locale_codes); final String[] specialLocaleNames = resources.getStringArray(R.array.special_locale_names); Loading @@ -122,6 +111,10 @@ public class LocalePicker extends ListFragment { || l.getLanguage().isEmpty() || l.getCountry().isEmpty()) { continue; } // Don't show the pseudolocales unless we're in developer mode. http://b/17190407. if (!isInDeveloperMode && LocaleList.isPseudoLocale(l)) { continue; } if (localeInfos.isEmpty()) { if (DEBUG) { Loading core/java/com/android/internal/app/LocaleStore.java +18 −14 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.app; import android.content.Context; import android.os.LocaleList; import android.provider.Settings; import android.telephony.TelephonyManager; Loading Loading @@ -68,7 +69,9 @@ public class LocaleStore { return null; } return new Locale.Builder() .setLocale(locale).setRegion("") .setLocale(locale) .setRegion("") .setExtension(Locale.UNICODE_LOCALE_EXTENSION, "") .build(); } Loading Loading @@ -253,11 +256,25 @@ public class LocaleStore { Set<String> simCountries = getSimCountries(context); final boolean isInDeveloperMode = Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0; for (String localeId : LocalePicker.getSupportedLocales(context)) { if (localeId.isEmpty()) { throw new IllformedLocaleException("Bad locale entry in locale_config.xml"); } LocaleInfo li = new LocaleInfo(localeId); if (LocaleList.isPseudoLocale(li.getLocale())) { if (isInDeveloperMode) { li.setTranslated(true); li.mIsPseudo = true; li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM; } else { // Do not display pseudolocales unless in development mode. continue; } } if (simCountries.contains(li.getLocale().getCountry())) { li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM; } Loading @@ -271,19 +288,6 @@ public class LocaleStore { } } boolean isInDeveloperMode = Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0; for (String localeId : LocalePicker.getPseudoLocales()) { LocaleInfo li = getLocaleInfo(Locale.forLanguageTag(localeId)); if (isInDeveloperMode) { li.setTranslated(true); li.mIsPseudo = true; li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM; } else { sLocaleCache.remove(li.getId()); } } // TODO: See if we can reuse what LocaleList.matchScore does final HashSet<String> localizedLocales = new HashSet<>(); for (String localeId : LocalePicker.getSystemAssetLocales()) { Loading core/res/res/values/locale_config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ <item>ar-DJ</item> <!-- Arabic (Djibouti) --> <item>ar-DZ</item> <!-- Arabic (Algeria) --> <item>ar-EG</item> <!-- Arabic (Egypt) --> <item>ar-EG-u-nu-latn</item> <!-- Arabic (Egypt,Western Digits) --> <item>ar-EH</item> <!-- Arabic (Western Sahara) --> <item>ar-ER</item> <!-- Arabic (Eritrea) --> <item>ar-IL</item> <!-- Arabic (Israel) --> Loading @@ -48,6 +49,7 @@ <item>ar-SY</item> <!-- Arabic (Syria) --> <item>ar-TD</item> <!-- Arabic (Chad) --> <item>ar-TN</item> <!-- Arabic (Tunisia) --> <item>ar-TN-u-nu-arab</item> <!-- Arabic (Tunisia,Arabic-Indic Digits) --> <item>ar-XB</item> <!-- Right-to-left pseudolocale --> <item>ar-YE</item> <!-- Arabic (Yemen) --> <item>as-IN</item> <!-- Assamese (India) --> Loading Loading @@ -366,6 +368,7 @@ <item>ms-SG</item> <!-- Malay (Singapore) --> <item>mt-MT</item> <!-- Maltese (Malta) --> <item>my-MM</item> <!-- Burmese (Myanmar (Burma)) --> <item>my-MM-u-nu-latn</item> <!-- Burmese (Myanmar (Burma), Western Digits) --> <item>mzn-IR</item> <!-- Mazanderani (Iran) --> <item>naq-NA</item> <!-- Nama (Namibia) --> <item>nb-NO</item> <!-- Norwegian Bokmål (Norway) --> Loading Loading
core/java/android/os/LocaleList.java +5 −1 Original line number Diff line number Diff line Loading @@ -295,7 +295,11 @@ public final class LocaleList implements Parcelable { return STRING_EN_XA.equals(locale) || STRING_AR_XB.equals(locale); } private static boolean isPseudoLocale(Locale locale) { /** * Returns true if locale is a pseudo-locale, false otherwise. * {@hide} */ public static boolean isPseudoLocale(Locale locale) { return LOCALE_EN_XA.equals(locale) || LOCALE_AR_XB.equals(locale); } Loading
core/java/com/android/internal/app/LocaleHelper.java +10 −1 Original line number Diff line number Diff line Loading @@ -136,7 +136,16 @@ public class LocaleHelper { * @return the localized country name. */ public static String getDisplayCountry(Locale locale, Locale displayLocale) { return ULocale.getDisplayCountry(locale.toLanguageTag(), ULocale.forLocale(displayLocale)); final String languageTag = locale.toLanguageTag(); final ULocale uDisplayLocale = ULocale.forLocale(displayLocale); final String country = ULocale.getDisplayCountry(languageTag, uDisplayLocale); final String numberingSystem = locale.getUnicodeLocaleType("nu"); if (numberingSystem != null) { return String.format("%s (%s)", country, ULocale.getDisplayKeywordValue(languageTag, "numbers", uDisplayLocale)); } else { return country; } } /** Loading
core/java/com/android/internal/app/LocalePicker.java +4 −11 Original line number Diff line number Diff line Loading @@ -93,10 +93,6 @@ public class LocalePicker extends ListFragment { return context.getResources().getStringArray(R.array.supported_locales); } public static String[] getPseudoLocales() { return pseudoLocales; } public static List<LocaleInfo> getAllAssetLocales(Context context, boolean isInDeveloperMode) { final Resources resources = context.getResources(); Loading @@ -104,13 +100,6 @@ public class LocalePicker extends ListFragment { List<String> localeList = new ArrayList<String>(locales.length); Collections.addAll(localeList, locales); // Don't show the pseudolocales unless we're in developer mode. http://b/17190407. if (!isInDeveloperMode) { for (String locale : pseudoLocales) { localeList.remove(locale); } } Collections.sort(localeList); final String[] specialLocaleCodes = resources.getStringArray(R.array.special_locale_codes); final String[] specialLocaleNames = resources.getStringArray(R.array.special_locale_names); Loading @@ -122,6 +111,10 @@ public class LocalePicker extends ListFragment { || l.getLanguage().isEmpty() || l.getCountry().isEmpty()) { continue; } // Don't show the pseudolocales unless we're in developer mode. http://b/17190407. if (!isInDeveloperMode && LocaleList.isPseudoLocale(l)) { continue; } if (localeInfos.isEmpty()) { if (DEBUG) { Loading
core/java/com/android/internal/app/LocaleStore.java +18 −14 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.app; import android.content.Context; import android.os.LocaleList; import android.provider.Settings; import android.telephony.TelephonyManager; Loading Loading @@ -68,7 +69,9 @@ public class LocaleStore { return null; } return new Locale.Builder() .setLocale(locale).setRegion("") .setLocale(locale) .setRegion("") .setExtension(Locale.UNICODE_LOCALE_EXTENSION, "") .build(); } Loading Loading @@ -253,11 +256,25 @@ public class LocaleStore { Set<String> simCountries = getSimCountries(context); final boolean isInDeveloperMode = Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0; for (String localeId : LocalePicker.getSupportedLocales(context)) { if (localeId.isEmpty()) { throw new IllformedLocaleException("Bad locale entry in locale_config.xml"); } LocaleInfo li = new LocaleInfo(localeId); if (LocaleList.isPseudoLocale(li.getLocale())) { if (isInDeveloperMode) { li.setTranslated(true); li.mIsPseudo = true; li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM; } else { // Do not display pseudolocales unless in development mode. continue; } } if (simCountries.contains(li.getLocale().getCountry())) { li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM; } Loading @@ -271,19 +288,6 @@ public class LocaleStore { } } boolean isInDeveloperMode = Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0; for (String localeId : LocalePicker.getPseudoLocales()) { LocaleInfo li = getLocaleInfo(Locale.forLanguageTag(localeId)); if (isInDeveloperMode) { li.setTranslated(true); li.mIsPseudo = true; li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM; } else { sLocaleCache.remove(li.getId()); } } // TODO: See if we can reuse what LocaleList.matchScore does final HashSet<String> localizedLocales = new HashSet<>(); for (String localeId : LocalePicker.getSystemAssetLocales()) { Loading
core/res/res/values/locale_config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ <item>ar-DJ</item> <!-- Arabic (Djibouti) --> <item>ar-DZ</item> <!-- Arabic (Algeria) --> <item>ar-EG</item> <!-- Arabic (Egypt) --> <item>ar-EG-u-nu-latn</item> <!-- Arabic (Egypt,Western Digits) --> <item>ar-EH</item> <!-- Arabic (Western Sahara) --> <item>ar-ER</item> <!-- Arabic (Eritrea) --> <item>ar-IL</item> <!-- Arabic (Israel) --> Loading @@ -48,6 +49,7 @@ <item>ar-SY</item> <!-- Arabic (Syria) --> <item>ar-TD</item> <!-- Arabic (Chad) --> <item>ar-TN</item> <!-- Arabic (Tunisia) --> <item>ar-TN-u-nu-arab</item> <!-- Arabic (Tunisia,Arabic-Indic Digits) --> <item>ar-XB</item> <!-- Right-to-left pseudolocale --> <item>ar-YE</item> <!-- Arabic (Yemen) --> <item>as-IN</item> <!-- Assamese (India) --> Loading Loading @@ -366,6 +368,7 @@ <item>ms-SG</item> <!-- Malay (Singapore) --> <item>mt-MT</item> <!-- Maltese (Malta) --> <item>my-MM</item> <!-- Burmese (Myanmar (Burma)) --> <item>my-MM-u-nu-latn</item> <!-- Burmese (Myanmar (Burma), Western Digits) --> <item>mzn-IR</item> <!-- Mazanderani (Iran) --> <item>naq-NA</item> <!-- Nama (Namibia) --> <item>nb-NO</item> <!-- Norwegian Bokmål (Norway) --> Loading