-
Notifications
You must be signed in to change notification settings - Fork 413
Localize strings in OutputWindowHelper #6059
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
Changes from all commits
d983811
c718383
556ce96
41a296f
b8a60fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,16 @@ | |
| using Microsoft.VisualStudio.Shell; | ||
| using Microsoft.VisualStudio.Shell.Interop; | ||
|
|
||
| // Although the strings are the same in the wizard for both extensions, | ||
| // they are included with both their respective VSPackages. | ||
| // Strings for both extensions can be found in {PathToWindowsAppSDK}\dev\VSIX\Extension\Cs\Common\VSPackage.resx | ||
| // Wizard strings are numbers 1044 and above. | ||
| #if CSHARP_EXTENSION | ||
| using Resources = WindowsAppSDK.Cs.Extension.Dev17.VSPackage; | ||
| #elif CPP_EXTENSION | ||
| using Resources = WindowsAppSDK.Cpp.Extension.Dev17.VSPackage; | ||
| #endif | ||
|
|
||
| namespace WindowsAppSDK.TemplateUtilities | ||
| { | ||
| internal static class OutputWindowHelper | ||
|
|
@@ -17,37 +27,34 @@ internal static class OutputWindowHelper | |
| public static void ShowMessageInOutputWindow(string message, bool clearPane = true) | ||
| { | ||
| ThreadHelper.ThrowIfNotOnUIThread(); | ||
|
|
||
| // Log to Output window | ||
| IVsOutputWindow outputWindow = ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; | ||
| if (outputWindow != null) | ||
| { | ||
| Guid guidGeneral = Microsoft.VisualStudio.VSConstants.GUID_OutWindowGeneralPane; | ||
| IVsOutputWindowPane pane; | ||
| int hr = outputWindow.GetPane(ref guidGeneral, out pane); | ||
|
|
||
| // Create pane if it doesn't exist | ||
| if (pane == null) | ||
| { | ||
| hr = outputWindow.CreatePane(ref guidGeneral, "General", 1, 1); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am again realizing how I don't like the fact that the Resources class uses numbers as the name of the properties that return the strings we want. This makes it a bit hard to read. I would love if this was something like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. I've created this issue to capture this improvement so we can work on it in another PR. |
||
| hr = outputWindow.CreatePane(ref guidGeneral, Resources._1053, 1, 1); | ||
| if (hr == Microsoft.VisualStudio.VSConstants.S_OK) | ||
| { | ||
| outputWindow.GetPane(ref guidGeneral, out pane); | ||
| } | ||
| } | ||
|
|
||
| if (pane != null) | ||
| { | ||
| pane.Activate(); | ||
| if (clearPane) | ||
| { | ||
| pane.Clear(); | ||
| } | ||
| pane.OutputStringThreadSafe(message ?? "No error details available."); | ||
| pane.OutputStringThreadSafe(message ?? Resources._1054); | ||
| pane.OutputStringThreadSafe("\n"); | ||
| } | ||
| } | ||
|
|
||
| // Show the Output window | ||
| var dte = ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; | ||
| if (dte != null) | ||
|
|
||
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 only references the C# VSPackage.resx path but should also mention the C++ path since both extensions have their own resource files. Consider updating to: 'Strings for both extensions can be found in {PathToWindowsAppSDK}\dev\VSIX\Extension\Cs\Common\VSPackage.resx and {PathToWindowsAppSDK}\dev\VSIX\Extension\Cpp\Common\VSPackage.resx'