Skip to content

[Code Quality] Servy/MainViewModel.cs — Hardcoded English dialog titles in 4 SaveFile calls #735

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Info
File: src/Servy/ViewModels/MainViewModel.cs lines 997, 1002, 1027, 1032

Description:
Four BrowseXxx commands pass English dialog titles as string literals directly to _dialogService.SaveFile(...), bypassing Servy.Resources.Strings:

private void BrowseStdoutPath() =>
    BrowseAndAssign(() => _dialogService.SaveFile("Select standard output file"), v => StdoutPath = v);

private void BrowseStderrPath() =>
    BrowseAndAssign(() => _dialogService.SaveFile("Select standard error file"), v => StderrPath = v);

private void BrowsePreLaunchStdoutPath() => /* same pattern */
private void BrowsePreLaunchStderrPath() => /* same pattern */

Everywhere else in the file, dialog captions come from Strings.Caption_X / Strings.Dialog_Y. These four lines are the outliers — if the product adds any non-English culture (or just wants to retune the wording of the stdout/stderr dialogs), four hardcoded copies have to be found and edited.

Suggested fix:
Add keys Dialog_SelectStdoutFile, Dialog_SelectStderrFile, Dialog_SelectPreLaunchStdoutFile, Dialog_SelectPreLaunchStderrFile (or a single parameterised Dialog_SelectFileFor_{0} and interpolate) to Servy/Resources/Strings.resx and replace the literals. While touching it, grep the rest of the file for any other _dialogService.SaveFile( / _dialogService.OpenFile( call with a literal argument — it's worth catching them all in one pass.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions