I wanted to use this library in combination with dagger-hilt, but that does not seem to work. To be more specific:
There is a dagger-hilt annotation called @ApplicationContext, with which we can inject the application context inside every possible non-android-class. Here is an example:
class MyRepository(
@ApplicationContext private val context: Context
) {
fun getData() = myService.collection(context.getString(R.string.stuff)).get().await()
}
Now comes the problem: When switching languages, this ApplicationContext does not seem to update. For example, let's say we have two versions of the above string:
German "R.string.stuff" -> Hallo
English "R.string.stuff" -> Hello
When you now change the language from german to english in Fragment with (requireActivity as LocaleAwareCompatActivity).updateLocal(Locale.EN), then the following happens:
Calling requireContext().getString(R.string.stuff) in Fragment gives "Hello" (language was updated correctly). But inside my Repository "R.string.stuff" is still "Hallo" (language was not updated correctly)