Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Nodejs/Product/Nodejs/BaseNodeProjectFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override void DoCommand(object sender, EventArgs args) {
Action<Task<bool>> 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);
}
Expand Down Expand Up @@ -186,8 +186,8 @@ private AzureWebSiteInfo GetSelectedAzureWebSite() {

private async Task<bool> 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.
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions Nodejs/Product/Nodejs/Commands/ImportWizardCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -110,7 +109,7 @@ public static async void RunWithRequestExceptionsHandled(Func<Task> action) {
private void OnConnectionClosed(object sender, EventArgs e) {
ConcurrentDictionary<int, TaskCompletionSource<JObject>> messages = Interlocked.Exchange(ref _messages, new ConcurrentDictionary<int, TaskCompletionSource<JObject>>());
foreach (var kv in messages) {
var exception = new IOException(SR.GetString(SR.DebuggerConnectionClosed));
var exception = new IOException(Resources.DebuggerConnectionClosed);
kv.Value.SetException(exception);
}

Expand Down
5 changes: 2 additions & 3 deletions Nodejs/Product/Nodejs/Debugger/DebugEngine/AD7Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Nodejs/Product/Nodejs/NodejsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
);
Expand Down
7 changes: 4 additions & 3 deletions Nodejs/Product/Nodejs/NpmUI/ErrorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Windows;
using Microsoft.NodejsTools.Npm;
using Microsoft.NodejsTools.Project;
using System.Globalization;

namespace Microsoft.NodejsTools.NpmUI
{
Expand Down Expand Up @@ -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);
}
Expand Down
23 changes: 12 additions & 11 deletions Nodejs/Product/Nodejs/NpmUI/LastRefreshedMessageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Nodejs/Product/Nodejs/NpmUI/NpmPackageInstallViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions Nodejs/Product/Nodejs/Options/NodejsNpmOptionsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading