I am making an application in two languages English and in Indonesian. For that i have created two strings file in res folder (values-en and values-in)
In one of my activity I select lanuage and change the locale.I am doing this using following code-
passing language id to this method-
public void setLocale(String lang) {
Locale myLocale = new Locale(lang);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
}
But after changing the language to indonesian strange thing happened. My Some of the text changed to indonesian and some changed to english.
for example- I have two Buttons (Submit and Upload Receipt) in activity.
SUBMIT btn has- in english it's text is SUBMIT and in indonesian it is KIRIM
<string name="submit_btn_text">Submit</string> for english
<string name="submit_btn_text">Kirim</string> for indonesian
and UPLOAD RECEIPT btn has- in english it's text is Upload Receipt and in indonesian it is Upload Penerimaan
<string name="upload_receipt">Upload Receipt</string> for english
<string name="upload_receipt">Upload Penerimaan</string> for indonesian
But in indonesian Submit btn text chanes to Kirim but Upload Receipt btn remain "Upload Receipt". It doesn't change to Upload Penerimaan.
How this is happened as other text chages as per locale. Also I am facing same problem in all dialogs pop ups.Text remain in english in all dialogs.
What should be done?