-
Notifications
You must be signed in to change notification settings - Fork 1.6k
User/beenachauhan/wsladiag localization support #13997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/wsl-for-apps
Are you sure you want to change the base?
User/beenachauhan/wsladiag localization support #13997
Conversation
ddebff2 to
1107c6a
Compare
benhillis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will want to add WSLA strings to a different .resw file. Otherwise we will have localized strings in both products that do not need to be present.
We might be able to get away with it either by relying on the fact that the localization methods are inline, and so the compiler should eliminate the strings that aren't used, or by having a special prefix for WSLA strings so the localization script can generate two separate headers. Either way, that's something that would be ok to do in a followup PR IMO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds comprehensive localization support to the wsladiag diagnostics tool by replacing all hardcoded user-facing strings with localized messages from Resources.resw. The changes ensure that error messages, usage information, and session listing output can be properly localized for international users.
Key Changes
- Replaced hardcoded strings with 11 new localization entries for wsladiag-specific messages
- Refactored usage information to use
PrintUsage()function with localized message - Updated error handling to use consistent localization API patterns
- Improved table formatting to properly handle localized column headers with dynamic width calculation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/windows/wsladiag/wsladiag.cpp | Replaced all hardcoded user-facing strings with Localization API calls; added using declarations; renamed variable from 'code' to 'exitCode' for clarity; changed ErrorCodeToString to GetErrorString; improved table formatting logic |
| localization/strings/en-US/Resources.resw | Added 11 new message entries (MessageWsladiagUsage, MessageWslaSessionNotFound, MessageWslaOpenSessionFailed, MessageWslaNoSessionsFound, MessageWslaSessionsFound, MessageWslaShellExited, MessageWslaShellSignalled, MessageWslaHeaderId, MessageWslaHeaderCreatorPid, MessageWslaHeaderDisplayName, MessageWslaUnknownCommand) with appropriate localization annotations |
| wsladiag list | ||
| wsladiag shell <SessionName> [--verbose] | ||
| wsladiag --help</value> | ||
| <comment>{Locked="--verbose]"}{Locked="--help"}Command line arguments, file names and string inserts should not be translated</comment> |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has a typo in the Locked annotation. It should be {Locked="--verbose"} instead of {Locked="--verbose]"}. The closing bracket should be a double quote to match the opening quote.
| <comment>{Locked="--verbose]"}{Locked="--help"}Command line arguments, file names and string inserts should not be translated</comment> | |
| <comment>{Locked="--verbose"}{Locked="--help"}Command line arguments, file names and string inserts should not be translated</comment> |
src/windows/wsladiag/wsladiag.cpp
Outdated
| wslutil::PrintMessage(std::format(L"Found {} WSLA session{}:", sessions.size(), sessions.size() > 1 ? L"s" : L""), stdout); | ||
| wslutil::PrintMessage(Localization::MessageWslaSessionsFound(sessions.size()), stdout); | ||
|
|
||
| // Compute column widths from headers + data . |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space before the period in this comment. It should be "headers + data." instead of "headers + data ."
| // Compute column widths from headers + data . | |
| // Compute column widths from headers + data. |
46dfad2 to
57c5c1d
Compare
Summary of the Pull Request
Adds localization support to wsladiag by replacing all hardcoded user-facing strings with localized messages from Resources.resw. All messages (usage, errors, session list output) are now accessible via the Localization class.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Usage information
Validation Steps Performed
Built project successfully with cmake --build build-vs-x64 --config Debug --parallel
Ran all wsladiag tests: [bin\x64\debug\test.bat /name:WsladiagTests]- All 8 tests passed
Manually tested commands:
[wsladiag.exe --help] - displays localized usage
wsladiag.exe list - displays localized session list or "No WSLA sessions found"
wsladiag.exe shell InvalidSession - displays localized error "Session not found: 'InvalidSession'"
wsladiag.exe badcommand - displays localized "Unknown command: 'badcommand'" error