# gt-node: General Translation Node.js SDK: getLocales URL: https://generaltranslation.com/zh/docs/node/reference/functions/get-locales.mdx --- title: getLocales description: 列出在 General Translation gt-node 中配置的支持区域设置。getLocales 的 API 参考。 --- 返回在 [`initializeGT`](/docs/node/reference/functions/initialize-gt) 中配置的支持区域设置列表。 ## 概览 [#overview] 调用 `getLocales` 且不传任何参数,即可获取受支持的 BCP 47 区域设置代码数组。 ```ts import { getLocales } from 'gt-node'; const locales = getLocales(); // ['en-US', 'es', 'fr'] ``` 函数签名: ```ts getLocales(): string[] ``` ## 工作方式 [#how-it-works] * **读取配置。** 返回传递给 [`initializeGT`](/docs/node/reference/functions/initialize-gt) 的 `locales` 数组。 * **同步。** 会立即返回,无需 `await`。 ## 参数 [#parameters] `getLocales` 无需任何参数。 ## 返回值 [#returns] **类型** `string[]` 一个由 BCP 47 区域设置代码组成的数组,表示支持的区域设置。 ## 示例 [#examples] ```ts title="handler.js" // 基本用法 import { getLocales } from 'gt-node'; app.get('/api/locales', (req, res) => { res.json({ supportedLocales: getLocales() }); }); ```