0

val context = appContext

context.getString(key) is returning string in default language of system in android 12 , while it is returning string in selected language in android 13. Is there any alternative method to support for both. Needed string in the selected language

1 Answer 1

0

It's a reported issue with Per App Language. This is the suggested workaround. https://developer.android.com/reference/androidx/core/content/ContextCompat#getContextForLanguage(android.content.Context)

Use:

ContextCompat.getContextForLanguage(context).getString(R.string.myString)

instead of:

context.getString(R.string.myString)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.