# General Translation React SDKs (gt-react, gt-next, gt-react-native): Localized navigation
URL: https://generaltranslation.com/en-US/docs/react/nextjs/link.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Navigate directly to localized App Router routes with the locale-aware Link component. API reference for the `<Link>` component.

The `<Link>` component from `gt-next/link` wraps Next.js's `<Link>` and adds the locale prefix to internal App Router URLs before navigation. This avoids an extra middleware redirect when changing locales. (See the [App Router middleware setup](/docs/react/nextjs/app-router-middleware)).

*Note: Pages Router apps should use `next/link` or `next/router` with Next.js's `locale` option. (See [Pages Router locale routing](/docs/react/nextjs/pages-router-middleware)).*

## Overview [#overview]

Import the default export from `gt-next/link` and use it like `next/link` inside [`<GTProvider>`](/docs/react/reference/components/gt-provider). It accepts the same props and forwards refs.

```tsx title="app/nav.tsx"
import Link from 'gt-next/link';

export function Navigation() {
  return <Link href="/home">Home</Link>; // /fr/home for a French visitor
}
```

## The `locale` prop [#locale-prop]

**Type** `string | false | undefined`

Selects the locale prefix. `<Link>` does not forward `locale` to `next/link`.

- **Omitted.** Use the current locale from [`useLocale`](/docs/react/reference/hooks/use-locale). The default locale is not prefixed unless [`prefixDefaultLocale`](/docs/react/nextjs/reference/functions/create-next-middleware#prefix-default-locale) is `true`.
- **Locale string.** Link directly to that locale, such as from a language switcher. A link to the default locale keeps its prefix unless both `prefixDefaultLocale` and [`enableSmartRouting`](/docs/react/nextjs/reference/functions/create-next-middleware#smart-routing) are `false`, so the middleware does not send the visitor back to the locale saved in their cookie.
- **`false`.** Leave the href unchanged.

```tsx
import Link from 'gt-next/link';

// Current locale (default): /fr/home, or /home for the default locale
<Link href="/home">Home</Link>;

// Explicit locale: /fr/home
<Link href="/home" locale="fr">French</Link>;

// Explicit default locale, with smart routing on: /en/home
<Link href="/home" locale="en">English</Link>;

// No prefix: /legal
<Link href="/legal" locale={false}>Legal</Link>;
```

Pass unlocalized paths. An href that already starts with a configured locale is prefixed again, so `/de/about` becomes `/fr/de/about` for a French visitor; in development, this logs a warning once. Only paths that start with `/` are localized: external URLs, protocol-relative URLs, and paths that don't match [`pathRegex`](/docs/react/nextjs/config#path-regex) stay unchanged. Query strings and hashes are preserved. For object hrefs, `<Link>` localizes only a string `pathname` and preserves the other fields.

`<Link>` reads `prefixDefaultLocale` and `enableSmartRouting` from [`withGTConfig`](/docs/react/nextjs/config#routing), not from [`createNextMiddleware`](/docs/react/nextjs/reference/functions/create-next-middleware). Set them there, or the middleware can redirect the link. To localize a path without rendering a link, such as for `router.push()`, use [`useLocalizeHref`](/docs/react/nextjs/reference/hooks/use-localize-href).

## Version history [#version-history]

| Version | Changes |
| --- | --- |
| 11.4.14 | Paths that don't match `pathRegex` are no longer prefixed. In development, an href that already starts with a configured locale logs a warning once; the output is unchanged. Also applies to [`useLocalizeHref`](/docs/react/nextjs/reference/hooks/use-localize-href) and [`getLocalizeHref`](/docs/react/nextjs/reference/functions/get-localize-href). |
| 11.4.13 | Links for the current default locale are no longer prefixed when `prefixDefaultLocale` is `false`. A link with an explicit default-locale `locale` prop stays prefixed unless `enableSmartRouting` is also `false`. |

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
