t

fun t(context: Context, @StringRes id: Int): String(source)

Provides an immediate translation for the given string resource ID within the given context. If a translation key is derived from the string resource, it retrieves the translation using Tolgee. Otherwise, it falls back to returning the default string resource value.

Return

The translated string if a key-based translation is found; otherwise, the default string resource value.

Parameters

context

The context used to access resources and provide localization settings.

id

The resource ID of the string to be translated.


fun t(context: Context, @StringRes id: Int, vararg formatArgs: Any): String(source)

Provides an immediate translation for a given string resource ID with optional format arguments. If the translation key is found in the string resource, it retrieves the translation; otherwise, the default string resource value is returned.

Return

The translated string if a translation key is found, or the default string resource value.

Parameters

context

The context used to access resources and string values.

id

The resource ID of the string to be translated.

formatArgs

Optional arguments for formatting the string.