# gt-next: General Translation Next.js SDK: useSetLocale URL: https://generaltranslation.com/zh/docs/next/api/helpers/use-set-locale.mdx --- title: useSetLocale description: useSetLocale Hook 的 API 参考 --- {/* 自动生成:请勿直接编辑。请改为编辑 content/docs-templates/ 中的模板。 */} ## 概述 `useSetLocale` hook 用于设置用户的区域设置。 该 hook 仅支持在客户端使用,且必须包裹在 [``](/docs/next/api/components/gtprovider) 组件中。 ## 参考 ### 返回值 用于设置用户区域设置的函数。 *** ## 示例 ### 基本用法 ```jsx import { useSetLocale } from 'gt-next'; export default function MyComponent() { const setLocale = useSetLocale(); return ; } ``` *** ## 注意事项 * `useSetLocale` 用于设置用户的区域设置。 * 在[此处](/docs/core/locales)了解更多区域设置代码信息。 ## 后续步骤 * 进一步了解 [``](/docs/next/api/components/gtprovider) 组件。 * 进一步了解 [`useLocale`](/docs/next/api/helpers/use-locale) Hook。