Skip to content

Commit 1b1d3be

Browse files
authored
Move hardcoded cli strings to resx (#10504)
* Move hardcoded cli strings to resx * update names * update designers
1 parent a5f34a7 commit 1b1d3be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+525
-238
lines changed

src/Aspire.Cli/Commands/ExecCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ protected override async Task<int> ExecuteAsync(ParseResult parseResult, Cancell
199199
});
200200

201201
commandExitCode = await _interactionService.ShowStatusAsync<int?>(
202-
":running_shoe: Running exec...",
202+
$":running_shoe: {ExecCommandStrings.Running}",
203203
async () =>
204204
{
205205
// execute tool and stream the output
@@ -222,7 +222,7 @@ protected override async Task<int> ExecuteAsync(ParseResult parseResult, Cancell
222222
if (backchannel is not null)
223223
{
224224
_ = await _interactionService.ShowStatusAsync<int>(
225-
":linked_paperclips: Stopping app host...",
225+
$":linked_paperclips: {ExecCommandStrings.StoppingAppHost}",
226226
async () =>
227227
{
228228
await backchannel.RequestStopAsync(cancellationToken);

src/Aspire.Cli/Commands/RunCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected override async Task<int> ExecuteAsync(ParseResult parseResult, Cancell
158158
cancellationToken);
159159

160160
// Wait for the backchannel to be established.
161-
var backchannel = await _interactionService.ShowStatusAsync("Connecting to app host...", async () =>
161+
var backchannel = await _interactionService.ShowStatusAsync(RunCommandStrings.ConnectingToAppHost, async () =>
162162
{
163163
return await backchannelCompletitionSource.Task.WaitAsync(cancellationToken);
164164
});
@@ -167,7 +167,7 @@ protected override async Task<int> ExecuteAsync(ParseResult parseResult, Cancell
167167

168168
var pendingLogCapture = CaptureAppHostLogsAsync(logFile, backchannel, cancellationToken);
169169

170-
var dashboardUrls = await _interactionService.ShowStatusAsync("Starting dashboard...", async () =>
170+
var dashboardUrls = await _interactionService.ShowStatusAsync(RunCommandStrings.StartingDashboard, async () =>
171171
{
172172
return await backchannel.GetDashboardUrlsAsync(cancellationToken);
173173
});

src/Aspire.Cli/Interaction/ConsoleInteractionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ public void DisplayEmptyLine()
194194
public void DisplayVersionUpdateNotification(string newerVersion)
195195
{
196196
_ansiConsole.WriteLine();
197-
_ansiConsole.MarkupLine($"[yellow]A new version of the Aspire CLI is available: {newerVersion}[/]");
198-
_ansiConsole.MarkupLine($"[dim]For more information, see: [link]{UpdateUrl}[/][/]");
197+
_ansiConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.NewCliVersionAvailable, newerVersion));
198+
_ansiConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.MoreInfoNewCliVersion, UpdateUrl));
199199
_ansiConsole.WriteLine();
200200
}
201201
}

src/Aspire.Cli/Resources/ExecCommandStrings.Designer.cs

Lines changed: 41 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Aspire.Cli/Resources/ExecCommandStrings.resx

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<root>
3-
<!--
4-
Microsoft ResX Schema
5-
3+
<!--
4+
Microsoft ResX Schema
5+
66
Version 2.0
7-
8-
The primary goals of this format is to allow a simple XML format
9-
that is mostly human readable. The generation and parsing of the
10-
various data types are done through the TypeConverter classes
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
1111
associated with the data types.
12-
12+
1313
Example:
14-
14+
1515
... ado.net/XML headers & schema ...
1616
<resheader name="resmimetype">text/microsoft-resx</resheader>
1717
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
2626
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
2727
<comment>This is a comment</comment>
2828
</data>
29-
30-
There are any number of "resheader" rows that contain simple
29+
30+
There are any number of "resheader" rows that contain simple
3131
name/value pairs.
32-
33-
Each data row contains a name, and value. The row also contains a
34-
type or mimetype. Type corresponds to a .NET class that support
35-
text/value conversion through the TypeConverter architecture.
36-
Classes that don't support this are serialized and stored with the
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
3737
mimetype set.
38-
39-
The mimetype is used for serialized objects, and tells the
40-
ResXResourceReader how to depersist the object. This is currently not
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
4141
extensible. For a given mimetype the value must be set accordingly:
42-
43-
Note - application/x-microsoft.net.object.binary.base64 is the format
44-
that the ResXResourceWriter will generate, however the reader can
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
4545
read any of the formats listed below.
46-
46+
4747
mimetype: application/x-microsoft.net.object.binary.base64
48-
value : The object must be serialized with
48+
value : The object must be serialized with
4949
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
5050
: and then encoded with base64 encoding.
51-
51+
5252
mimetype: application/x-microsoft.net.object.soap.base64
53-
value : The object must be serialized with
53+
value : The object must be serialized with
5454
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
5555
: and then encoded with base64 encoding.
5656
5757
mimetype: application/x-microsoft.net.object.bytearray.base64
58-
value : The object must be serialized into a byte array
58+
value : The object must be serialized into a byte array
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
@@ -147,4 +147,10 @@ Examples:
147147
<data name="NoCommandSpecified" xml:space="preserve">
148148
<value>Command is not specified.</value>
149149
</data>
150-
</root>
150+
<data name="Running" xml:space="preserve">
151+
<value>Running exec...</value>
152+
</data>
153+
<data name="StoppingAppHost" xml:space="preserve">
154+
<value>Stopping app host...</value>
155+
</data>
156+
</root>

src/Aspire.Cli/Resources/InteractionServiceStrings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Aspire.Cli/Resources/InteractionServiceStrings.resx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,12 @@
200200
<data name="WaitingForDebuggerToAttachToAppHost" xml:space="preserve">
201201
<value>Waiting for debugger to attach to app host process</value>
202202
</data>
203+
<data name="NewCliVersionAvailable" xml:space="preserve">
204+
<value>[yellow]A new version of the Aspire CLI is available: {0}[/]</value>
205+
<comment>Do not translate [yellow] and also leave [/] as-is. {0} is the version number</comment>
206+
</data>
207+
<data name="MoreInfoNewCliVersion" xml:space="preserve">
208+
<value>[dim]For more information, see: [link]{0}[/][/]</value>
209+
<comment>Do not translate [dim] and [link]. Also leave [/] as-is. {0} is a URL</comment>
210+
</data>
203211
</root>

0 commit comments

Comments
 (0)