Lines Matching defs:locale

143         // At first, find the fallback locale from the IMEs that are declared as "default" in the
144 // current locale. Note that IME developers can declare an IME as "default" only for
155 // If no fallback locale is found in the above condition, find fallback locales regardless
166 Slog.w(TAG, "Found no fallback locale. imis=" + Arrays.toString(imis.toArray()));
193 return context.getResources().getConfiguration().locale;
207 @Nullable final Locale locale, final boolean checkCountry,
211 if (isSystemImeThatHasSubtypeOf(imi, context, checkDefaultAttribute, locale,
266 // 1. checkDefaultAttribute: true, locale: fallbackLocale, checkCountry: true
267 // 2. checkDefaultAttribute: false, locale: fallbackLocale, checkCountry: true
268 // 3. checkDefaultAttribute: true, locale: fallbackLocale, checkCountry: false
269 // 4. checkDefaultAttribute: false, locale: fallbackLocale, checkCountry: false
303 // 1. checkDefaultAttribute: true, locale: systemLocale, checkCountry: true
304 // 2. checkDefaultAttribute: true, locale: systemLocale, checkCountry: false
305 // 3. checkDefaultAttribute: true, locale: fallbackLocale, checkCountry: true
306 // 4. checkDefaultAttribute: true, locale: fallbackLocale, checkCountry: false
307 // 5. checkDefaultAttribute: false, locale: fallbackLocale, checkCountry: true
308 // 6. checkDefaultAttribute: false, locale: fallbackLocale, checkCountry: false
351 // When the system is not ready, the system locale is not stable and reliable. Hence
352 // we will pick up IMEs that support software keyboard based on the fallback locale.
361 // When the system is ready, we will primarily rely on the system locale, but also keep
362 // relying on the fallback locale as a last resort.
384 // Convert a locale whose language is "tl" to one whose language is "fil".
401 @Nullable final Locale locale, final boolean checkCountry, final String mode) {
402 if (locale == null) {
411 !TextUtils.equals(subtypeLocale.getLanguage(), locale.getLanguage()) ||
412 !TextUtils.equals(subtypeLocale.getCountry(), locale.getCountry())) {
418 if (!TextUtils.equals(subtypeLocale.getLanguage(), locale.getLanguage())) {
498 final String systemLocale = res.getConfiguration().locale.toString();
500 final String systemLanguage = res.getConfiguration().locale.getLanguage();
519 final String locale = subtype.getLocale();
521 final String language = getLanguageFromLocaleString(locale);
522 // When system locale starts with subtype's locale, that subtype will be applicable
523 // for system locale. We need to make sure the languages are the same, to prevent
526 // For instance, it's clearly applicable for cases like system locale = en_US and
528 // locale = en and subtype = en_US.
530 // We just call systemLocale.startsWith(locale) in this function because there is no
536 if (language.equals(systemLanguage) && systemLocale.startsWith(locale)) {
541 if (!systemLocale.equals(locale)) continue;
571 * Returns the language component of a given locale string.
574 public static String getLanguageFromLocaleString(String locale) {
575 final int idx = locale.indexOf('_');
577 return locale;
579 return locale.substring(0, idx);
585 * given locale.
588 * @param locale subtypes will be filtered by locale
594 Resources res, List<InputMethodSubtype> subtypes, String mode, String locale,
599 if (TextUtils.isEmpty(locale)) {
600 locale = res.getConfiguration().locale.toString();
602 final String language = getLanguageFromLocaleString(locale);
617 if (locale.equals(subtypeLocale)) {
618 // Exact match (e.g. system locale is "en_US" and subtype locale is "en_US")
622 // Partial match (e.g. system locale is "en_US" and subtype locale is "en")
633 // The first subtype applicable to the system locale will be defined as the most applicable
1316 * system locale, the following fallback order will be applied.</p>
1318 * <li>(system-locale-language, system-locale-region, system-locale-variant) (if exists)</li>
1319 * <li>(system-locale-language, system-locale-region)</li>
1325 * <p>If the system language is English, but no region is specified in the system locale,
1335 * <li>(system-locale-language, system-locale-region, system-locale-variant) (if exists)</li>
1336 * <li>(system-locale-language, system-locale-region) (if exists)</li>
1337 * <li>(system-locale-language) (if exists)</li>
1343 * @param systemLocale the current system locale to be taken into consideration.