I am developing an application which is support multi language, i don't have any idea about it. In my app setting there is two language option one is English and another is Arabic when user select Arabic then all the label of app should be change in Arabic for achieving this thing i have created values-ar file for Arabic label i don't want to write a language changing code everywhere. Pease help me or suggest me any tutorial.
Asked
Active
Viewed 519 times
0
-
Refer http://stackoverflow.com/a/15971553/2462531 for changing laguage – Shailendra Madda Apr 09 '16 at 13:51
-
@Shylendra Madda my problem is this my app has a single activity and that activity contain a viewPager this viewPager have a 15 different fragment so i don;t know where do i have to write a local changing code in activity and in each fragment and after changing local how to relaunch the activity and fragment ? – ramkrishna kushwaha Apr 10 '16 at 05:55
1 Answers
0
I have change the language of whole application with this method
String lang = MYDataManager.sharedHandler().language;
System.out.println("langlang-"+lang);
String languageToLoad;
if (lang.equals(MYConstant.ENGLISH)) {
languageToLoad = "en";
} else {
languageToLoad = "ar";
}
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
context.getResources().updateConfiguration(config, context.getResources().g

ramkrishna kushwaha
- 380
- 1
- 6
- 17