Skip to content

Commit 142b6e7

Browse files
authored
Localize strings in OutputWindowHelper (#6059)
* Localize strings for OutputWindowHelper * Name strings with variables * Add back copyright for VSPackage.Designer.cs files * Keep OutputWindowHelper.cs newlines consistent with WizardImplementation.cs * Remove extra string variables for performance
1 parent 5fdc9d6 commit 142b6e7

File tree

5 files changed

+64
-9
lines changed

5 files changed

+64
-9
lines changed

dev/VSIX/Extension/Cpp/Common/VSPackage.Designer.cs

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/VSIX/Extension/Cpp/Common/VSPackage.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,10 @@ For more details on the error, check the General tab in the Output window.</valu
250250
<data name="1052" xml:space="preserve">
251251
<value>Please manually add package references before building.</value>
252252
</data>
253+
<data name="1053" xml:space="preserve">
254+
<value>General</value>
255+
</data>
256+
<data name="1054" xml:space="preserve">
257+
<value>No output information available.</value>
258+
</data>
253259
</root>

dev/VSIX/Extension/Cs/Common/VSPackage.Designer.cs

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/VSIX/Extension/Cs/Common/VSPackage.resx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,10 @@
246246
<data name="1052" xml:space="preserve">
247247
<value>Please manually add package references before building.</value>
248248
</data>
249-
</root>
249+
<data name="1053" xml:space="preserve">
250+
<value>General</value>
251+
</data>
252+
<data name="1054" xml:space="preserve">
253+
<value>No output information available.</value>
254+
</data>
255+
</root>

dev/VSIX/Shared/OutputWindowHelper.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
using Microsoft.VisualStudio.Shell;
66
using Microsoft.VisualStudio.Shell.Interop;
77

8+
// Although the strings are the same in the wizard for both extensions,
9+
// they are included with both their respective VSPackages.
10+
// Strings for both extensions can be found in {PathToWindowsAppSDK}\dev\VSIX\Extension\Cs\Common\VSPackage.resx
11+
// Wizard strings are numbers 1044 and above.
12+
#if CSHARP_EXTENSION
13+
using Resources = WindowsAppSDK.Cs.Extension.Dev17.VSPackage;
14+
#elif CPP_EXTENSION
15+
using Resources = WindowsAppSDK.Cpp.Extension.Dev17.VSPackage;
16+
#endif
17+
818
namespace WindowsAppSDK.TemplateUtilities
919
{
1020
internal static class OutputWindowHelper
@@ -17,37 +27,34 @@ internal static class OutputWindowHelper
1727
public static void ShowMessageInOutputWindow(string message, bool clearPane = true)
1828
{
1929
ThreadHelper.ThrowIfNotOnUIThread();
20-
2130
// Log to Output window
2231
IVsOutputWindow outputWindow = ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
2332
if (outputWindow != null)
2433
{
2534
Guid guidGeneral = Microsoft.VisualStudio.VSConstants.GUID_OutWindowGeneralPane;
2635
IVsOutputWindowPane pane;
2736
int hr = outputWindow.GetPane(ref guidGeneral, out pane);
28-
2937
// Create pane if it doesn't exist
3038
if (pane == null)
3139
{
32-
hr = outputWindow.CreatePane(ref guidGeneral, "General", 1, 1);
40+
hr = outputWindow.CreatePane(ref guidGeneral, Resources._1053, 1, 1);
3341
if (hr == Microsoft.VisualStudio.VSConstants.S_OK)
3442
{
3543
outputWindow.GetPane(ref guidGeneral, out pane);
3644
}
3745
}
38-
46+
3947
if (pane != null)
4048
{
4149
pane.Activate();
4250
if (clearPane)
4351
{
4452
pane.Clear();
4553
}
46-
pane.OutputStringThreadSafe(message ?? "No error details available.");
54+
pane.OutputStringThreadSafe(message ?? Resources._1054);
4755
pane.OutputStringThreadSafe("\n");
4856
}
4957
}
50-
5158
// Show the Output window
5259
var dte = ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
5360
if (dte != null)

0 commit comments

Comments
 (0)