Tried 2 solutions, none worked…
⚠ This one also starts the activity twice.
@Before
fun setup() {
val locales = LocaleListCompat.forLanguageTags("fr").toLanguageTags()
AppLocalesStorageHelper.persistLocales(targetContext, locales)
}
private fun switchToLocale(locale: Locale) {
Locale.setDefault(locale)
targetContext.resources.apply {
configuration.locale = locale
targetContext.resources.updateConfiguration(configuration, targetContext.resources.displayMetrics)
}
}
@Test
fun fofo() {
switchToLocale(Locale.FRENCH)
}
Locale.setDefault(Locale("en"))or Android equivalent?)Tried 2 solutions, none worked…
⚠ This one also starts the activity twice.