默认支持的语言列表
frameworks/base/core/res/res/values/locale_config.xml
源码
frameworks/base/core/java/com/android/internal/app/LocalePickerWithRegion.java
frameworks/base/core/java/com/android/internal/app/SuggestedLocaleAdapter.java
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//----------------------------------------------------------------------------
TextView text = (TextView) convertView.findViewById(R.id.locale);
LocaleStore.LocaleInfo item = (LocaleStore.LocaleInfo) getItem(position);
//lixiaogang add start
String labe = item.getLabel(mCountryMode);
//text.setText(item.getLabel(mCountryMode));
android.util.Log.d("LXG", "labe------------------" + labe + ", --------LocaleInfo------" + item);
text.setText(labe);
//lixiaogang add end
text.setTextLocale(item.getLocale());
//----------------------------------------------------------------------------
}
frameworks/base/core/java/com/android/internal/app/LocalePicker.java
public static String[] getSupportedLocales(Context context) {
return context.getResources().getStringArray(R.array.supported_locales);
}
frameworks/base/core/java/com/android/internal/app/LocaleStore.java
public static Set<LocaleInfo> getLevelLocales(Context context, Set<String> ignorables,
LocaleInfo parent, boolean translatedOnly) {
fillCache(context);
String parentId = parent == null ? null : parent.getId();
HashSet<LocaleInfo> result = new HashSet<>();
for (LocaleStore.LocaleInfo li : sLocaleCache.values()) {
int level = getLevel(ignorables, li, translatedOnly);
if (level == 2) {
if (parent != null) { // region selection
if (parentId.equals(li.getParent().toLanguageTag())) {
result.add(li);
}
} else { // language selection
if (li.isSuggestionOfType(LocaleInfo.SUGGESTION_TYPE_SIM)) {
result.add(li);
} else {
result.add(getLocaleInfo(li.getParent()));
}
}
}
}
return result;
}