import { useContext } from "react";
import { TranslationContext } from "stream-chat-react-native";
const { t, tDateTimeParser } = useContext(TranslationContext);
TranslationContext
TranslationContext
is provided by OverlayProvider
and Chat
components.
Read the Adding Internationalization (i18n) section for more information on how to customize your translations.
If you are not familiar with React Context API, please read about it on React docs.
Basic Usage
TranslationContext
can be consumed by any of the child component of OverlayProvider
or Chat
components.
Alternatively, you can also use useTranslationContext
hook provided by library to consume TranslationContext.
import { useTheme } from "stream-chat-react-native";
const { t, tDateTimeParser } = useTranslationContext();
Value
t
Given a key, extracts the translated text from the Streami18n instance.
Type |
---|
function |
tDateTimeParser
Used for translating dates and times into the desired local format.
Type |
---|
function |
On this page: