# General Translation React SDKs (gt-react, gt-next, gt-react-native): getLocalizeHref
URL: https://generaltranslation.com/zh/docs/react/nextjs/reference/functions/get-localize-href.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 在 async 服务器端代码中本地化 App Router 路径。getLocalizeHref 的 API 参考。

`getLocalizeHref` 函数会基于请求区域设置，解析为与 [`useLocalizeHref`](/docs/react/nextjs/reference/hooks/use-localize-href) 相同的函数。请从 `gt-next/server` 导入该函数。

## 概览 [#overview]

```tsx title="app/[locale]/cart/page.tsx"
import { getLocalizeHref } from 'gt-next/server';
import { Button } from '@/components/Button';

export default async function CartPage() {
  const localizeHref = await getLocalizeHref();
  return <Button href={localizeHref('/checkout')}>Checkout</Button>;
}
```

## 返回值 [#returns]

**类型** `Promise<(href: string, locale?: string | false) => string>`

## Sitemap

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