I am trying to localize the permission messages, like allow app to access the camera to take photos or videos etc
Rest of the app is localized.
Here is what i tried so far:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(App.localeManager.setLocale(base));
Log.d(TAG, "attachBaseContext");
}
public Context setLocale(Context c) {
return updateResources(c, getLanguage());
}
private Context updateResources(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources res = context.getResources();
Configuration config = new Configuration(res.getConfiguration());
if (Utility.isAtLeastVersion(JELLY_BEAN_MR1)) {
config.setLocale(locale);
context = context.createConfigurationContext(config);
} else {
config.locale = locale;
res.updateConfiguration(config, res.getDisplayMetrics());
}
return context;
}
and one thing if change language in settings, permission messages get localized.
any help would be appreciated, thanks.
No. Permission requesting dialogs are shown in the locale of the device.