大网数据广告活动
Windows Server 管理

Strings and localization in Windows Admin Center

· 52CE 我爱测

Learn about getting your strings ready for localization in Windows Admin Center SDK (Project Honolulu)

Let's go more in-depth into the Windows Admin Center Extensions SDK and talk about strings and localization.

To enable localization of all strings that are rendered on the presentation layer, take advantage of the strings.resjson file under /src/resources/strings - it's already set up. When you need to add a new string to your extension, add it to this resjson file as a new entry. The existing structure follows this format:

"<YourExtensionName>_<Component>_<Accessor>": "Your string value goes here.",

You can use any format you like for the strings, but be aware that the generation process (the process that takes the resjson and outputs the usable TypeScript class) converts underscore (_) to periods (.).

For example, this entry:

"HelloWorld_cim_title": "CIM Component",

Generates the following accessor structure:

MsftSme.resourcesStrings<Strings>().HelloWorld.cim.title;

Add Other Languages for Localization

For localization to other languages, a strings.resjson file needs to be created for each language. These files need to be placed in \loc\output\{!LanguageFolder}\strings.resjson. The available languages with corresponding folders are:

Language Folder
Čeština cs-CZ
Deutsch de-DE
English en-US
Español es-ES
Français fr-FR
Magyar hu-HU
Italiano it-IT
日本語 ja-JP
한국어 ko-KR
Nederlands nl-NL
Polski pl-PL
Português (Brasil) pt-BR
Português (Portugal) pt-PT
Русский ru-RU
Svenska sv-SE
Türkçe tr-TR
中文(简体) zh-CN
中文(繁體) zh-TW

Note: If your file structure needs are different inside of loc/output, you will need to adjust the localeOffset for the gulp task ‘generate-resjson-json-localized' that is in the gulpfile.js. This offset is how deep into the loc folder it should start searching for strings.resjson files.

Each strings.resjson file will be formatted in the same way as previously mentioned at the top of this guide.

For example, to include a localization for Español include this entry in \loc\output\HelloWorld\es-ES\strings.resjson:

"HelloWorld_cim_title": "CIM Componente",

Anytime that you added localized strings, gulp generate must be ran again in order to have them appear. Run:

gulp generate

To confirm that your strings have been generated navigate to \src\app\assets\strings\{!LanguageFolder}\strings.resjson. Your newly added entry will appear in this file. Now if you switch the language option in Windows Admin Center, you will be able to see the localized strings in your extension.

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 06/18/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。