# gt-next: General Translation Next.js SDK: getLocaleProperties
URL: https://generaltranslation.com/zh/docs/next/api/helpers/get-locale-properties.mdx
---
title: getLocaleProperties
description: getLocaleProperties 服务器端方法的 API 参考
---
## 概述
`getLocaleProperties` 函数会在服务器端渲染期间返回指定区域设置的元数据,包括其名称、本地名称、语言、地区和书写系统信息。
`getLocaleProperties` 是一个服务器端方法,只能在服务器组件中使用。
如需在客户端使用,请参阅 [`useLocaleProperties`](/docs/next/api/helpers/use-locale-properties)。
## 参考
### 参数
| 参数 | 类型 | 描述 |
| -------- | -------- | ------------------------------------ |
| `locale` | `string` | BCP 47 区域设置代码 (如 `'en-US'`、`'ja'`) 。 |
### 返回值
一个 `LocaleProperties` 对象,包含以下字段:
| 字段 | 类型 | 描述 |
| -------------------------- | -------- | ------------------------------------------ |
| `code` | `string` | 区域设置代码 (例如 `'en-US'`) 。 |
| `name` | `string` | 区域设置的英文名称 (例如 `'American English'`) 。 |
| `nativeName` | `string` | 该区域设置在自身语言中的名称 (例如 `'American English'`) 。 |
| `languageCode` | `string` | 语言子标签 (例如 `'en'`) 。 |
| `languageName` | `string` | 语言的英文名称 (例如 `'English'`) 。 |
| `nativeLanguageName` | `string` | 该语言在其自身语言中的名称 (例如 `'English'`) 。 |
| `nameWithRegionCode` | `string` | 包含地区的区域设置名称 (例如 `'English (US)'`) 。 |
| `nativeNameWithRegionCode` | `string` | 包含地区的本地语言区域设置名称。 |
| `regionCode` | `string` | 地区子标签 (例如 `'US'`) 。 |
| `regionName` | `string` | 地区的英文名称 (例如 `'United States'`) 。 |
| `nativeRegionName` | `string` | 该地区在区域设置自身语言中的名称。 |
| `scriptCode` | `string` | 书写系统子标签 (例如 `'Latn'`) 。 |
| `scriptName` | `string` | 书写系统的英文名称 (例如 `'Latin'`) 。 |
| `nativeScriptName` | `string` | 该书写系统在区域设置自身语言中的名称。 |
| `maximizedCode` | `string` | 完全展开的区域设置代码 (例如 `'en-Latn-US'`) 。 |
***
## 示例
### 基本用法
```jsx title="LocaleInfo.jsx" copy
import { getLocaleProperties } from 'gt-next/server';
export default function LocaleInfo() {
const props = getLocaleProperties('en-US'); // [!code highlight]
return (
Name: {props.name}
Native name: {props.nativeName}
Region: {props.regionName}
);
}
```
***
## 说明
* 此函数为同步函数,无需使用 `await`。
* 可用于构建区域设置选择器,或向用户显示区域设置元数据。
## 后续步骤
* 客户端对应版本请参阅 [`useLocaleProperties`](/docs/next/api/helpers/use-locale-properties)。
* 进一步了解[区域设置代码](/docs/core/locales)。