diff --git a/src/Spe.Sitecore8/Services/SpeJobOptions.cs b/src/Spe.Sitecore8/Services/SpeJobOptions.cs
index 5598e802c..44ce85b5d 100644
--- a/src/Spe.Sitecore8/Services/SpeJobOptions.cs
+++ b/src/Spe.Sitecore8/Services/SpeJobOptions.cs
@@ -57,7 +57,8 @@ public static implicit operator SpeJobOptions(JobOptions options)
{
return new SpeJobOptions(options.JobName, options.Category, options.SiteName, options.Method.Object, options.Method.Method.Name)
{
- WriteToLog = options.WriteToLog
+ WriteToLog = options.WriteToLog,
+ ClientLanguage = options.ClientLanguage
};
}
}
diff --git a/src/Spe.Sitecore92/Services/SpeJobOptions.cs b/src/Spe.Sitecore92/Services/SpeJobOptions.cs
index 5205d2880..a7aa10113 100644
--- a/src/Spe.Sitecore92/Services/SpeJobOptions.cs
+++ b/src/Spe.Sitecore92/Services/SpeJobOptions.cs
@@ -57,7 +57,8 @@ public static implicit operator SpeJobOptions(DefaultJobOptions options)
{
return new SpeJobOptions(options.JobName, options.Category, options.SiteName, options.Method.Object, options.Method.Method.Name)
{
- WriteToLog = options.WriteToLog
+ WriteToLog = options.WriteToLog,
+ ClientLanguage = options.ClientLanguage
};
}
}
diff --git a/src/Spe/Client/Applications/PowerShellRunner.cs b/src/Spe/Client/Applications/PowerShellRunner.cs
index 5a46414e0..163d36157 100644
--- a/src/Spe/Client/Applications/PowerShellRunner.cs
+++ b/src/Spe/Client/Applications/PowerShellRunner.cs
@@ -422,7 +422,7 @@ protected virtual void UpdateProgress(ClientPipelineArgs args)
else
{
Subtitle.Text = showStatus
- ? $"{Texts.PowerShellRunner_UpdateProgress_Status_} {status}"
+ ? $"{Texts.PowerShellRunner_UpdateProgress_Status_.Translate()} {status}"
: " ";
}
if (args.Parameters["RecordType"] == ProgressRecordType.Completed.ToString())
@@ -451,7 +451,7 @@ protected virtual void UpdateProgress(ClientPipelineArgs args)
if (secondsRemaining > -1)
sb.AppendFormat(
"" +
- Texts.PowerShellRunner_UpdateProgress_Time_remaining_ +
+ Texts.PowerShellRunner_UpdateProgress_Time_remaining_.Translate() +
" {0:c}
",
new TimeSpan(0, 0, 0, secondsRemaining));
}
@@ -459,7 +459,7 @@ protected virtual void UpdateProgress(ClientPipelineArgs args)
if (!string.IsNullOrEmpty(args.Parameters["CurrentOperation"]))
{
sb.AppendFormat("" +
- Texts.PowerShellRunner_UpdateProgress_Operation_ +
+ Texts.PowerShellRunner_UpdateProgress_Operation_.Translate() +
" {0}",
args.Parameters["CurrentOperation"]);
}
diff --git a/src/Spe/Core/Extensions/StringExtensions.cs b/src/Spe/Core/Extensions/StringExtensions.cs
index 97f404d1c..0b17b7aba 100644
--- a/src/Spe/Core/Extensions/StringExtensions.cs
+++ b/src/Spe/Core/Extensions/StringExtensions.cs
@@ -79,5 +79,14 @@ public static bool HasWord(this string value, params string[] words)
{
return words.Any(word => value.IndexOf(word, StringComparison.OrdinalIgnoreCase) > -1);
}
+
+ public static string Translate(this string value)
+ {
+ if (!string.IsNullOrWhiteSpace(value))
+ {
+ return Sitecore.Globalization.Translate.Text(value);
+ }
+ return value;
+ }
}
}
\ No newline at end of file
diff --git a/src/Spe/Core/Host/ScriptingHostUserInterface.cs b/src/Spe/Core/Host/ScriptingHostUserInterface.cs
index 7e3b49627..e6e442154 100644
--- a/src/Spe/Core/Host/ScriptingHostUserInterface.cs
+++ b/src/Spe/Core/Host/ScriptingHostUserInterface.cs
@@ -48,7 +48,7 @@ private void WriteToLog(string message, LogLevel level)
{
if (!IsOutputLoggingEnabled) return;
- switch(level)
+ switch (level)
{
case LogLevel.Debug:
PowerShellLog.Debug(message);
@@ -63,7 +63,7 @@ private void WriteToLog(string message, LogLevel level)
case LogLevel.Warning:
PowerShellLog.Warn(message);
break;
- }
+ }
}
///
@@ -112,7 +112,7 @@ public override SecureString ReadLineAsSecureString()
job.MessageQueue.PutMessage(new ShowMultiValuePromptMessage(options, "600", "200",
"Sitecore PowerShell Extensions", " ", string.Empty, string.Empty, string.Empty, false, null, null,
host.SessionKey));
- var values = (object[]) job.MessageQueue.GetResult() ?? new object[] {string.Empty};
+ var values = (object[])job.MessageQueue.GetResult() ?? new object[] { string.Empty };
return ToSecureString(((Hashtable)values[0])["Value"] as string);
}
@@ -152,7 +152,7 @@ public override void WriteLine(string value)
public override void WriteErrorLine(string value)
{
-
+
var splitter = new BufferSplitterCollection(OutputLineType.Error, value, RawUI.BufferSize.Width,
PrivateData.ErrorForegroundColor,
PrivateData.ErrorBackgroundColor, true);
@@ -176,14 +176,14 @@ public override void WriteProgress(long sourceId, ProgressRecord record)
var message = Message.Parse(this, "ise:updateprogress");
message.Arguments.Add("Activity", record.Activity);
message.Arguments.Add("ActivityId", record.ActivityId.ToString(CultureInfo.InvariantCulture));
- message.Arguments.Add("CurrentOperation", record.CurrentOperation);
- message.Arguments.Add("StatusDescription", record.StatusDescription);
+ message.Arguments.Add("CurrentOperation", Sitecore.Globalization.Translate.Text(record.CurrentOperation));
+ message.Arguments.Add("StatusDescription", Sitecore.Globalization.Translate.Text(record.StatusDescription));
message.Arguments.Add("ParentActivityId", record.ParentActivityId.ToString(CultureInfo.InvariantCulture));
message.Arguments.Add("PercentComplete", record.PercentComplete.ToString(CultureInfo.InvariantCulture));
message.Arguments.Add("RecordType", record.RecordType.ToString());
message.Arguments.Add("SecondsRemaining", record.SecondsRemaining.ToString(CultureInfo.InvariantCulture));
var sheerMessage = new SendMessageMessage(message, false);
-
+
var jobManager = TypeResolver.ResolveFromCache();
var job = jobManager.GetContextJob();
if (job != null)
@@ -224,7 +224,7 @@ public override Dictionary Prompt(string caption, string messa
var secureOptions = new Dictionary();
- for (var i=0 ; i < descriptions.Count; i++)
+ for (var i = 0; i < descriptions.Count; i++)
{
var description = descriptions[i];
var isSecure = description.ParameterTypeName.Contains("SecureString");
@@ -244,13 +244,13 @@ public override Dictionary Prompt(string caption, string messa
string.IsNullOrEmpty(caption) ? "Sitecore PowerShell Extensions" : caption,
string.IsNullOrEmpty(message) ? " " : message, string.Empty, string.Empty, string.Empty, false,
null, null, host.SessionKey));
- var values = (object[]) job.MessageQueue.GetResult();
+ var values = (object[])job.MessageQueue.GetResult();
return values?.Cast()
.ToDictionary(value => value["Name"].ToString(),
value =>
secureOptions[value["Name"].ToString()]
- ? PSObject.AsPSObject(ToSecureString((string) value["Value"]))
+ ? PSObject.AsPSObject(ToSecureString((string)value["Value"]))
: PSObject.AsPSObject(value["Value"]));
}
@@ -281,7 +281,7 @@ public override PSCredential PromptForCredential(string caption, string message,
public override int PromptForChoice(string caption, string message, Collection choices,
int defaultChoice)
- {
+ {
if (!CheckSessionCanDoInteractiveAction(nameof(PromptForChoice))) return -1;
@@ -298,14 +298,14 @@ public override int PromptForChoice(string caption, string message, Collection();
var dialogResult = jobUiManager.ShowModalDialog(parameters, "ConfirmChoice",
lineWidth.ToString(CultureInfo.InvariantCulture), lineHeight.ToString(CultureInfo.InvariantCulture));
@@ -339,7 +339,7 @@ public virtual bool CheckSessionCanDoInteractiveAction(string operation, bool th
var message = string.IsNullOrEmpty(operation)
? "Non interactive session cannot perform an interactive operation."
: $"Non interactive session cannot perform an interactive '{operation}' operation.";
-
+
PowerShellLog.Debug(message);
if (throwException)