I have a samsung galaxy y duos and a Google Nexus 5 with me. I have my application running on both phones. I have to provide this app in two languages (Kannada & English). I choose the language by switching the locale (By convention).
Nexus 5 has the locale "kn" in its locale list and Y Duos does not have "kn" in it. But when I try to use String.xml inside values-kn folder, the Kannada texts are being rendered properly in Y Duos even though it has no "kn" locale in it.
I have a piece of code which looks for "kn" locale and enable/disable Kannada language feature. It is given below.
public boolean isLocalePresent(Locale newLocale) {
Locale[] locales = Locale.getAvailableLocales();
for (Locale locale : locales) {
if (locale.getLanguage().equals(newLocale.getLanguage()) {
return true;
}
}
return false;
}
I call it as follows;
if (isLocalePresent(new Locale("kn"))) {
// change default locale to "kn"
}
Could anyone please tell me how can I make my app use Kannada texts in all phones that can render Kannada text.? How can I know that whether the phone supports Kannada text rendering even if "kn" locale is absent in the Locale list.?