I'm trying to support the Arabic language. When I changed the language in the application with the following code (refer below), in most of the devices it works fine but in some devices such as Galaxy S7, Galaxy S8, LG G5
UI transforms to RTL
successfully but Arabic language resources are not being loaded and the app still uses EN
string resources.
Has anyone had any opinions about this problem? Thanks for answers.
Here is the code I use for changing language:
private fun updateResources(context: Context, locale: Locale): Context {
Locale.setDefault(locale)
val res = context.resources
val config = res.configuration
config.setLocale(locale)
config.setLayoutDirection(locale)
BaseActivity.setLayoutDirection(res.configuration.layoutDirection)
Session.lang = locale.language
return context.createConfigurationContext(config)
}