diff --git a/Nodejs/Product/Nodejs/BaseNodeProjectFactory.cs b/Nodejs/Product/Nodejs/BaseNodeProjectFactory.cs index 526abcbc6..378a04f24 100644 --- a/Nodejs/Product/Nodejs/BaseNodeProjectFactory.cs +++ b/Nodejs/Product/Nodejs/BaseNodeProjectFactory.cs @@ -21,7 +21,6 @@ using Microsoft.NodejsTools.Project; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudioTools.Project; -using SR = Microsoft.NodejsTools.Project.SR; namespace Microsoft.NodejsTools { [Guid(Guids.NodejsBaseProjectFactoryString)] @@ -50,7 +49,7 @@ protected override void UpgradeProject(ref ProjectRootElement projectXml, ref Pr var globals = projectXml.PropertyGroups.FirstOrDefault() ?? projectXml.AddPropertyGroup(); AddOrSetProperty(globals, NodeProjectProperty.Environment, envVarsProp.Value.Replace(";", "\r\n")); envVarsProp.Parent.RemoveChild(envVarsProp); - log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedEnvironmentVariables)); + log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, Resources.UpgradedEnvironmentVariables); } } diff --git a/Nodejs/Product/Nodejs/Commands/AzureExplorerAttachDebuggerCommand.cs b/Nodejs/Product/Nodejs/Commands/AzureExplorerAttachDebuggerCommand.cs index 5af074225..56cb6ab9f 100644 --- a/Nodejs/Product/Nodejs/Commands/AzureExplorerAttachDebuggerCommand.cs +++ b/Nodejs/Product/Nodejs/Commands/AzureExplorerAttachDebuggerCommand.cs @@ -80,7 +80,7 @@ public override void DoCommand(object sender, EventArgs args) { Action> onAttach = null; onAttach = (attachTask) => { if (!attachTask.Result) { - string msg = Project.SR.GetString(Project.SR.AzureRemoteDebugCouldNotAttachToWebsiteErrorMessage, webSite.Uri); + string msg = string.Format(CultureInfo.CurrentCulture, Resources.AzureRemoveDebugCouldNotAttachToWebsiteErrorMessage, webSite.Uri); if (MessageBox.Show(msg, null, MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry) { AttachWorker(webSite).ContinueWith(onAttach); } @@ -186,8 +186,8 @@ private AzureWebSiteInfo GetSelectedAzureWebSite() { private async Task AttachWorker(AzureWebSiteInfo webSite) { using (new WaitDialog( - Project.SR.GetString(Project.SR.AzureRemoteDebugWaitCaption), - Project.SR.GetString(Project.SR.AzureRemoteDebugWaitMessage, webSite.Uri), + Resources.AzureRemoteDebugWaitCaption, + string.Format(CultureInfo.CurrentCulture, Resources.AzureRemoteDebugWaitMessage, webSite.Uri), NodejsPackage.Instance, showProgress: true)) { // Get path (relative to site URL) for the debugger endpoint. @@ -224,7 +224,7 @@ where components[0].Trim() == "Microsoft.NodejsTools.Debugger.WebSocketProxy" // ask the user to retry, so the only case where we actually get here is if user canceled on error. If this is the case, // we don't want to pop any additional error messages, so always return true, but log the error in the Output window. var output = OutputWindowRedirector.GetGeneral(NodejsPackage.Instance); - output.WriteErrorLine(Project.SR.GetString(Project.SR.AzureRemoveDebugCouldNotAttachToWebsiteExceptionErrorMessage, ex.Message)); + output.WriteErrorLine(string.Format(CultureInfo.CurrentCulture, Resources.AzureRemoveDebugCouldNotAttachToWebsiteExceptionErrorMessage, ex.Message)); output.ShowAndActivate(); } return true; diff --git a/Nodejs/Product/Nodejs/Commands/ImportWizardCommand.cs b/Nodejs/Product/Nodejs/Commands/ImportWizardCommand.cs index 5adf779b9..3daefd090 100644 --- a/Nodejs/Product/Nodejs/Commands/ImportWizardCommand.cs +++ b/Nodejs/Product/Nodejs/Commands/ImportWizardCommand.cs @@ -32,7 +32,7 @@ namespace Microsoft.NodejsTools.Commands { class ImportWizardCommand : Command { public override void DoCommand(object sender, EventArgs args) { var statusBar = (IVsStatusbar)CommonPackage.GetGlobalService(typeof(SVsStatusbar)); - statusBar.SetText(SR.GetString(SR.ImportingProjectStatusText)); + statusBar.SetText(Resources.ImportingProjectStatusText); var dlg = new Microsoft.NodejsTools.Project.ImportWizard.ImportWizard(); int commandIdToRaise = (int)VSConstants.VSStd97CmdID.OpenProject; @@ -65,7 +65,7 @@ public override void DoCommand(object sender, EventArgs args) { } catch (AggregateException ex) { if (ex.InnerException is UnauthorizedAccessException) { MessageBox.Show( - SR.GetString(SR.ImportingProjectAccessErrorStatusText, Environment.NewLine), + string.Format(CultureInfo.CurrentCulture, Resources.ImportingProjectAccessErrorStatusText, Environment.NewLine), SR.ProductName); } else { string exName = String.Empty; @@ -74,7 +74,7 @@ public override void DoCommand(object sender, EventArgs args) { } MessageBox.Show( - SR.GetString(SR.ImportingProjectUnexpectedErrorMessage, exName), + string.Format(CultureInfo.CurrentCulture, Resources.ImportingProjectUnexpectedErrorMessage, exName), SR.ProductName); } return; @@ -84,7 +84,7 @@ public override void DoCommand(object sender, EventArgs args) { NodejsPackage.Instance.DTE.Commands.Raise(VSConstants.GUID_VSStandardCommandSet97.ToString("B"), commandIdToRaise, ref pathRef, ref outRef); statusBar.SetText(String.Empty); } else { - statusBar.SetText(SR.GetString(SR.ImportingProjectErrorStatusText)); + statusBar.SetText(Resources.ImportingProjectErrorStatusText); } }, CancellationToken.None, diff --git a/Nodejs/Product/Nodejs/Commands/OpenRemoteDebugProxyFolderCommand.cs b/Nodejs/Product/Nodejs/Commands/OpenRemoteDebugProxyFolderCommand.cs index 9dfebf5c0..768572cbf 100644 --- a/Nodejs/Product/Nodejs/Commands/OpenRemoteDebugProxyFolderCommand.cs +++ b/Nodejs/Product/Nodejs/Commands/OpenRemoteDebugProxyFolderCommand.cs @@ -39,13 +39,13 @@ public override void DoCommand(object sender, EventArgs args) { // Open explorer to folder var remoteDebugProxyFolder = RemoteDebugProxyFolder; if (string.IsNullOrWhiteSpace(remoteDebugProxyFolder)) { - MessageBox.Show(SR.GetString(SR.RemoteDebugProxyFolderDoesNotExist), SR.ProductName); + MessageBox.Show(Resources.RemoteDebugProxyFolderDoesNotExist, SR.ProductName); return; } var filePath = Path.Combine(remoteDebugProxyFolder, remoteDebugJsFileName); if (!File.Exists(filePath)) { - MessageBox.Show(SR.GetString(SR.RemoteDebugProxyFileDoesNotExist, filePath), SR.ProductName); + MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.RemoteDebugProxyFileDoesNotExist, filePath), SR.ProductName); } else { Process.Start("explorer", string.Format(CultureInfo.InvariantCulture, "/e,/select,{0}", filePath)); } diff --git a/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs b/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs index 5bbd97f26..46ea81925 100644 --- a/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs +++ b/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs @@ -25,7 +25,6 @@ using Microsoft.NodejsTools.Debugger.Events; using Microsoft.VisualStudioTools.Project; using Newtonsoft.Json.Linq; -using SR = Microsoft.NodejsTools.Project.SR; namespace Microsoft.NodejsTools.Debugger.Communication { sealed class DebuggerClient : IDebuggerClient { @@ -110,7 +109,7 @@ public static async void RunWithRequestExceptionsHandled(Func action) { private void OnConnectionClosed(object sender, EventArgs e) { ConcurrentDictionary> messages = Interlocked.Exchange(ref _messages, new ConcurrentDictionary>()); foreach (var kv in messages) { - var exception = new IOException(SR.GetString(SR.DebuggerConnectionClosed)); + var exception = new IOException(Resources.DebuggerConnectionClosed); kv.Value.SetException(exception); } diff --git a/Nodejs/Product/Nodejs/Debugger/DebugEngine/AD7Engine.cs b/Nodejs/Product/Nodejs/Debugger/DebugEngine/AD7Engine.cs index 0a113891a..da4304a5d 100644 --- a/Nodejs/Product/Nodejs/Debugger/DebugEngine/AD7Engine.cs +++ b/Nodejs/Product/Nodejs/Debugger/DebugEngine/AD7Engine.cs @@ -32,7 +32,6 @@ using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudioTools.Project; -using SR = Microsoft.NodejsTools.Project.SR; namespace Microsoft.NodejsTools.Debugger.DebugEngine { // AD7Engine is the primary entrypoint object for the debugging engine. @@ -1244,7 +1243,7 @@ private void OnDocumentSaved(Document document) { if (String.Equals(Path.GetExtension(module.FileName), NodejsConstants.TypeScriptExtension, StringComparison.OrdinalIgnoreCase)) { if (document.ProjectItem.ContainingProject.GetNodeProject().Build(null, null) != MSBuildResult.Successful) { var statusBar = (IVsStatusbar)ServiceProvider.GlobalProvider.GetService(typeof(SVsStatusbar)); - statusBar.SetText(SR.GetString(SR.DebuggerModuleUpdateFailed)); + statusBar.SetText(Resources.DebuggerModuleUpdateFailed); return; } } @@ -1253,7 +1252,7 @@ private void OnDocumentSaved(Document document) { var currentProcess = Process; if (currentProcess == null || !await currentProcess.UpdateModuleSourceAsync(module).ConfigureAwait(false)) { var statusBar = (IVsStatusbar)ServiceProvider.GlobalProvider.GetService(typeof(SVsStatusbar)); - statusBar.SetText(SR.GetString(SR.DebuggerModuleUpdateFailed)); + statusBar.SetText(Resources.DebuggerModuleUpdateFailed); } }); } diff --git a/Nodejs/Product/Nodejs/Debugger/DebugEngine/Remote/NodeRemoteEnumDebugProcesses.cs b/Nodejs/Product/Nodejs/Debugger/DebugEngine/Remote/NodeRemoteEnumDebugProcesses.cs index b3286e47e..207df6417 100644 --- a/Nodejs/Product/Nodejs/Debugger/DebugEngine/Remote/NodeRemoteEnumDebugProcesses.cs +++ b/Nodejs/Product/Nodejs/Debugger/DebugEngine/Remote/NodeRemoteEnumDebugProcesses.cs @@ -126,7 +126,7 @@ private static NodeRemoteDebugProcess Connect(NodeRemoteDebugPort port, INetwork } catch (PlatformNotSupportedException) { LiveLogger.WriteLine("PlatformNotSupportedException connecting to remote debugger"); MessageBox.Show( - Project.SR.GetString(Project.SR.RemoteDebugUnsupportedPlatformErrorMessage), + Resources.RemoteDebugUnsupportedPlatformErrorMessage, null, MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } @@ -137,14 +137,15 @@ private static NodeRemoteDebugProcess Connect(NodeRemoteDebugPort port, INetwork } } - string errText = Project.SR.GetString(Project.SR.RemoteDebugCouldNotAttachErrorMessage, + string errText = string.Format(CultureInfo.CurrentCulture, + Resources.RemoteDebugCouldNotAttachErrorMessage, port.Uri, exception != null ? ":\r\n\r\n" + exception.Message : "."); if (!(exception is DebuggerAlreadyAttachedException)) { if (port.Uri.Scheme == "ws" || port.Uri.Scheme == "wss") { - errText += Project.SR.GetString(Project.SR.RemoteDebugEnableWebSocketsErrorMessage); + errText += Resources.RemoteDebugEnableWebSocketsErrorMessage; } else { - errText += Project.SR.GetString(Project.SR.RemoteDebugCheckProxyAndPortErrorMessage, NodejsConstants.DefaultDebuggerPort); + errText += string.Format(CultureInfo.CurrentCulture, Resources.RemoteDebugCheckProxyAndPortErrorMessage, NodejsConstants.DefaultDebuggerPort); } } diff --git a/Nodejs/Product/Nodejs/NodejsPackage.cs b/Nodejs/Product/Nodejs/NodejsPackage.cs index 0664ab4f0..ec514579f 100644 --- a/Nodejs/Product/Nodejs/NodejsPackage.cs +++ b/Nodejs/Product/Nodejs/NodejsPackage.cs @@ -169,7 +169,7 @@ protected override void Initialize() { if (!_hasRequiredTypescriptVersion.Value) { MessageBox.Show( - Project.SR.GetString(Project.SR.TypeScriptMinVersionNotInstalled, _minRequiredTypescriptVersion.ToString()), + string.Format(CultureInfo.CurrentCulture, Resources.TypeScriptMinVersionNotInstalled, _minRequiredTypescriptVersion.ToString()), Project.SR.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -299,7 +299,7 @@ internal IReplWindow2 OpenReplWindow(bool focus = true) { if (window == null) { window = (IReplWindow2)provider.CreateReplWindow( ReplContentType, - Project.SR.GetString(Project.SR.InteractiveWindowTitle), + Resources.InteractiveWindowTitle, Guids.TypeScriptLanguageInfo, NodejsReplEvaluatorProvider.NodeReplId ); diff --git a/Nodejs/Product/Nodejs/NpmUI/ErrorHelper.cs b/Nodejs/Product/Nodejs/NpmUI/ErrorHelper.cs index 1ea6b17f1..4412c0f00 100644 --- a/Nodejs/Product/Nodejs/NpmUI/ErrorHelper.cs +++ b/Nodejs/Product/Nodejs/NpmUI/ErrorHelper.cs @@ -19,6 +19,7 @@ using System.Windows; using Microsoft.NodejsTools.Npm; using Microsoft.NodejsTools.Project; +using System.Globalization; namespace Microsoft.NodejsTools.NpmUI { @@ -72,18 +73,18 @@ public static void ReportNpmNotInstalled( } } - var message = SR.GetString(SR.NpmNotInstalledMessageText, nnfe.Message); + var message = string.Format(CultureInfo.CurrentCulture, Resources.NpmNotInstalledMessageText, nnfe.Message); if (null == owner) { MessageBox.Show( message, - SR.GetString(SR.NpmNotInstalledMessageCaption), + Resources.NpmNotInstalledMessageCaption, MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show( owner, message, - SR.GetString(SR.NpmNotInstalledMessageCaption), + Resources.NpmNotInstalledMessageCaption, MessageBoxButton.OK, MessageBoxImage.Error); } diff --git a/Nodejs/Product/Nodejs/NpmUI/LastRefreshedMessageProvider.cs b/Nodejs/Product/Nodejs/NpmUI/LastRefreshedMessageProvider.cs index 79f4eb285..f7f5908b2 100644 --- a/Nodejs/Product/Nodejs/NpmUI/LastRefreshedMessageProvider.cs +++ b/Nodejs/Product/Nodejs/NpmUI/LastRefreshedMessageProvider.cs @@ -16,17 +16,18 @@ using System; using Microsoft.NodejsTools.Project; +using System.Globalization; namespace Microsoft.NodejsTools.NpmUI { internal class LastRefreshedMessageProvider { public static readonly LastRefreshedMessageProvider RefreshFailed = new LastRefreshedMessageProvider { Days = int.MaxValue, - Description = SR.GetString(SR.PackageCatalogRefreshFailed) + Description = Resources.PackageCatalogRefreshFailed }; public static readonly LastRefreshedMessageProvider RefreshInProgress = new LastRefreshedMessageProvider { Days = 0, - Description = SR.GetString(SR.PackageCatalogRefreshing) + Description = Resources.PackageCatalogRefreshing }; public static readonly LastRefreshedMessageProvider NpmNotFound = new LastRefreshedMessageProvider { @@ -39,25 +40,25 @@ private LastRefreshedMessageProvider() { } public LastRefreshedMessageProvider(DateTime lastRefreshTime) { if (lastRefreshTime == DateTime.MinValue) { Days = int.MaxValue; - Description = SR.GetString(SR.PackageCatalogRefreshFailed); + Description = Resources.PackageCatalogRefreshFailed; } else { Days = (int)(DateTime.Now.Date - lastRefreshTime.Date).TotalDays; if (Days == 0) { - Description = SR.GetString(SR.PackageCatalogRefresh0Days, lastRefreshTime); + Description = string.Format(CultureInfo.CurrentCulture, Resources.PackageCatalogRefresh0Days, lastRefreshTime); } else if (Days == 1) { - Description = SR.GetString(SR.PackageCatalogRefresh1Day, lastRefreshTime); + Description = string.Format(CultureInfo.CurrentCulture, Resources.PackageCatalogRefresh1Day, lastRefreshTime); } else if (Days <= 7) { - Description = SR.GetString(SR.PackageCatalogRefresh2To7Days, Days); + Description = string.Format(CultureInfo.CurrentCulture, Resources.PackageCatalogRefresh2To7Days, Days); } else if (Days <= 14) { - Description = SR.GetString(SR.PackageCatalogRefresh1Week); + Description = Resources.PackageCatalogRefresh1Week; } else if (Days <= 21) { - Description = SR.GetString(SR.PackageCatalogRefresh2Weeks); + Description = Resources.PackageCatalogRefresh2Weeks; } else if (Days <= 31) { - Description = SR.GetString(SR.PackageCatalogRefresh3Weeks); + Description = Resources.PackageCatalogRefresh3Weeks; } else if (Days <= 92) { - Description = SR.GetString(SR.PackageCatalogRefresh1Month); + Description = Resources.PackageCatalogRefresh1Month; } else { - Description = SR.GetString(SR.PackageCatalogRefresh3Months); + Description = Resources.PackageCatalogRefresh3Months; } } } diff --git a/Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs b/Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs index 6151ee6f5..d2b88cf20 100644 --- a/Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs +++ b/Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs @@ -50,7 +50,7 @@ public NpmOutputViewModel(INpmController controller) { style.Setters.Add(new Setter(Block.MarginProperty, new Thickness(0))); _output.Resources.Add(typeof(Paragraph), style); - _statusText = SR.GetString(SR.NpmStatusReady); + _statusText = Resources.NpmStatusReady; _worker = new Thread(Run); _worker.Name = "npm UI Execution"; @@ -307,21 +307,21 @@ private void UpdateStatusMessage() { if (executingCommand && null != command) { var commandText = command.ToString(); if (count > 0) { - status = SR.GetString( - WithErrors ? SR.NpmStatusExecutingQueuedErrors : SR.NpmStatusExecutingQueued, + status = string.Format(CultureInfo.CurrentCulture, + WithErrors ? Resources.NpmStatusExecutingQueuedErrors : Resources.NpmStatusExecutingQueued, commandText, count, - errorsInfo - ); + errorsInfo); } else { - status = SR.GetString( - WithErrors ? SR.NpmStatusExecutingErrors : SR.NpmStatusExecuting, + status = string.Format(CultureInfo.CurrentCulture, + WithErrors ? Resources.NpmStatusExecutingErrors : Resources.NpmStatusExecuting, commandText, - errorsInfo - ); + errorsInfo); } } else { - status = SR.GetString(WithErrors ? SR.NpmStatusReadyWithErrors : SR.NpmStatusReady, errorsInfo); + status = string.Format(CultureInfo.CurrentCulture, + WithErrors ? Resources.NpmStatusReadyWithErrors : Resources.NpmStatusReady, + errorsInfo); } StatusText = status; diff --git a/Nodejs/Product/Nodejs/NpmUI/NpmPackageInstallViewModel.cs b/Nodejs/Product/Nodejs/NpmUI/NpmPackageInstallViewModel.cs index 973a9293a..8ce6a6c12 100644 --- a/Nodejs/Product/Nodejs/NpmUI/NpmPackageInstallViewModel.cs +++ b/Nodejs/Product/Nodejs/NpmUI/NpmPackageInstallViewModel.cs @@ -164,7 +164,7 @@ private async void LoadCatalog(bool forceRefresh) { CatalogControlVisibility = Visibility.Collapsed; LoadingCatalogControlVisibility = Visibility.Visible; - LoadingCatalogMessage = SR.GetString(SR.CatalogLoadingDefault); + LoadingCatalogMessage = Resources.CatalogLoadingDefault; LastRefreshedMessage = LastRefreshedMessageProvider.RefreshInProgress; diff --git a/Nodejs/Product/Nodejs/NpmUI/PackageCatalogEntryViewModel.cs b/Nodejs/Product/Nodejs/NpmUI/PackageCatalogEntryViewModel.cs index 01455a925..caee3128b 100644 --- a/Nodejs/Product/Nodejs/NpmUI/PackageCatalogEntryViewModel.cs +++ b/Nodejs/Product/Nodejs/NpmUI/PackageCatalogEntryViewModel.cs @@ -115,7 +115,7 @@ public ReadOnlyPackageCatalogEntryViewModel(IPackage package, IPackage localInst package.Homepages, (package.Keywords != null && package.Keywords.Any()) ? string.Join(", ", package.Keywords) - : SR.GetString(SR.NoKeywordsInPackage), + : Resources.NoKeywordsInPackage, localInstall != null ? (SemverVersion?)localInstall.Version : null ) { if (string.IsNullOrEmpty(Name)) { diff --git a/Nodejs/Product/Nodejs/Options/NodejsNpmOptionsControl.cs b/Nodejs/Product/Nodejs/Options/NodejsNpmOptionsControl.cs index 6460f500c..4b3c3bed3 100644 --- a/Nodejs/Product/Nodejs/Options/NodejsNpmOptionsControl.cs +++ b/Nodejs/Product/Nodejs/Options/NodejsNpmOptionsControl.cs @@ -43,8 +43,8 @@ private void ClearCacheButton_Click(object sender, EventArgs e) { if (!didClearNpmCache || !didClearTools) { MessageBox.Show( - SR.GetString(SR.CacheDirectoryClearFailedCaption, NodejsConstants.NtvsLocalAppData), - SR.GetString(SR.CacheDirectoryClearFailedTitle), + string.Format(CultureInfo.CurrentCulture, Resources.CacheDirectoryClearFailedCaption, NodejsConstants.NtvsLocalAppData), + Resources.CacheDirectoryClearFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } diff --git a/Nodejs/Product/Nodejs/Options/TypingsInfoBar.cs b/Nodejs/Product/Nodejs/Options/TypingsInfoBar.cs index ee64877cb..f754a0506 100644 --- a/Nodejs/Product/Nodejs/Options/TypingsInfoBar.cs +++ b/Nodejs/Product/Nodejs/Options/TypingsInfoBar.cs @@ -32,12 +32,12 @@ public class TypingsInfoBar : IVsInfoBarUIEvents { private readonly static InfoBarModel _infoBarModel = new InfoBarModel( new[] { - new InfoBarTextSpan(SR.GetString(SR.TypingsInfoBarSpan1)), - _typingsFolderHyperlink = new InfoBarHyperlink(SR.GetString(SR.TypingsInfoBarSpan2)), - new InfoBarTextSpan(SR.GetString(SR.TypingsInfoBarSpan3)) + new InfoBarTextSpan(Resources.TypingsInfoBarSpan1), + _typingsFolderHyperlink = new InfoBarHyperlink(Resources.TypingsInfoBarSpan2), + new InfoBarTextSpan(Resources.TypingsInfoBarSpan3) }, new[] { - _customizeInfoBarButton = new InfoBarButton(SR.GetString(SR.TypingsOpenOptionsText)) + _customizeInfoBarButton = new InfoBarButton(Resources.TypingsOpenOptionsText) }, KnownMonikers.NewFolder, true); diff --git a/Nodejs/Product/Nodejs/Project/DependencyNode.cs b/Nodejs/Product/Nodejs/Project/DependencyNode.cs index e1263d138..dcdcc554c 100644 --- a/Nodejs/Product/Nodejs/Project/DependencyNode.cs +++ b/Nodejs/Product/Nodejs/Project/DependencyNode.cs @@ -230,7 +230,7 @@ internal override int ExecCommandOnNode(Guid cmdGroup, uint cmd, uint nCmdexecop } catch (Exception ex) { if (ex is InvalidOperationException || ex is Win32Exception) { MessageBox.Show( - SR.GetString(SR.DependencyNodeModuleDoesNotExist, path), + string.Format(CultureInfo.CurrentCulture, Resources.DependencyNodeModuleDoesNotExist, path), SR.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -250,14 +250,14 @@ internal override int ExecCommandOnNode(Guid cmdGroup, uint cmd, uint nCmdexecop private static string GetInitialPackageDisplayString(IPackage package) { var buff = new StringBuilder(package.Name); if (package.IsMissing) { - buff.Append(string.Format(CultureInfo.CurrentCulture, " ({0})", SR.GetString(SR.DependencyNodeLabelMissing))); + buff.Append(string.Format(CultureInfo.CurrentCulture, " ({0})", Resources.DependencyNodeLabelMissing)); } else { buff.Append('@'); buff.Append(package.Version); if (!package.IsListedInParentPackageJson) { buff.AppendFormat(string.Format(CultureInfo.CurrentCulture, " ({0})", - SR.GetString(SR.DependencyNodeLabelNotListed, NodejsConstants.PackageJsonFile))); + string.Format(CultureInfo.CurrentCulture, Resources.DependencyNodeLabelNotListed, NodejsConstants.PackageJsonFile))); } else { var dependencyTypes = GetDependencyTypeNames(package); if (package.IsDevDependency || package.IsOptionalDependency) { @@ -270,7 +270,7 @@ private static string GetInitialPackageDisplayString(IPackage package) { if (package.IsBundledDependency) { buff.Append(string.Format(CultureInfo.CurrentCulture, "[{0}]", - SR.GetString(SR.DependencyNodeLabelBundled))); + Resources.DependencyNodeLabelBundled)); } return buff.ToString(); } diff --git a/Nodejs/Product/Nodejs/Project/DependencyNodeProperties.cs b/Nodejs/Product/Nodejs/Project/DependencyNodeProperties.cs index 6d4722cb6..0f6373d7d 100644 --- a/Nodejs/Product/Nodejs/Project/DependencyNodeProperties.cs +++ b/Nodejs/Product/Nodejs/Project/DependencyNodeProperties.cs @@ -32,9 +32,9 @@ internal DependencyNodeProperties(DependencyNode node) : base(node) {} private IPackage Package { get { return DependencyNode.Package; } } public override string GetClassName() { - return SR.GetString(IsSubPackage - ? SR.PropertiesClassLocalSubPackage - : SR.PropertiesClassLocalPackage); + return IsSubPackage + ? Resources.PropertiesClassLocalSubPackage + : Resources.PropertiesClassLocalPackage; } [SRCategoryAttribute(SR.General)] @@ -61,7 +61,7 @@ public string PackageVersion { public string RequestedVersionRange { get { var range = null == Package ? null : Package.RequestedVersionRange; - return range ?? SR.GetString(SR.RequestedVersionRangeNone); + return range ?? Resources.RequestedVersionRangeNone; } } @@ -156,8 +156,8 @@ internal bool IsSubPackage { public string PackageType { get { return IsSubPackage - ? SR.GetString(SR.PackageTypeLocalSubpackage) - : SR.GetString(SR.PackageTypeLocal); + ? Resources.PackageTypeLocalSubpackage + : Resources.PackageTypeLocal; } } @@ -168,9 +168,9 @@ public string PackageType { public string LinkStatus { get { if (IsSubPackage) { - return SR.GetString(SR.LinkStatusNotApplicableSubPackages); + return Resources.LinkStatusNotApplicableSubPackages; } - return SR.GetString(SR.LinkStatusUnknown); + return Resources.LinkStatusUnknown; } } diff --git a/Nodejs/Product/Nodejs/Project/NodeModulesNode.cs b/Nodejs/Product/Nodejs/Project/NodeModulesNode.cs index b9da33dfe..6b5e578f0 100644 --- a/Nodejs/Product/Nodejs/Project/NodeModulesNode.cs +++ b/Nodejs/Product/Nodejs/Project/NodeModulesNode.cs @@ -291,13 +291,13 @@ private void NpmController_CommandCompleted(object sender, NpmCommandCompletedEv private static string GetStatusBarMessage(NpmCommandCompletedEventArgs e) { if (e.WithErrors) { - return SR.GetString( - e.Cancelled ? SR.NpmCancelledWithErrors : SR.NpmCompletedWithErrors, + return string.Format(CultureInfo.CurrentCulture, + e.Cancelled ? Resources.NpmCancelledWithErrors : Resources.NpmCompletedWithErrors, e.CommandText); } else if (e.Cancelled) { - return SR.GetString(SR.NpmCancelled, e.CommandText); + return string.Format(CultureInfo.CurrentCulture, Resources.NpmCancelled, e.CommandText); } - return SR.GetString(SR.NpmSuccessfullyCompleted, e.CommandText); + return string.Format(CultureInfo.CurrentCulture, Resources.NpmSuccessfullyCompleted, e.CommandText); } private void StopNpmIdleTimer() { @@ -450,7 +450,7 @@ public void ManageModules(DependencyType dependencyType = DependencyType.Standar if (NpmController.RootPackage == null) { NpmController.Refresh(); if (NpmController.RootPackage == null) { - MessageBox.Show(SR.GetString(SR.NodeModulesCouldNotParsePackageJsonErrorMessageText, NodejsConstants.PackageJsonFile)); + MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.NodeModulesCouldNotParsePackageJsonErrorMessageText, NodejsConstants.PackageJsonFile)); return; } } diff --git a/Nodejs/Product/Nodejs/Project/NodejsFolderNode.cs b/Nodejs/Product/Nodejs/Project/NodejsFolderNode.cs index 780c204c2..1fa2e3de2 100644 --- a/Nodejs/Product/Nodejs/Project/NodejsFolderNode.cs +++ b/Nodejs/Product/Nodejs/Project/NodejsFolderNode.cs @@ -51,20 +51,20 @@ internal override int IncludeInProject(bool includeChildren) { private bool ShouldIncludeNodeModulesFolderInProject() { - var includeNodeModulesButton = new TaskDialogButton(SR.GetString(SR.IncludeNodeModulesIncludeTitle), SR.GetString(SR.IncludeNodeModulesIncludeDescription)); - var cancelOperationButton = new TaskDialogButton(SR.GetString(SR.IncludeNodeModulesCancelTitle)); + var includeNodeModulesButton = new TaskDialogButton(Resources.IncludeNodeModulesIncludeTitle, Resources.IncludeNodeModulesIncludeDescription); + var cancelOperationButton = new TaskDialogButton(Resources.IncludeNodeModulesCancelTitle); var taskDialog = new TaskDialog(_project.ProjectMgr.Site) { AllowCancellation = true, EnableHyperlinks = true, Title = SR.ProductName, MainIcon = TaskDialogIcon.Warning, - Content = SR.GetString(SR.IncludeNodeModulesContent), + Content = Resources.IncludeNodeModulesContent, Buttons = { cancelOperationButton, includeNodeModulesButton }, FooterIcon = TaskDialogIcon.Information, - Footer = SR.GetString(SR.IncludeNodeModulesInformation), + Footer = Resources.IncludeNodeModulesInformation, SelectedButton = cancelOperationButton }; diff --git a/Nodejs/Product/Nodejs/Project/NodejsGeneralPropertyPageControl.cs b/Nodejs/Product/Nodejs/Project/NodejsGeneralPropertyPageControl.cs index 0b5006a2e..d303fd89a 100644 --- a/Nodejs/Product/Nodejs/Project/NodejsGeneralPropertyPageControl.cs +++ b/Nodejs/Product/Nodejs/Project/NodejsGeneralPropertyPageControl.cs @@ -42,16 +42,16 @@ public NodejsGeneralPropertyPageControl(NodejsGeneralPropertyPage page) : this() } private void AddToolTips() { - _tooltip.SetToolTip(_nodeExePath, SR.GetString(SR.NodeExePathToolTip)); - _tooltip.SetToolTip(_nodeExeArguments, SR.GetString(SR.NodeExeArgumentsToolTip)); - _tooltip.SetToolTip(_scriptFile, SR.GetString(SR.ScriptFileToolTip)); - _tooltip.SetToolTip(_scriptArguments, SR.GetString(SR.ScriptArgumentsToolTip)); - _tooltip.SetToolTip(_nodejsPort, SR.GetString(SR.NodejsPortToolTip)); - _tooltip.SetToolTip(_startBrowser, SR.GetString(SR.StartBrowserToolTip)); - _tooltip.SetToolTip(_workingDir, SR.GetString(SR.WorkingDirToolTip)); - _tooltip.SetToolTip(_launchUrl, SR.GetString(SR.LaunchUrlToolTip)); - _tooltip.SetToolTip(_debuggerPort, SR.GetString(SR.DebuggerPort)); - _tooltip.SetToolTip(_envVars, SR.GetString(SR.EnvironmentVariables)); + _tooltip.SetToolTip(_nodeExePath, Resources.NodeExePathToolTip); + _tooltip.SetToolTip(_nodeExeArguments, Resources.NodeExeArgumentsToolTip); + _tooltip.SetToolTip(_scriptFile, Resources.ScriptFileTooltip); + _tooltip.SetToolTip(_scriptArguments, Resources.ScriptArgumentsToolTip); + _tooltip.SetToolTip(_nodejsPort, Resources.NodejsPortToolTip); + _tooltip.SetToolTip(_startBrowser, Resources.StartBrowserToolTip); + _tooltip.SetToolTip(_workingDir, Resources.WorkingDirToolTip); + _tooltip.SetToolTip(_launchUrl, Resources.LaunchUrlToolTip); + _tooltip.SetToolTip(_debuggerPort, Resources.DebuggerPort); + _tooltip.SetToolTip(_envVars, Resources.EnvironmentVariables); } public string NodeExePath { @@ -156,7 +156,7 @@ private void Changed(object sender, EventArgs e) { private void SetCueBanner() { string cueBanner = Nodejs.NodeExePath; if (String.IsNullOrEmpty(cueBanner)) { - cueBanner = SR.GetString(SR.NodejsNotInstalledShort); + cueBanner = Resources.NodejsNotInstalledShort; } NativeMethods.SendMessageW( @@ -172,7 +172,7 @@ private void NodeExePathChanged(object sender, EventArgs e) { File.Exists(Nodejs.GetAbsoluteNodeExePath(_propPage.Project.ProjectHome, _nodeExePath.Text))) { _nodeExeErrorProvider.SetError(_nodeExePath, String.Empty); } else { - _nodeExeErrorProvider.SetError(_nodeExePath, SR.GetString(SR.NodeExePathNotFound)); + _nodeExeErrorProvider.SetError(_nodeExePath, Resources.NodeExePathNotFound); } Changed(sender, e); } @@ -202,7 +202,7 @@ private void PortChanged(object sender, EventArgs e) { var textSender = (TextBox)sender; if (!textSender.Text.Contains("$(") && textSender.Text.Any(ch => !Char.IsDigit(ch))) { - _nodeExeErrorProvider.SetError(textSender, SR.GetString(SR.InvalidPortNumber)); + _nodeExeErrorProvider.SetError(textSender, Resources.InvalidPortNumber); } else { _nodeExeErrorProvider.SetError(textSender, String.Empty); } @@ -211,7 +211,7 @@ private void PortChanged(object sender, EventArgs e) { private void WorkingDirTextChanged(object sender, EventArgs e) { if (!_workingDir.Text.Contains("$(") && !Directory.Exists(_workingDir.Text)) { - _nodeExeErrorProvider.SetError(_workingDir, SR.GetString(SR.WorkingDirInvalidOrMissing)); + _nodeExeErrorProvider.SetError(_workingDir, Resources.WorkingDirInvalidOrMissing); } else { _nodeExeErrorProvider.SetError(_workingDir, String.Empty); } diff --git a/Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs b/Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs index 561323935..91a64802c 100644 --- a/Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs +++ b/Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs @@ -145,7 +145,7 @@ private string GetFullUrl() { return GetFullUrl(host, TestServerPort); } catch (UriFormatException) { var output = OutputWindowRedirector.GetGeneral(NodejsPackage.Instance); - output.WriteErrorLine(SR.GetString(SR.ErrorInvalidLaunchUrl, host)); + output.WriteErrorLine(string.Format(CultureInfo.CurrentCulture, Resources.ErrorInvalidLaunchUrl, host)); output.ShowAndActivate(); return string.Empty; } @@ -192,9 +192,9 @@ private void StartWithDebugger(string startupFile) { private void LaunchDebugger(IServiceProvider provider, VsDebugTargetInfo dbgInfo) { if (!Directory.Exists(dbgInfo.bstrCurDir)) { - MessageBox.Show(SR.GetString(SR.DebugWorkingDirectoryDoesNotExistErrorMessage, dbgInfo.bstrCurDir), SR.ProductName); + MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.DebugWorkingDirectoryDoesNotExistErrorMessage, dbgInfo.bstrCurDir), SR.ProductName); } else if (!File.Exists(dbgInfo.bstrExe)) { - MessageBox.Show(SR.GetString(SR.DebugInterpreterDoesNotExistErrorMessage, dbgInfo.bstrExe), SR.ProductName); + MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.DebugInterpreterDoesNotExistErrorMessage, dbgInfo.bstrExe), SR.ProductName); } else if (DoesProjectSupportDebugging()) { VsShellUtilities.LaunchDebugger(provider, dbgInfo); } @@ -204,7 +204,7 @@ private bool DoesProjectSupportDebugging() { var typeScriptOutFile = _project.GetProjectProperty("TypeScriptOutFile"); if (!string.IsNullOrEmpty(typeScriptOutFile)) { return MessageBox.Show( - SR.GetString(SR.DebugTypeScriptCombineNotSupportedWarningMessage), + Resources.DebugTypeScriptCombineNotSupportedWarningMessage, SR.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning @@ -327,7 +327,7 @@ select connection.LocalEndPoint.Port private string ResolveStartupFile() { string startupFile = _project.GetStartupFile(); if (string.IsNullOrEmpty(startupFile)) { - throw new ApplicationException(SR.GetString(SR.DebugCouldNotResolveStartupFileErrorMessage)); + throw new ApplicationException(Resources.DebugCouldNotResolveStartupFileErrorMessage); } if (TypeScriptHelpers.IsTypeScriptFile(startupFile)) { diff --git a/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs b/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs index e76bef285..b2f7ecc0e 100644 --- a/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs +++ b/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs @@ -143,7 +143,7 @@ private void TryToAcquireTypings(IEnumerable packages) { private static bool TrySetTypingsLoadingStatusBar(IVsStatusbar statusBar, object icon) { if (statusBar != null && !IsStatusBarFrozen(statusBar)) { - statusBar.SetText(SR.GetString(SR.StatusTypingsLoading)); + statusBar.SetText(Resources.StatusTypingsLoading); statusBar.Animation(1, ref icon); if (ErrorHandler.Succeeded(statusBar.FreezeOutput(1))) { return true; @@ -161,7 +161,7 @@ private static void TrySetTypingsLoadedStatusBar(IVsStatusbar statusBar, object } statusBar.Animation(0, ref icon); - statusBar.SetText(SR.GetString(SR.StatusTypingsLoaded)); + statusBar.SetText(Resources.StatusTypingsLoaded); } } @@ -729,18 +729,18 @@ public async Task CheckForLongPaths(string npmArguments = null) { var taskDialog = new TaskDialog(NodejsPackage.Instance) { AllowCancellation = true, EnableHyperlinks = true, - Title = SR.GetString(SR.LongPathWarningTitle), + Title = Resources.LongPathWarningTitle, MainIcon = TaskDialogIcon.Warning, - Content = SR.GetString(SR.LongPathWarningText), - CollapsedControlText = SR.GetString(SR.LongPathShowPathsExceedingTheLimit), - ExpandedControlText = SR.GetString(SR.LongPathHidePathsExceedingTheLimit), + Content = Resources.LongPathWarningText, + CollapsedControlText = Resources.LongPathShowPathsExceedingTheLimit, + ExpandedControlText = Resources.LongPathHidePathsExceedingTheLimit, Buttons = { - (dedupeButton = new TaskDialogButton(SR.GetString(SR.LongPathNpmDedupe), SR.GetString(SR.LongPathNpmDedupeDetail))), - (ignoreButton = new TaskDialogButton(SR.GetString(SR.LongPathDoNothingButWarnNextTime))), - (disableButton = new TaskDialogButton(SR.GetString(SR.LongPathDoNothingAndDoNotWarnAgain), SR.GetString(SR.LongPathDoNothingAndDoNotWarnAgainDetail))) + (dedupeButton = new TaskDialogButton(Resources.LongPathNpmDedupe, Resources.LongPathNpmDedupeDetail)), + (ignoreButton = new TaskDialogButton(Resources.LongPathDoNothingButWarnNextTime)), + (disableButton = new TaskDialogButton(Resources.LongPathDoNothingAndDoNotWarnAgain, Resources.LongPathDoNothingAndDoNotWarnAgainDetail)) }, FooterIcon = TaskDialogIcon.Information, - Footer = SR.GetString(SR.LongPathFooter) + Footer = Resources.LongPathFooter }; taskDialog.HyperlinkClicked += (sender, e) => { @@ -765,7 +765,7 @@ public async Task CheckForLongPaths(string npmArguments = null) { var longPaths = await Task.Factory.StartNew(() => GetLongSubPaths(ProjectHome) .Concat(GetLongSubPaths(_intermediateOutputPath)) - .Select(lpi => string.Format(CultureInfo.InvariantCulture, "• {1}\u00A0{2}", lpi.FullPath, lpi.RelativePath, SR.GetString(SR.LongPathClickToCopy))) + .Select(lpi => string.Format(CultureInfo.InvariantCulture, "• {1}\u00A0{2}", lpi.FullPath, lpi.RelativePath, Resources.LongPathClickToCopy)) .ToArray()); if (longPaths.Length == 0) { return; @@ -777,7 +777,7 @@ public async Task CheckForLongPaths(string npmArguments = null) { var repl = NodejsPackage.Instance.OpenReplWindow(focus: false); await repl.ExecuteCommand(".npm dedupe").HandleAllExceptions(SR.ProductName); - taskDialog.Content += "\r\n\r\n" + SR.GetString(SR.LongPathNpmDedupeDidNotHelp); + taskDialog.Content += "\r\n\r\n" + Resources.LongPathNpmDedupeDidNotHelp; taskDialog.Buttons.Remove(dedupeButton); goto recheck; } else if (button == disableButton) { @@ -1040,7 +1040,7 @@ public override MSBuildResult Build(string config, string target) { internal OutputWindowRedirector NpmOutputPane { get { try { - return OutputWindowRedirector.Get(Site, VSPackageManagerPaneGuid, SR.GetString(SR.NpmOutputPaneTitle)); + return OutputWindowRedirector.Get(Site, VSPackageManagerPaneGuid, Resources.NpmOutputPaneTitle); } catch (InvalidOperationException) { return null; } diff --git a/Nodejs/Product/Nodejs/Project/NpmNodeProperties.cs b/Nodejs/Product/Nodejs/Project/NpmNodeProperties.cs index 86f6c924c..53a6fd55e 100644 --- a/Nodejs/Product/Nodejs/Project/NpmNodeProperties.cs +++ b/Nodejs/Product/Nodejs/Project/NpmNodeProperties.cs @@ -30,7 +30,7 @@ private AbstractNpmNode NpmNode { } public override string GetClassName() { - return SR.GetString(SR.PropertiesClassNpm); + return Resources.PropertiesClassNpm; } [SRCategoryAttribute(SR.General)] @@ -38,7 +38,7 @@ public override string GetClassName() { [SRDescriptionAttribute(SR.NpmNodePackageInstallationDescription)] public string PackageInstallation { get { - return SR.GetString(SR.PackageInstallationLocal); + return Resources.PackageInstallationLocal; } } diff --git a/Nodejs/Product/Nodejs/Project/ProjectResources.cs b/Nodejs/Product/Nodejs/Project/ProjectResources.cs index 7c33a853d..d3eccb1a5 100644 --- a/Nodejs/Product/Nodejs/Project/ProjectResources.cs +++ b/Nodejs/Product/Nodejs/Project/ProjectResources.cs @@ -44,10 +44,6 @@ internal class SR : CommonSR { internal const string DebuggerConnectionClosed = "DebuggerConnectionClosed"; internal const string DebuggerModuleUpdateFailed = "DebuggerModuleUpdateFailed"; internal const string DebuggerPort = "DebuggerPort"; - internal const string DependencyNodeLabelBundled = "DependencyNodeLabelBundled"; - internal const string DependencyNodeLabelMissing = "DependencyNodeLabelMissing"; - internal const string DependencyNodeLabelNotListed = "DependencyNodeLabelNotListed"; - internal const string DependencyNodeModuleDoesNotExist = "DependencyNodeModuleDoesNotExist"; internal const string DontShowAgain = "DontShowAgain"; internal const string DownloadAndInstall = "DownloadAndInstall"; internal const string EnvironmentVariables = "EnvironmentVariables"; @@ -66,22 +62,6 @@ internal class SR : CommonSR { internal const string InteractiveWindowNoProcessErrorMessage = "InteractiveWindowNoProcessErrorMessage"; internal const string InteractiveWindowProcessExitedMessage = "InteractiveWindowProcessExitedMessage"; internal const string InteractiveWindowTitle = "InteractiveWindowTitle"; - internal const string InvalidPortNumber = "InvalidPortNumber"; - internal const string LaunchUrlToolTip = "LaunchUrlToolTip"; - internal const string LinkStatusNotApplicableSubPackages = "LinkStatusNotApplicableSubPackages"; - internal const string LinkStatusUnknown = "LinkStatusUnknown"; - internal const string LongPathClickToCopy = "LongPathClickToCopy"; - internal const string LongPathDoNothingAndDoNotWarnAgain = "LongPathDoNothingAndDoNotWarnAgain"; - internal const string LongPathDoNothingAndDoNotWarnAgainDetail = "LongPathDoNothingAndDoNotWarnAgainDetail"; - internal const string LongPathDoNothingButWarnNextTime = "LongPathDoNothingButWarnNextTime"; - internal const string LongPathFooter = "LongPathFooter"; - internal const string LongPathHidePathsExceedingTheLimit = "LongPathHidePathsExceedingTheLimit"; - internal const string LongPathNpmDedupe = "LongPathNpmDedupe"; - internal const string LongPathNpmDedupeDetail = "LongPathNpmDedupeDetail"; - internal const string LongPathNpmDedupeDidNotHelp = "LongPathNpmDedupeDidNotHelp"; - internal const string LongPathShowPathsExceedingTheLimit = "LongPathShowPathsExceedingTheLimit"; - internal const string LongPathWarningText = "LongPathWarningText"; - internal const string LongPathWarningTitle = "LongPathWarningTitle"; internal const string NoKeywordsInPackage = "NoKeywordsInPackage"; internal const string NodeExeArguments = "NodeExeArguments"; internal const string NodeExeArgumentsDescription = "NodeExeArgumentsDescription"; @@ -90,24 +70,13 @@ internal class SR : CommonSR { internal const string NodeExePath = "NodeExePath"; internal const string NodeExePathDescription = "NodeExePathDescription"; internal const string NodeExePathNotFound = "NodeExePathNotFound"; - internal const string NodeExePathToolTip = "NodeExePathToolTip"; - internal const string NodeModulesCouldNotParsePackageJsonErrorMessageText = "NodeModulesCouldNotParsePackageJsonErrorMessageText"; internal const string NodejsNotInstalled = "NodejsNotInstalled"; - internal const string NodejsNotInstalledShort = "NodejsNotInstalledShort"; - internal const string NodejsNotSupported = "NodejsNotSupported"; internal const string NodejsPort = "NodejsPort"; internal const string NodejsPortDescription = "NodejsPortDescription"; - internal const string NodejsPortToolTip = "NodejsPortToolTip"; - internal const string NpmCancelled = "NpmCancelled"; - internal const string NpmCancelledWithErrors = "NpmCancelledWithErrors"; - internal const string NpmCompletedWithErrors = "NpmCompletedWithErrors"; internal const string NpmNodePackageInstallation = "NpmNodePackageInstallation"; internal const string NpmNodePackageInstallationDescription = "NpmNodePackageInstallationDescription"; internal const string NpmNodePath = "NpmNodePath"; internal const string NpmNodePathDescription = "NpmNodePathDescription"; - internal const string NpmNotInstalledMessageCaption = "NpmNotInstalledMessageCaption"; - internal const string NpmNotInstalledMessageText = "NpmNotInstalledMessageText"; - internal const string NpmOutputPaneTitle = "NpmOutputPaneTitle"; internal const string NpmPackageAuthor = "NpmPackageAuthor"; internal const string NpmPackageAuthorDescription = "NpmPackageAuthorDescription"; internal const string NpmPackageDescription = "NpmPackageDescription"; @@ -129,8 +98,6 @@ internal class SR : CommonSR { internal const string NpmPackageLinkStatusDescription = "NpmPackageLinkStatusDescription"; internal const string NpmPackageName = "NpmPackageName"; internal const string NpmPackageNameDescription = "NpmPackageNameDescription"; - internal const string NpmPackageNewVersionAvailable = "NpmPackageNewVersionAvailable"; - internal const string NpmPackageNewVersionAvailableDescription = "NpmPackageNewVersionAvailableDescription"; internal const string NpmPackagePath = "NpmPackagePath"; internal const string NpmPackagePathDescription = "NpmPackagePathDescription"; internal const string NpmPackageRequestedVersionRange = "NpmPackageRequestedVersionRange"; @@ -139,59 +106,8 @@ internal class SR : CommonSR { internal const string NpmPackageTypeDescription = "NpmPackageTypeDescription"; internal const string NpmPackageVersion = "NpmPackageVersion"; internal const string NpmPackageVersionDescription = "NpmPackageVersionDescription"; - internal const string NpmReplCommandCompletedWithErrors = "NpmReplCommandCompletedWithErrors"; - internal const string NpmStatusExecuting = "NpmStatusExecuting"; - internal const string NpmStatusExecutingErrors = "NpmStatusExecutingErrors"; - internal const string NpmStatusExecutingQueued = "NpmStatusExecutingQueued"; - internal const string NpmStatusExecutingQueuedErrors = "NpmStatusExecutingQueuedErrors"; - internal const string NpmStatusReady = "NpmStatusReady"; - internal const string NpmStatusReadyWithErrors = "NpmStatusReadyWithErrors"; - internal const string NpmSuccessfullyCompleted = "NpmSuccessfullyCompleted"; - internal const string PackageCatalogRefresh0Days = "PackageCatalogRefresh0Days"; - internal const string PackageCatalogRefresh1Day = "PackageCatalogRefresh1Day"; - internal const string PackageCatalogRefresh1Month = "PackageCatalogRefresh1Month"; - internal const string PackageCatalogRefresh1Week = "PackageCatalogRefresh1Week"; - internal const string PackageCatalogRefresh2To7Days = "PackageCatalogRefresh2To7Days"; - internal const string PackageCatalogRefresh2Weeks = "PackageCatalogRefresh2Weeks"; - internal const string PackageCatalogRefresh3Months = "PackageCatalogRefresh3Months"; - internal const string PackageCatalogRefresh3Weeks = "PackageCatalogRefresh3Weeks"; - internal const string PackageCatalogRefreshFailed = "PackageCatalogRefreshFailed"; - internal const string PackageCatalogRefreshing = "PackageCatalogRefreshing"; - internal const string PackageInstallationLocal = "PackageInstallationLocal"; - internal const string PackageTypeLocal = "PackageTypeLocal"; - internal const string PackageTypeLocalSubpackage = "PackageTypeLocalSubpackage"; - internal const string PropertiesClassLocalPackage = "PropertiesClassLocalPackage"; - internal const string PropertiesClassLocalSubPackage = "PropertiesClassLocalSubPackage"; - internal const string PropertiesClassNpm = "PropertiesClassNpm"; - internal const string RemoteDebugCheckProxyAndPortErrorMessage = "RemoteDebugCheckProxyAndPortErrorMessage"; - internal const string RemoteDebugCouldNotAttachErrorMessage = "RemoteDebugCouldNotAttachErrorMessage"; - internal const string RemoteDebugEnableWebSocketsErrorMessage = "RemoteDebugEnableWebSocketsErrorMessage"; - internal const string RemoteDebugProxyFileDoesNotExist = "RemoteDebugProxyFileDoesNotExist"; - internal const string RemoteDebugProxyFolderDoesNotExist = "RemoteDebugProxyFolderDoesNotExist"; - internal const string RemoteDebugUnsupportedPlatformErrorMessage = "RemoteDebugUnsupportedPlatformErrorMessage"; - internal const string ReplInitializationMessage = "ReplInitializationMessage"; - internal const string ReplWindowNpmInitNoYesFlagWarning = "ReplWindowNpmInitNoYesFlagWarning"; - internal const string RequestedVersionRangeNone = "RequestedVersionRangeNone"; - internal const string ScriptArgumentsToolTip = "ScriptArgumentsToolTip"; - internal const string ScriptFileToolTip = "ScriptFileTooltip"; - internal const string StartBrowserToolTip = "StartBrowserToolTip"; - internal const string StatusTypingsLoaded = "StatusTypingsLoaded"; - internal const string StatusTypingsLoading = "StatusTypingsLoading"; internal const string TestFramework = "TestFramework"; internal const string TestFrameworkDescription = "TestFrameworkDescription"; - internal const string TypeScriptMinVersionNotInstalled = "TypeScriptMinVersionNotInstalled"; - internal const string TypingsInfoBarSpan1 = "TypingsInfoBarSpan1"; - internal const string TypingsInfoBarSpan2 = "TypingsInfoBarSpan2"; - internal const string TypingsInfoBarSpan3 = "TypingsInfoBarSpan3"; - internal const string TypingsOpenOptionsText = "TypingsOpenOptionsText"; - internal const string TypingsToolCouldNotStart = "TypingsToolCouldNotStart"; - internal const string TypingsToolInstallFailed = "TypingsToolInstallFailed"; - internal const string TypingsToolNotInstalledError = "TypingsToolNotInstalledError"; - internal const string TypingsToolTypingsInstallCompleted = "TypingsToolTypingsInstallCompleted"; - internal const string TypingsToolTypingsInstallErrorOccurred = "TypingsToolTypingsInstallErrorOccurred"; - internal const string UpgradedEnvironmentVariables = "UpgradedEnvironmentVariables"; - internal const string WorkingDirInvalidOrMissing = "WorkingDirInvalidOrMissing"; - internal const string WorkingDirToolTip = "WorkingDirToolTip"; private static readonly Lazy _manager = new Lazy( () => new System.Resources.ResourceManager("Microsoft.NodejsTools.Resources", typeof(SR).Assembly), diff --git a/Nodejs/Product/Nodejs/Repl/NodejsReplEvaluator.cs b/Nodejs/Product/Nodejs/Repl/NodejsReplEvaluator.cs index efc271bf5..93890f4e9 100644 --- a/Nodejs/Product/Nodejs/Repl/NodejsReplEvaluator.cs +++ b/Nodejs/Product/Nodejs/Repl/NodejsReplEvaluator.cs @@ -58,7 +58,7 @@ public Task Initialize(IReplWindow window) { _window.SetOptionValue(ReplOptions.SupportAnsiColors, true); _window.SetOptionValue(ReplOptions.UseSmartUpDown, true); - _window.WriteLine(SR.GetString(SR.ReplInitializationMessage)); + _window.WriteLine(Resources.ReplInitializationMessage); return ExecutionResult.Succeeded; } @@ -137,11 +137,11 @@ private void Connect() { string nodeExePath = GetNodeExePath(); if (String.IsNullOrWhiteSpace(nodeExePath)) { - _window.WriteError(SR.GetString(SR.NodejsNotInstalled)); + _window.WriteError(Resources.NodejsNotInstalled); _window.WriteError(Environment.NewLine); return; } else if (!File.Exists(nodeExePath)) { - _window.WriteError(SR.GetString(SR.NodeExeDoesntExist, nodeExePath)); + _window.WriteError(string.Format(CultureInfo.CurrentCulture, Resources.NodeExeDoesntExist, nodeExePath)); _window.WriteError(Environment.NewLine); return; } @@ -175,7 +175,7 @@ private void Connect() { try { process.Start(); } catch (Exception e) { - _window.WriteError(SR.GetString(SR.InteractiveWindowFailedToStartProcessErrorMessage, Environment.NewLine, e.ToString(), Environment.NewLine)); + _window.WriteError(string.Format(CultureInfo.CurrentCulture, Resources.InteractiveWindowFailedToStartProcessErrorMessage, Environment.NewLine, e.ToString(), Environment.NewLine)); return; } @@ -217,7 +217,7 @@ class ListenerThread : JsonListener, IDisposable { #if DEBUG private Thread _socketLockedThread; #endif - private static string _noReplProcess = SR.GetString(SR.InteractiveWindowNoProcessErrorMessage) + Environment.NewLine; + private static string _noReplProcess = Resources.InteractiveWindowNoProcessErrorMessage + Environment.NewLine; public ListenerThread(NodejsReplEvaluator eval, Process process, Socket socket) { _eval = eval; @@ -252,7 +252,7 @@ private void ProcessExited(object sender, EventArgs args) { } private void ProcessExitedWorker() { - _eval._window.WriteError(SR.GetString(SR.InteractiveWindowProcessExitedMessage) + Environment.NewLine); + _eval._window.WriteError(Resources.InteractiveWindowProcessExitedMessage + Environment.NewLine); using (new SocketLock(this)) { if (_completion != null) { _completion.SetResult(ExecutionResult.Failure); diff --git a/Nodejs/Product/Nodejs/Repl/NpmReplCommand.cs b/Nodejs/Product/Nodejs/Repl/NpmReplCommand.cs index 57583fb98..0c027c893 100644 --- a/Nodejs/Product/Nodejs/Repl/NpmReplCommand.cs +++ b/Nodejs/Product/Nodejs/Repl/NpmReplCommand.cs @@ -31,7 +31,6 @@ using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudioTools.Project; -using SR = Microsoft.NodejsTools.Project.SR; using Task = System.Threading.Tasks.Task; namespace Microsoft.NodejsTools.Repl { @@ -57,7 +56,7 @@ public async Task Execute(IReplWindow window, string arguments) // Prevent running `npm init` without the `-y` flag since it will freeze the repl window, // waiting for user input that will never come. if (npmArguments.Contains(" init ") && !(npmArguments.Contains(" -y ") || npmArguments.Contains(" --yes "))) { - window.WriteError(SR.GetString(SR.ReplWindowNpmInitNoYesFlagWarning)); + window.WriteError(Resources.ReplWindowNpmInitNoYesFlagWarning); return ExecutionResult.Failure; } @@ -162,9 +161,9 @@ await ExecuteNpmCommandAsync( null); if (npmReplRedirector.HasErrors) { - window.WriteError(SR.GetString(SR.NpmReplCommandCompletedWithErrors, arguments)); + window.WriteError(string.Format(CultureInfo.CurrentCulture, Resources.NpmReplCommandCompletedWithErrors, arguments)); } else { - window.WriteLine(SR.GetString(SR.NpmSuccessfullyCompleted, arguments)); + window.WriteLine(string.Format(CultureInfo.CurrentCulture, Resources.NpmSuccessfullyCompleted, arguments)); } if (nodejsProject != null) { diff --git a/Nodejs/Product/Nodejs/Resources.Designer.cs b/Nodejs/Product/Nodejs/Resources.Designer.cs index bd6687cf8..85992da75 100644 --- a/Nodejs/Product/Nodejs/Resources.Designer.cs +++ b/Nodejs/Product/Nodejs/Resources.Designer.cs @@ -323,6 +323,15 @@ public static string EnvironmentVariables { } } + /// + /// Looks up a localized string similar to Launch url '{0}' is not valid . + /// + public static string ErrorInvalidLaunchUrl { + get { + return ResourceManager.GetString("ErrorInvalidLaunchUrl", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unable to start wizard: no automation object available.. /// diff --git a/Nodejs/Product/Nodejs/Resources.resx b/Nodejs/Product/Nodejs/Resources.resx index ace62649e..8a38089ff 100644 --- a/Nodejs/Product/Nodejs/Resources.resx +++ b/Nodejs/Product/Nodejs/Resources.resx @@ -648,4 +648,7 @@ Error retrieving websocket debug proxy information from web.config. Path to module does not exist: {0} + + Launch url '{0}' is not valid + \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/TypingsAcquisition.cs b/Nodejs/Product/Nodejs/TypingsAcquisition.cs index 61c57daf3..72ade0c38 100644 --- a/Nodejs/Product/Nodejs/TypingsAcquisition.cs +++ b/Nodejs/Product/Nodejs/TypingsAcquisition.cs @@ -26,8 +26,6 @@ using Microsoft.VisualStudioTools.Project; using Microsoft.NodejsTools.Npm; -using SR = Microsoft.NodejsTools.Project.SR; - namespace Microsoft.NodejsTools { internal class TypingsAcquisition { private const string TypingsTool = "ntvs_install_typings"; @@ -119,7 +117,7 @@ private IEnumerable GetNewTypingsToAcquire(IEnumerable packages) private async Task ExecuteTypingsTool(IEnumerable arguments, Redirector redirector) { string typingsTool = await EnsureTypingsToolInstalled(redirector); if (string.IsNullOrEmpty(typingsTool)) { - redirector?.WriteErrorLine(SR.GetString(SR.TypingsToolNotInstalledError)); + redirector?.WriteErrorLine(Resources.TypingsToolNotInstalledError); return false; } @@ -136,16 +134,16 @@ private async Task ExecuteTypingsTool(IEnumerable arguments, Redir if (!process.IsStarted) { // Process failed to start, and any exception message has // already been sent through the redirector - redirector?.WriteErrorLine(SR.GetString(SR.TypingsToolCouldNotStart)); + redirector?.WriteErrorLine(Resources.TypingsToolCouldNotStart); return false; } var i = await process; if (i == 0) { - redirector?.WriteLine(SR.GetString(SR.TypingsToolTypingsInstallCompleted)); + redirector?.WriteLine(Resources.TypingsToolTypingsInstallCompleted); return true; } else { process.Kill(); - redirector?.WriteErrorLine(SR.GetString(SR.TypingsToolTypingsInstallErrorOccurred)); + redirector?.WriteErrorLine(Resources.TypingsToolTypingsInstallErrorOccurred); return false; } } @@ -160,7 +158,7 @@ private async Task EnsureTypingsToolInstalled(Redirector redirector) { return null; } if (!await InstallTypingsTool()) { - redirector?.WriteErrorLine(SR.GetString(SR.TypingsToolInstallFailed)); + redirector?.WriteErrorLine(Resources.TypingsToolInstallFailed); return null; } return await EnsureTypingsToolInstalled(redirector);