Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / packages / components / hooks / useRelocalizeText.ts
blob52d10c49ced599edf2dd3d697acee5ae30b0c9e0
1 import { useCallback } from 'react';
3 import { useUserSettings } from '@proton/account/userSettings/hooks';
4 import { relocalizeText } from '@proton/shared/lib/i18n/relocalize';
6 const useRelocalizeText = () => {
7     const [userSettings] = useUserSettings();
9     return useCallback(
10         async ({
11             getLocalizedText,
12             newLocaleCode,
13             relocalizeDateFormat,
14         }: {
15             getLocalizedText: () => string;
16             newLocaleCode?: string;
17             relocalizeDateFormat?: boolean;
18         }) => {
19             return relocalizeText({
20                 getLocalizedText,
21                 newLocaleCode,
22                 relocalizeDateFormat,
23                 userSettings,
24             });
25         },
26         [userSettings]
27     );
30 export default useRelocalizeText;