# General Translation React SDKs (gt-react, gt-next): tx URL: https://generaltranslation.com/en-GB/docs/react/nextjs/reference/functions/tx.mdx --- title: tx description: Translate request-time strings in Next.js App Router server code with General Translation. API reference for tx. --- The `tx` function translates a string at request time through the General Translation API. Use it for dynamic content that is not known at build time; use [`getGT`](/docs/react/nextjs/reference/functions/get-gt) for static source strings. `tx` is server-only and does not work with the Pages Router. ## Overview [#overview] ```tsx import { tx } from 'gt-next/server'; const translated = await tx('A message loaded at request time'); ``` ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | --------- | ------------------------------------------------------------------------- | -------- | -------- | ------- | | `message` | String to translate. | `string` | No | — | | `options` | Target locale, context, format, length limit and interpolation variables. | `object` | Yes | `{}` | `options` accepts `$locale`, `$context`, `$maxChars`, and `$format`. Pass interpolation variables as top-level keys. ## Returns [#returns] **Type** `Promise` A promise resolving to the translated string, or the source string when translation is disabled or unnecessary. ## Example [#example] ```tsx title="app/notes/[id]/page.tsx" import { tx } from 'gt-next/server'; export default async function NotePage({ params }) { const note = await loadNote((await params).id); const translated = await tx(note, { $context: 'A user-created note', }); return

{translated}

; } ```