Use .Localize extension function

This commit is contained in:
John Lewin 2017-01-04 07:23:30 -08:00
parent 06af3e220e
commit ace89e1e5a
48 changed files with 193 additions and 193 deletions

View file

@ -25,7 +25,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
printerBaudRateContainer = createPrinterBaudRateContainer();
contentRow.AddChild(printerBaudRateContainer);
{
nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Continue"));
nextButton = textImageButtonFactory.Generate("Continue".Localize());
nextButton.Click += new EventHandler(NextButton_Click);
//Add buttons to buttonContainer
@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
container.VAnchor = VAnchor.ParentBottomTop;
BorderDouble elementMargin = new BorderDouble(top: 3);
string baudRateLabelText = LocalizedString.Get("Baud Rate");
string baudRateLabelText = "Baud Rate".Localize();
string baudRateLabelTextFull = string.Format("{0}:", baudRateLabelText);
TextWidget baudRateLabel = new TextWidget(baudRateLabelTextFull, 0, 0, 12);
@ -58,16 +58,16 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
baudRateMessageContainer.Margin = elementMargin;
baudRateMessageContainer.HAnchor = HAnchor.ParentLeftRight;
printerBaudRateError = new TextWidget(LocalizedString.Get("Select the baud rate."), 0, 0, 10);
printerBaudRateError = new TextWidget("Select the baud rate.".Localize(), 0, 0, 10);
printerBaudRateError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerBaudRateError.AutoExpandBoundsToText = true;
printerBaudRateHelpLink = linkButtonFactory.Generate(LocalizedString.Get("What's this?"));
printerBaudRateHelpLink = linkButtonFactory.Generate("What's this?".Localize());
printerBaudRateHelpLink.Margin = new BorderDouble(left: 5);
printerBaudRateHelpLink.VAnchor = VAnchor.ParentBottom;
printerBaudRateHelpLink.Click += new EventHandler(printerBaudRateHelp_Click);
printerBaudRateHelpMessage = new TextWidget(LocalizedString.Get("The term 'Baud Rate' roughly means the speed at which\ndata is transmitted. Baud rates may differ from printer to\nprinter. Refer to your printer manual for more info.\n\nTip: If you are uncertain - try 250000."), 0, 0, 10);
printerBaudRateHelpMessage = new TextWidget("The term 'Baud Rate' roughly means the speed at which\ndata is transmitted. Baud rates may differ from printer to\nprinter. Refer to your printer manual for more info.\n\nTip: If you are uncertain - try 250000.".Localize(), 0, 0, 10);
printerBaudRateHelpMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerBaudRateHelpMessage.Margin = new BorderDouble(top: 10);
printerBaudRateHelpMessage.Visible = false;
@ -110,7 +110,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
baudRateContainer.AddChild(baudOption);
}
otherBaudRateRadioButton = new RadioButton(LocalizedString.Get("Other"));
otherBaudRateRadioButton = new RadioButton("Other".Localize());
otherBaudRateRadioButton.Margin = baudRateMargin;
otherBaudRateRadioButton.TextColor = ActiveTheme.Instance.PrimaryTextColor;
@ -184,7 +184,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
printerBaudRateHelpLink.Visible = false;
printerBaudRateError.TextColor = RGBA_Bytes.Red;
printerBaudRateError.Text = LocalizedString.Get("Oops! Please select a baud rate.");
printerBaudRateError.Text = "Oops! Please select a baud rate.".Localize();
}
if (baudRate != null)
@ -198,7 +198,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
printerBaudRateHelpLink.Visible = false;
printerBaudRateError.TextColor = RGBA_Bytes.Red;
printerBaudRateError.Text = LocalizedString.Get("Oops! Baud Rate must be an integer.");
printerBaudRateError.Text = "Oops! Baud Rate must be an integer.".Localize();
return false;
}
}
@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
return otherBaudRateInput.Text;
}
throw new Exception(LocalizedString.Get("Could not find a selected button."));
throw new Exception("Could not find a selected button.".Localize());
}
}
}

View file

@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
container.VAnchor = VAnchor.ParentBottomTop;
BorderDouble elementMargin = new BorderDouble(top: 3);
string serialPortLabel = LocalizedString.Get("Serial Port");
string serialPortLabel = "Serial Port".Localize();
string serialPortLabelFull = string.Format("{0}:", serialPortLabel);
TextWidget comPortLabel = new TextWidget(serialPortLabelFull, 0, 0, 12);
@ -193,7 +193,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
//If there are still no com ports show a message to that effect
if (portIndex == 0)
{
TextWidget comPortOption = new TextWidget(LocalizedString.Get("No COM ports available"));
TextWidget comPortOption = new TextWidget("No COM ports available".Localize());
comPortOption.Margin = new BorderDouble(3, 6, 5, 6);
comPortOption.TextColor = ActiveTheme.Instance.PrimaryTextColor;
comPortContainer.AddChild(comPortOption);
@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
}
throw new Exception(LocalizedString.Get("Could not find a selected button."));
throw new Exception("Could not find a selected button.".Localize());
}
}

