In my app I am having an option of switching from Chinese to traditional chinese.
I am using spinner, where position 1 is chinese and 2 is traditional chinese. When position 1 is selected, here is my code which switches the language
if (pos == 0)
{
langSelected ="en";
}
else if (pos == 1)
{
langSelected ="zh";
}
else if (pos == 2)
{
langSelected ="zh-rTW";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
android.content.res.Configuration config = new android.content.res.Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
@Override
public void onConfigurationChanged(android.content.res.Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
if (locale != null){
newConfig.locale = locale;
Locale.setDefault(locale);
getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
}
}
While switching from english to chinese using spinner the correct language gets loaded, but when loading traditional chinese(zh-rTW), only the chinese text gets loaded
I have my simplified chinese text in values-zh, where as I have loaded the Traditional Chinese text in values-zh-rTW
The app name differs for each language, so I also tried changing the Language from device Settings, now also in Simplified Chinese it is loading correctly but traditional Chinese not loading. But here the app name gets changed for Traditional Chinese, i.e. app name loads from values-zh-rTW
Where I am going wrong, should I have to change the folder for Traditional Chinese ?