# General Translation React SDKs (gt-react, gt-next, gt-react-native): getEnableI18n
URL: https://generaltranslation.com/zh/docs/react/tanstack-start/reference/functions/get-enable-i18n.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 读取 TanStack Start 运行时是否启用了国际化。getEnableI18n 的 API 参考。

`getEnableI18n` 函数用于返回当前服务器请求或浏览器是否启用了 General Translation 国际化。从 `gt-tanstack-start` 导入此函数。

## 概览 [#overview]

```ts
import { getEnableI18n } from 'gt-tanstack-start';

const enableI18n = getEnableI18n();
```

```ts
getEnableI18n(): boolean
```

## 工作原理 [#how-it-works]

在服务器端，`getEnableI18n` 会读取由 [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware) 创建的请求级设置。在浏览器中，它会读取由 [`initializeGT`](/docs/react/reference/config#initialize) 初始化的条件存储。翻译函数会使用该设置来选择当前活动区域设置或源区域设置。

该函数是同步的。服务器端调用如果发生在当前 middleware 请求层级之外，则会抛出异常。

## 返回值 [#returns]

**类型** `boolean`

如果该请求启用了国际化，则为 `true`；否则为 `false`。

## 示例 [#example]

```ts
import { createServerFn } from '@tanstack/react-start';
import { getEnableI18n } from 'gt-tanstack-start';

export const loadI18nState = createServerFn({ method: 'GET' }).handler(() => {
  return { enableI18n: getEnableI18n() };
});
```

## Sitemap

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