In-App UI
React
Hooks
useTranslations
useTranslations
The useTranslations
hook is used to retrieve translations for the current user's locale. It provides access to localized strings for the Knock in-app UI components.
Parameters#
This hook does not accept any parameters.
Returns#
A UseTranslationsReturn
object with the following properties:
t(key: string, defaultValue?: string) => string
Translation function that returns the translated string for the given keylocalestring
The current locale being usedExample#
Basic usage#
The following example demonstrates how to use the useTranslations
hook to get translated strings.