# node: getDefaultLocale URL: https://generaltranslation.com/zh/docs/node/api/get-default-locale.mdx --- title: getDefaultLocale description: getDefaultLocale 函数的 API 参考文档 --- ## 概述 `getDefaultLocale` 函数返回在 [`initializeGT`](/docs/node/api/initialize-gt) 中配置的默认区域设置。 ```js import { getDefaultLocale } from 'gt-node'; const defaultLocale = getDefaultLocale(); // 'en-US' ``` ## 参考 ### 参数 无。 ### 返回值 `string` — 默认的 BCP 47 [区域设置代码](/docs/core/locales) (例如 `'en-US'`) 。 *** ## 示例 ### 基本用法 ```js title="handler.js" import { getDefaultLocale } from 'gt-node'; app.get('/api/info', (req, res) => { res.json({ defaultLocale: getDefaultLocale() }); }); ``` *** ## 后续步骤 * 当前请求使用的区域设置,参见 [`getLocale`](/docs/node/api/get-locale)。 * 所有受支持的区域设置,参见 [`getLocales`](/docs/node/api/get-locales)。