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 key.
localestring
The current locale being used.
Example
#Basic usage
#The following example demonstrates how to use the useTranslations hook to get translated strings.