From 8d4ae57353f07976b5f1940810bf07b8b93d8bde Mon Sep 17 00:00:00 2001 From: KishiTheMechanic Date: Sat, 26 Oct 2024 04:25:52 +0200 Subject: [PATCH] fix --- src/useLocale.ts | 2 +- src/useTranslation.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/useLocale.ts b/src/useLocale.ts index e0b1289..f0726fb 100644 --- a/src/useLocale.ts +++ b/src/useLocale.ts @@ -22,7 +22,7 @@ export function setInitialLocale(locale: string) { localeSignal.value = locale } -export function useLocale() { +export function useLocale(): LocaleContextProps { const context = useContext(LocaleContext) return { locale: localeSignal.value, diff --git a/src/useTranslation.ts b/src/useTranslation.ts index 81563bc..5bdb358 100644 --- a/src/useTranslation.ts +++ b/src/useTranslation.ts @@ -1,7 +1,9 @@ import { useLocale } from './useLocale.ts' import { useEffect, useState } from 'preact/hooks' -export function useTranslation(namespace: string) { +export function useTranslation( + namespace: string, +): { t: (key: string) => string } { const { locale, loadNamespaceTranslations } = useLocale() const [translations, setTranslations] = useState>({})