Skip to content

Commit

Permalink
docs: add docstring for useTranslatedString hook
Browse files Browse the repository at this point in the history
yumincho authored and sboh1214 committed Mar 14, 2024

Verified

This commit was signed with the committer’s verified signature.
sboh1214 Seungbin Oh (오승빈)
1 parent 6738c72 commit 0c68771
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/hooks/useTranslatedString.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { useTranslation } from 'react-i18next';

/**
* Custom hook that returns a function for translating strings based on the current language.
*
* @returns {function} A function that takes an object and a key and returns the translated string.
* @example const translate = useTranslatedString();
* const translatedString = translate(review.lecture, 'title');
*/
export const useTranslatedString = () => {
const { i18n } = useTranslation();

0 comments on commit 0c68771

Please sign in to comment.