I want to set locale for a single text view . Which means only that textview will be shown in another language (in my example french) but unfortunately it is not working. While I do not get an error, nothing happens.
Locale locale = new Locale("fr");
maintext.setTextLocale(locale);
tried updating confguirations , same thing . Nothing changes .
Locale locale = new Locale("fr");
Configuration config = new Configuration();
config.locale = locale;
getActivity().getResources().updateConfiguration(config,
getActivity().getResources().getDisplayMetrics());
maintext.setTextLocale(locale);
I tried doing that in normal activities and it worked perfectly fine .
You can use String.format()
with Locale.FRENCH
to localize the text of that TextView.
example
String txtFrench = String.format(Locale.FRENCH, "%s", item.getFrenchName());
mFrenchTextView.setText(txtFrench);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With