Add resource-DLL localization foundation - #2994
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Pull request overview
This PR introduces a foundational localization mechanism for System Informer by loading optional, resource-only translation DLLs (no code execution) and exposing a lookup API that supports fallback to built-in English strings.
Changes:
- Add a localization loader (
PhInitializeLocalization) and string lookup API (PhGetLocalizedString) with aLanguagesetting (autoor explicit locale). - Update the main menu to use localized string IDs with per-string English fallbacks.
- Add an initial resource-only
zh-CNtranslation DLL project and solution integration.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| translations/zh-CN/SystemInformer.zh-CN.vcxproj | Adds a resource-only translation DLL project (NoEntryPoint) that outputs to the app’s translations\ folder. |
| translations/zh-CN/SystemInformer.zh-CN.rc | Defines initial zh-CN stringtable entries for the top-level main menu labels. |
| translations/README.md | Documents translation DLL behavior and fallback strategy. |
| SystemInformer/SystemInformer.vcxproj.filters | Adds the new localization source/header files to the VS filters. |
| SystemInformer/SystemInformer.vcxproj | Adds localization.c and localization headers to the main project build. |
| SystemInformer/SystemInformer.def | Exports the localization initialization and string lookup APIs for consumers (e.g., plugins). |
| SystemInformer/settings.c | Adds default Language=auto setting. |
| SystemInformer/mainwnd.c | Switches top-level main menu labels to use PhGetLocalizedString with English fallbacks. |
| SystemInformer/main.c | Initializes localization during startup. |
| SystemInformer/localization.c | Implements translation DLL selection, trust policy, resource loading, and caching. |
| SystemInformer/include/phsettings.h | Adds SETTING_LANGUAGE constant. |
| SystemInformer/include/phapp.h | Includes localization.h in the public app header. |
| SystemInformer/include/localizationres.h | Introduces the shared localized string ID range and initial IDs. |
| SystemInformer/include/localization.h | Declares the exported localization APIs. |
| SystemInformer.slnx | Adds the SystemInformer.zh-CN translation project to the solution definition. |
| SystemInformer.sln | Adds the SystemInformer.zh-CN translation project and build configurations to the VS solution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a4a28d6 to
f289092
Compare
|
Updated the branch onto current master and addressed all three review comments in f289092: RT_STRING bounds validation, PH_INITONCE initialization, and an English-first bilingual trust-policy comment. Local Debug x64 SystemInformer, Release x64 compilation, Debug/Release zh-CN resource DLLs, and Debug x64 ExtendedTools all pass. GitHub currently marks the two new CI workflow runs as action_required with no jobs, so they appear to require maintainer approval for the updated fork commit. |
|
I have not fully reviewed this code but I want to stop by and give a response to the following question:
We could leverage this but the verification code using the KPH signing does not exist in user-mode. And it should not be required for loading the localization DLL - as long as the localization DLL is loaded as a data-file (e.g. no-execute). We shouldn't apply or expect any KPH signing in this situation. An Authenticode check in release builds seems completely reasonable. |
Introduce data-only translation resources with English fallback, locale selection through the Language setting, release trust checks, and a minimal zh-CN main-menu sample.
Validate RT_STRING block bounds, make localization initialization idempotent, and document the unsigned development path bilingually.
f289092 to
7b0a5dc
Compare
|
@jxy-s Thanks, that confirms the direction. The loader keeps the translation DLL data-only ( The current implementation uses Authenticode same-signer verification in Release when KSI support is enabled, while Debug and KSI-disabled community builds can load unsigned resources for translation development. If you would prefer Authenticode enforcement for every Release build regardless of KSI, I can tighten that condition. I have also rebased the PR onto the latest upstream |
Summary
This PR implements the smallest reviewable localization foundation discussed in #302 and in the design comment.
translations/SystemInformer.<locale>.dllwithLOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE, so no translation DLL code is executed;Languagesetting (auto, an English locale, or an explicit locale name; restart required);zh-CNproject containing only the five top-level main-menu labels;Missing DLLs, invalid locale names, missing resource IDs, and English locale selections all take the fast English fallback path.
Scope
This intentionally does not attempt to translate every dialog or plugin in one change. First-party plugin resources, a user-facing language picker, packaging/signing integration, and broader string migration are deferred until the resource format and trust policy are accepted.
Existing plugin loading and menu-location identifiers are unchanged. As a compatibility check before the latest upstream environment-dialog migration, the first-party
ToolStatusplugin built against the generated Debug x64 SDK.Validation
masterat37501a3(2026-07-20).SystemInformer.zh-CN.dllbuilds: passed after the rebase.SystemInformercompile, includinglocalization.c: passed after the rebase with a command-line-onlySpectreMitigation=falseoverride.autoselection on azh-CNWindows profile: native menu text returned系统 / 界面 / 工具 / 用户 / 帮助.System / View / Tools / Users / Helpwithout a crash.git diff --check: passed.A current full Visual Studio link is blocked by the upstream
envdlgmove:SystemInformer.vcxprojdoes not yet includeSystemInformer/envdlg.c, andplugins/ExtendedTools/ExtendedTools.vcxprojstill references the removed plugin copy. This produces unresolvedPhShowEnvironmentVariablesDialog/PhShowEnvironmentVariableSplitDialogsymbols in the main project and a missingenvdlg.cin ExtendedTools; neither project-file mismatch is introduced by this PR. The local Visual Studio installation also lacks the x64 Spectre-mitigated libraries, so Release validation uses the command-line-only override above; no project security setting was changed.Review questions
Related to #302.