> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 支持的 NLS 函数

> GDK 中 WINAPI_PARTITION_GAMES 下公开的国家语言支持 (NLS) 函数参考，包含 Game OS 注意事项与使用说明。

国家语言支持 (NLS) 函数可帮助游戏支持与语言和区域相关的行为。在 XBOX 上,只有 `WinNLS.h` 中定义在 `WINAPI_PARTITION_GAMES` 分区下的 API 函数才可用。

<Note>
  标记为 **DEPRECATED** 的 API 在 GDK 上仍然可用,并遵循 Microsoft Docs 中记录的注意事项。请优先使用替代函数。
</Note>

## 可用的函数

| 函数                            | 状态            | 替代函数                       |
| ----------------------------- | ------------- | -------------------------- |
| `EnumSystemLocalesEx`         |               |                            |
| `FindNLSStringEx`             |               |                            |
| `FoldStringA`                 |               |                            |
| `GetACP`                      |               |                            |
| `GetCurrencyFormatEx`         |               |                            |
| `GetGeoInfoEx`                |               |                            |
| `GetLocaleInfoEx`             |               |                            |
| `GetNumberFormatEx`           |               |                            |
| `GetStringTypeA`              |               |                            |
| `GetStringTypeExA`            |               |                            |
| `GetThreadLocale`             |               |                            |
| `GetUserDefaultGeoName`       |               |                            |
| `GetUserDefaultLocaleName`    |               |                            |
| `GetUserPreferredUILanguages` | NOT SUPPORTED | 始终返回 `en-US`               |
| `IdnToAscii`                  |               |                            |
| `IdnToUnicode`                |               |                            |
| `IsValidCodePage`             |               |                            |
| `IsValidLocaleName`           |               |                            |
| `LCIDToLocaleName`            |               |                            |
| `LCMapStringEx`               |               |                            |
| `LocaleNameToLCID`            |               |                            |
| `ResolveLocaleName`           |               |                            |
| `SetThreadLocale`             |               |                            |
| `CompareString`               | DEPRECATED    | `CompareStringEx`          |
| `CompareStringA`              | DEPRECATED    | `CompareStringEx`          |
| `EnumSystemLocalesA`          | DEPRECATED    | `EnumSystemLocalesEx`      |
| `EnumSystemLocalesW`          | DEPRECATED    | `EnumSystemLocalesEx`      |
| `FindNLSString`               | DEPRECATED    | `FindNLSStringEx`          |
| `GetCPInfo`                   | DEPRECATED    | 使用 Unicode                 |
| `GetCPInfoExA`                | DEPRECATED    | 使用 Unicode                 |
| `GetCPInfoExW`                | DEPRECATED    | 使用 Unicode                 |
| `GetCurrencyFormatA`          | DEPRECATED    | `GetCurrencyFormatEx`      |
| `GetCurrencyFormatW`          | DEPRECATED    | `GetCurrencyFormatEx`      |
| `GetGeoInfoA`                 | DEPRECATED    | `GetGeoInfoEx`             |
| `GetGeoInfoW`                 | DEPRECATED    | `GetGeoInfoEx`             |
| `GetLocaleInfoA`              | DEPRECATED    | `GetLocaleInfoEx`          |
| `GetLocaleInfoW`              | DEPRECATED    | `GetLocaleInfoEx`          |
| `GetNumberFormatA`            | DEPRECATED    | `GetNumberFormatEx`        |
| `GetNumberFormatW`            | DEPRECATED    | `GetNumberFormatEx`        |
| `GetUserGeoID`                | DEPRECATED    | `GetUserDefaultLocaleName` |
| `LCMapStringA`                | DEPRECATED    | `LCMapStringEx`            |
| `LCMapStringW`                | DEPRECATED    | `LCMapStringEx`            |

## Game OS 行为说明

Game OS 的 NLS 函数**不**包含 Windows 拥有的完整语言学大小写映射表。排序规则与大小写操作无论区域设置如何,始终使用**序数值**。

**请在本地化流程中执行文化敏感的大小写与排序操作**,而不是在运行时进行。

受影响的函数:

| NLS               |
| ----------------- |
| `LCMapStringEx`   |
| `CompareStringEx` |
| `CompareString`   |
| `CompareStringA`  |

### 排序规则

| 基础             | 宽字符          | 多字节          |
| -------------- | ------------ | ------------ |
| `std::collate` |              |              |
| `strcoll`      | `wcscoll`    | `_mbscoll`   |
| `_stricoll`    | `_wcsicoll`  | `_mbsicoll`  |
| `_strncoll`    | `_wcsncoll`  | `_mbsncoll`  |
| `_strnicoll`   | `_wcsnicoll` | `_mbsnicoll` |

### 转换为大写

| 基础             | 变体            | 宽字符变体         |
| -------------- | ------------- | ------------- |
| `std::toupper` | `toupper`     | `towupper`    |
| `_toupper`     | `_toupper_l`  | `_towupper_l` |
| `std::isupper` | `isupper`     | `iswupper`    |
| `_isupper_l`   | `_iswupper_l` |               |

### 转换为小写

| 基础             | 变体            | 宽字符变体         |
| -------------- | ------------- | ------------- |
| `std::tolower` | `tolower`     | `towlower`    |
| `_tolower`     | `_tolower_l`  | `_towlower_l` |
| `std::islower` | `islower`     | `iswlower`    |
| `_islower_l`   | `_iswlower_l` |               |

<Note>
  该列表并不详尽 —— 其他 Standard C++ Library 函数也可能依赖受影响的 API。
</Note>

## 相关 API 文档

* [XGameRuntime features reference](/reference/system/xgameruntimefeature/xgameruntimefeature_members) —— 与 NLS 互补的区域设置 + 地区 GDK 接口


## Related topics

- [本地化与全球化概览](/zh-CN/build/game-principles/localization.md)
- [在 GDK 中使用 Clang/LLVM](/zh-CN/tools/tools-pc/visualstudio/gr-vs-clang.md)
- [在主机 GDK 中使用 Clang/LLVM](/zh-CN/tools/tools-console/visualstudio/vs-clang.md)
- [PIXBeginEvent 函数](/zh-CN/reference/tools/pix3/functions/pixbeginevent.md)
- [PIXBeginRetailEvent 函数](/zh-CN/reference/tools/pix3/functions/pixbeginretailevent.md)