View file

@ -33,22 +33,22 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
container.Margin = new BorderDouble(5);
BorderDouble elementMargin = new BorderDouble(top: 5);
TextWidget printerMessageOne = new TextWidget(LocalizedString.Get("MatterControl will now attempt to auto-detect printer."), 0, 0, 10);
TextWidget printerMessageOne = new TextWidget("MatterControl will now attempt to auto-detect printer.".Localize(), 0, 0, 10);
printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5);
printerMessageOne.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
printerMessageOne.Margin = elementMargin;
string printerMessageTwoTxt = LocalizedString.Get("Disconnect printer");
string printerMessageTwoTxtEnd = LocalizedString.Get("if currently connected");
string printerMessageTwoTxt = "Disconnect printer".Localize();
string printerMessageTwoTxtEnd = "if currently connected".Localize();
string printerMessageTwoTxtFull = string.Format("1.) {0} ({1}).", printerMessageTwoTxt, printerMessageTwoTxtEnd);
TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12);
printerMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
printerMessageTwo.Margin = elementMargin;
string printerMessageThreeTxt = LocalizedString.Get("Press");
string printerMessageThreeTxtEnd = LocalizedString.Get("Continue");
string printerMessageThreeTxt = "Press".Localize();
string printerMessageThreeTxtEnd = "Continue".Localize();
string printerMessageThreeFull = string.Format("2.) {0} '{1}'.", printerMessageThreeTxt, printerMessageThreeTxtEnd);
TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
printerMessageThree.TextColor = ActiveTheme.Instance.PrimaryTextColor;
@ -65,17 +65,17 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
setupManualConfigurationOrSkipConnectionWidget.HAnchor = HAnchor.ParentLeftRight;
setupManualConfigurationOrSkipConnectionWidget.Margin = elementMargin;
Button manualLink = linkButtonFactory.Generate(LocalizedString.Get("Manually Configure Connection"));
Button manualLink = linkButtonFactory.Generate("Manually Configure Connection".Localize());
manualLink.Margin = new BorderDouble(0, 5);
manualLink.Click += (s, e) => UiThread.RunOnIdle(WizardWindow.ChangeToPage<SetupStepComPortManual>);
string printerMessageFourText = LocalizedString.Get("or");
string printerMessageFourText = "or".Localize();
TextWidget printerMessageFour = new TextWidget(printerMessageFourText, 0, 0, 10);
printerMessageFour.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
printerMessageFour.Margin = elementMargin;
Button skipConnectionLink = linkButtonFactory.Generate(LocalizedString.Get("Skip Connection Setup"));
Button skipConnectionLink = linkButtonFactory.Generate("Skip Connection Setup".Localize());
skipConnectionLink.Margin = new BorderDouble(0, 8);
skipConnectionLink.Click += SkipConnectionLink_Click;

View file

@ -24,12 +24,12 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
public SetupStepInstallDriver()
{
headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
headerLabel.Text = string.Format("Install Communication Driver".Localize());
printerDriverContainer = createPrinterDriverContainer();
contentRow.AddChild(printerDriverContainer);
{
//Construct buttons
installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
installButton = textImageButtonFactory.Generate("Install Driver".Localize());
installButton.Click += (sender, e) =>
{
UiThread.RunOnIdle(() =>
@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
});
};
skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
skipButton = textImageButtonFactory.Generate("Skip".Localize());
skipButton.Click += (s, e) => WizardWindow.ChangeToSetupBaudOrComPortOne();
//Add buttons to buttonContainer
@ -59,12 +59,12 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
container.Margin = new BorderDouble(0, 5);
BorderDouble elementMargin = new BorderDouble(top: 3);
printerDriverMessage = new TextWidget(LocalizedString.Get("This printer requires a driver for communication."), 0, 0, 10);
printerDriverMessage = new TextWidget("This printer requires a driver for communication.".Localize(), 0, 0, 10);
printerDriverMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerDriverMessage.HAnchor = HAnchor.ParentLeftRight;
printerDriverMessage.Margin = elementMargin;
TextWidget printerDriverMessageTwo = new TextWidget(LocalizedString.Get("Driver located. Would you like to install?"), 0, 0, 10);
TextWidget printerDriverMessageTwo = new TextWidget("Driver located. Would you like to install?".Localize(), 0, 0, 10);
printerDriverMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerDriverMessageTwo.HAnchor = HAnchor.ParentLeftRight;
printerDriverMessageTwo.Margin = elementMargin;