I'm writing app that support two language and I'm changing language with Change app Locale here my code :
Locale locale = new Locale("fa");
Locale.setDefault(locale);
Configuration configs = new Configuration();
configs.locale = locale;
getBaseContext().getResources().updateConfiguration(configs, getBaseContext().getResources().getDisplayMetrics());
And
in manifest I'm set android:supportsRtl="true"
These codes working in many Devices but in some devices not working . for example Texts not Translating but Direction change .
Tested Devices :
i have found my solution , my problem was i'm inserted "fa"
in Locale and my String Values Directory name was values-fa-rlIR
, so names are different so not worked ,i'm wondering why it's working on some devices!
I'm just change the String Values Directory name from values-fa-rlIR
to values-fa
and it's working well.
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