stringResource

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

Replace your context.getString() with this function. Similar to getString, but for Compose functions

stringResource(LocalContext.current, R.strings.hello, "World", Locale("es"))
getString(LocalContext.current, R.strings.name)

Return

A String containing the translated text.

Parameters

context

The context. Usually set to LocalContext.current

id

The resource ID of the string to translate.

formatArgs

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