getString

open override fun getString(context: Context, id: Int, vararg formatArgs: Any): String

Replace your context.getString() with this function.

getString(context, R.strings.hello, "World", Locale("es"))
getString(context, R.strings.name)

Return

A String containing the translated text.

Parameters

context

The context. Could be Application Context.

id

The resource ID of the string to translate.

formatArgs

optional parameters if your resource string takes parameters like "Hello $1%s"