Closed PepaZapletal closed 3 years ago
@PepaZapletal Because context in Broadcast Receiver isn't localized context. So please add this extension function in your project.
fun Context.toLocalizedContext(): Context = LocalizationUtility.applyLocalizationConfig(this)
Then convert it before using getString(resId: String)
class SimpleBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val localizedContext = context.toLocalizedContext()
val content = localizedContext.getString(R.string.hello_world)
// Do something
}
}
Good news. 2.1.9 is live with the Context.toLocalizedContext()
extension function.
Hi,
I have a problem with the correct language in the notification.
I have English as the default language. Now I set a new language german in the app. In the app, it's working okay.
But when the scheduled notification arrived then it's in English (default language).
Should I set something? How can I fix it? I'm using LocalizationApplication.
Thanks for help.