TL;DR
I have an app that supports a number of languages. One activity isn't being translated despite using all the usual localization methods. It is the only Activity in the app that fully utilizes DataBinding
.
Full explanation
I have an Activity
that uses DataBinding
. So basically, entire XML
layout for that Activity is wrapped inside the <layout>
tag. This is how I inflate the view and get the binding:
SomeActivityBinding binding = DataBindingUtil.setContentView(this, R.layout.some_activity);
There is a number of TextViews
in the XML
have text set in this way:
...
android:text="@string/<name of a string>"
...
We provide user with predefined language options and set app locale using
Locale.setDefault(new Locale("<language name>"));
In English locale, everything works perfectly.
When the app is in a different locale thought, strings in the activity in question still show up in English - even though those strings have been translated to the appropriate language, and are located in the same string files where the rest of the app grabs the strings from. Until that activity is started, app is fine - after the activity is started and I back out of it, app reverts to English locale until its killed and restarted. If that Activity is never opened, app behaves as expected.
Does anyone have any idea what might be causing this? Thanks.