From d2f3d24542fdfc7969546eaf74daada06b24895e Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Wed, 19 Feb 2025 22:36:17 +1100 Subject: [PATCH] chore: update docs --- .../developers/local-development/index.mdx | 2 +- .../local-development/translations.mdx | 47 ++----------------- 2 files changed, 5 insertions(+), 44 deletions(-) diff --git a/apps/documentation/pages/developers/local-development/index.mdx b/apps/documentation/pages/developers/local-development/index.mdx index c92f9b385..bf9f92723 100644 --- a/apps/documentation/pages/developers/local-development/index.mdx +++ b/apps/documentation/pages/developers/local-development/index.mdx @@ -16,7 +16,7 @@ Pick the one that fits your needs the best. ## Tech Stack - [Typescript](https://www.typescriptlang.org/) - Language -- [ReactRouter](https://reactrouter.com/) - Framework +- [React Router](https://reactrouter.com/) - Framework - [Prisma](https://www.prisma.io/) - ORM - [Tailwind](https://tailwindcss.com/) - CSS - [shadcn/ui](https://ui.shadcn.com/) - Component Library diff --git a/apps/documentation/pages/developers/local-development/translations.mdx b/apps/documentation/pages/developers/local-development/translations.mdx index a776dc50c..2fbb6eb96 100644 --- a/apps/documentation/pages/developers/local-development/translations.mdx +++ b/apps/documentation/pages/developers/local-development/translations.mdx @@ -13,35 +13,13 @@ Documenso uses the following stack to handle translations: Additional reading can be found in the [Lingui documentation](https://lingui.dev/introduction). -## Requirements - -You **must** insert **`setupI18nSSR()`** when creating any of the following files: - -- Server layout.tsx -- Server page.tsx -- Server loading.tsx - -Server meaning it does not have `'use client'` in it. - -```tsx -import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server'; - -export default function SomePage() { - setupI18nSSR(); // Required if there are translations within the page, or nested in components. - - // Rest of code... -} -``` - -Additional information can be found [here.](https://lingui.dev/tutorials/react-rsc#pages-layouts-and-lingui) - ## Quick guide If you require more in-depth information, please see the [Lingui documentation](https://lingui.dev/introduction). ### HTML -Wrap all text to translate in **``** tags exported from **@lingui/macro** (not @lingui/react). +Wrap all text to translate in **``** tags exported from **@lingui/react/macro**. ```html

@@ -64,8 +42,9 @@ For text that is broken into elements, but represent a whole sentence, you must ### Constants outside of react components ```tsx -import { Trans, msg } from '@lingui/macro'; +import { msg } from '@lingui/core/macro'; import { useLingui } from '@lingui/react'; +import { Trans } from '@lingui/react/macro'; // Wrap text in msg`text to translate` when it's in a constant here, or another file/package. export const CONSTANT_WITH_MSG = { @@ -98,31 +77,13 @@ Lingui provides a Plural component to make it easy. See full documentation [here Lingui provides a [DateTime instance](https://lingui.dev/ref/core#i18n.date) with the configured locale. -#### Server components - -Note that the i18n instance is coming from **setupI18nSSR**. - ```tsx import { Trans } from '@lingui/macro'; import { useLingui } from '@lingui/react'; export const SomeComponent = () => { - const { i18n } = setupI18nSSR(); + const { i18n } = useLingui(); return The current date is {i18n.date(new Date(), { dateStyle: 'short' })}; }; ``` - -#### Client components - -Note that the i18n instance is coming from the **import**. - -```tsx -import { i18n } from '@lingui/core'; -import { Trans } from '@lingui/macro'; -import { useLingui } from '@lingui/react'; - -export const SomeComponent = () => { - return The current date is {i18n.date(new Date(), { dateStyle: 'short' })}; -}; -```