From c3e6a0e80b1d87ef3b26fdb7194aa2577393212f Mon Sep 17 00:00:00 2001 From: moss-bryophyta <261561981+moss-bryophyta@users.noreply.github.com> Date: Sun, 22 Mar 2026 13:03:20 -0700 Subject: [PATCH] docs(next): add metadata translation example and pluralization links to quickstart --- docs/en-US/next/api/strings/get-gt.mdx | 20 ++++++++++++++++++++ docs/en-US/next/index.mdx | 2 ++ docs/en-US/react/index.mdx | 1 + 3 files changed, 23 insertions(+) diff --git a/docs/en-US/next/api/strings/get-gt.mdx b/docs/en-US/next/api/strings/get-gt.mdx index 4f2abcd..b4b12ac 100644 --- a/docs/en-US/next/api/strings/get-gt.mdx +++ b/docs/en-US/next/api/strings/get-gt.mdx @@ -102,6 +102,26 @@ export default async function TranslateGreeting() { ``` Note: "Alice" will not be translated to the user's preferred language because it is a variable. +### Translating page metadata [#metadata] +Use `getGT` inside Next.js `generateMetadata` to translate page titles, descriptions, and Open Graph tags. + +```javascript copy +import { getGT } from 'gt-next/server'; +import { Metadata } from 'next'; + +export async function generateMetadata(): Promise { + const gt = await getGT(); + return { + title: gt('My App'), + description: gt('A fast, modern web application'), + openGraph: { + title: gt('My App'), + description: gt('A fast, modern web application'), + }, + }; +} +``` + ### Using ICU message format `gt-next` supports ICU message format, which allows you to also format your variables. diff --git a/docs/en-US/next/index.mdx b/docs/en-US/next/index.mdx index fc3aa1d..31120f4 100644 --- a/docs/en-US/next/index.mdx +++ b/docs/en-US/next/index.mdx @@ -329,5 +329,7 @@ That's it — your app is now multilingual. 🎉 - [**`` Component Guide**](/docs/next/guides/t) — Learn about variables, plurals, and advanced translation patterns - [**String Translation Guide**](/docs/next/guides/strings) — Deep dive into `useGT` and `getGT` - [**Variable Components**](/docs/next/guides/variables) — Handle dynamic content with ``, ``, ``, and `` +- [**Pluralization**](/docs/next/api/components/plural) — Handle plural forms with the `` component +- [**Translating Page Metadata**](/docs/next/api/strings/get-gt#metadata) — Translate titles, descriptions, and OG tags with `getGT` - [**Deploying to Production**](/docs/next/tutorials/quickdeploy) — CI/CD setup, caching, and performance optimization - [**Shared Strings**](/docs/next/guides/shared-strings) — Translate text in arrays, config objects, and shared data with `msg()` diff --git a/docs/en-US/react/index.mdx b/docs/en-US/react/index.mdx index d363bfb..825a9ad 100644 --- a/docs/en-US/react/index.mdx +++ b/docs/en-US/react/index.mdx @@ -310,5 +310,6 @@ That's it — your app is now multilingual. 🎉 - [**`` Component Guide**](/docs/react/guides/t) — Learn about variables, plurals, and advanced translation patterns - [**String Translation Guide**](/docs/react/guides/strings) — Deep dive into `useGT` - [**Variable Components**](/docs/react/guides/variables) — Handle dynamic content with ``, ``, ``, and `` +- [**Pluralization**](/docs/react/api/components/plural) — Handle plural forms with the `` component - [**Deploying to Production**](/docs/react/tutorials/quickdeploy) — CI/CD setup, caching, and performance optimization - [**Shared Strings**](/docs/react/guides/shared-strings) — Translate text in arrays, config objects, and shared data with `msg()`