I want to add Persian language to my application . i made a new string.xml file as 'fa' and set translated text there by using the following function I have tried to change the language of application :
public void loadLanguage() {
Locale locale = new Locale(manager.getAppLanguage());
Locale.setDefault(locale);
Configuration cong = new Configuration();
cong.locale = locale;
getBaseContext().getResources().updateConfiguration(cong , getBaseContext().getResources().getDisplayMetrics());
}
I call this function before setContentView(R.layout.activity_main); in my MainActivity .
after I run the application and change language to Persian everything change to RTL correctly but still string loaded from English resource and all text still are English.
Does anybody have an idea about why this happened ??