Skip to content

createTranslation

createTranslation is a function that allows you to specify your translations.

Example

const translations = createTranslation<Translations>(() => ({
en: {
Greeting: () => "Hello world!",
},
de: {
Greeing: () => "Hallo Welt!",
},
}));

Type declaration

const createTranslation: <L extends LanguageCode>({
languageSelector,
}: CreateTranslationConfig<L>) => <K extends object>(
translationThunk: TranslationThunk<L, K>,
) => CreateTranslationReturn<L, K>;