Android : App name doesn't change language after user changes it programmatically

on Saturday, April 18, 2015


I give my user the opportunity to change the app language. I use this:



public void languageToLoad(String language) {
String lang = language;
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
}


for english: languageToLoad(en) or french: languageToLoad(fr)


But my problem is that the app name won't change.


strings.xml (en):



<string name="app_name">SoccerPro</string>


strings.xml (fr):



<string name="app_name">FootballPro</string>


Every string changes its value but not 'app_name'.


If the device language gets changed then it changes but not like my way. What am I doing wrong?


0 comments:

Post a Comment