mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
fix: refactor dates (#1321)
## Description Refactor the current date formatting system to utilize Lingui. ## Changes Made - Remove redundant `LocaleData` component with Lingui dates ## Important notes For the internal pages for certificates, default to en-US to format any dates. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced internationalization support across various components by utilizing the `i18n` object for date formatting. - Streamlined locale management by removing cookie-based language handling and adopting a more centralized approach. - **Bug Fixes** - Improved date formatting consistency by replacing the `LocaleDate` component with direct calls to `i18n.date()` in multiple components. - **Documentation** - Updated localization strings in the `web.po` files to reflect recent changes in the source code structure. - **Chores** - Minor formatting adjustments and code organization improvements across various files to enhance readability and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions <github-actions@documenso.com>
This commit is contained in:
@ -5,19 +5,24 @@ import { useState } from 'react';
|
||||
import { type Messages, setupI18n } from '@lingui/core';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
|
||||
import type { I18nLocaleData } from '../../constants/i18n';
|
||||
|
||||
export function I18nClientProvider({
|
||||
children,
|
||||
initialLocale,
|
||||
initialLocaleData,
|
||||
initialMessages,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
initialLocale: string;
|
||||
initialLocaleData: I18nLocaleData;
|
||||
initialMessages: Messages;
|
||||
}) {
|
||||
const { lang, locales } = initialLocaleData;
|
||||
|
||||
const [i18n] = useState(() => {
|
||||
return setupI18n({
|
||||
locale: initialLocale,
|
||||
messages: { [initialLocale]: initialMessages },
|
||||
locale: lang,
|
||||
locales: locales,
|
||||
messages: { [lang]: initialMessages },
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user