Skip to content

Conversation

@beena352
Copy link

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

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [x ] Tests: Added/updated if needed and all pass
  • [x ] Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

  • Added 11 new localization entries to [Resources.resw] for wsladiag-specific messages
  • Updated [wsladiag.cpp] to use [Localization::MessageWslaXxx()] for all user-facing output including:
    Usage information
  • Session not found / open session failed errors
  • Session list output (headers, no sessions message, session count)
  • Shell exit status messages
  • Unknown command errors
  • Added [using wsl::shared::Localization;]declaration following existing codebase patterns
  • All existing WsladiagTests pass (8/8 tests validate localized message output)

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

@beena352 beena352 force-pushed the user/beenachauhan/wsladiag-localization-support branch from ddebff2 to 1107c6a Compare December 30, 2025 21:28
Copy link
Member

@benhillis benhillis left a 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.

@OneBlue
Copy link
Collaborator

OneBlue commented Dec 31, 2025

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

@beena352 beena352 marked this pull request as ready for review January 1, 2026 20:18
@beena352 beena352 requested a review from a team as a code owner January 1, 2026 20:18
Copilot AI review requested due to automatic review settings January 1, 2026 20:18
Copy link
Contributor

Copilot AI left a 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>
Copy link

Copilot AI Jan 1, 2026

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.

Suggested change
<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>

Copilot uses AI. Check for mistakes.
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 .
Copy link

Copilot AI Jan 1, 2026

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 ."

Suggested change
// Compute column widths from headers + data .
// Compute column widths from headers + data.

Copilot uses AI. Check for mistakes.
@beena352 beena352 force-pushed the user/beenachauhan/wsladiag-localization-support branch from 46dfad2 to 57c5c1d Compare January 2, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants