diff --git a/MatterControl.userprefs b/MatterControl.userprefs index 919b6ac07..111c7ce9e 100644 --- a/MatterControl.userprefs +++ b/MatterControl.userprefs @@ -1,9 +1,18 @@  - - + + - + + + + + + + + + + diff --git a/PartPreviewWindow/GcodeViewBasic.cs b/PartPreviewWindow/GcodeViewBasic.cs index 9d97a1b47..c7b37256f 100644 --- a/PartPreviewWindow/GcodeViewBasic.cs +++ b/PartPreviewWindow/GcodeViewBasic.cs @@ -46,6 +46,7 @@ using MatterHackers.GCodeVisualizer; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl; using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl.PartPreviewWindow { @@ -100,7 +101,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; - generateGCodeButton = textImageButtonFactory.Generate("Generate"); + generateGCodeButton = textImageButtonFactory.Generate(new LocalizedString("Generate").Translated); generateGCodeButton.Click += new ButtonBase.ButtonEventHandler(generateButton_Click); buttonBottomPanel.AddChild(generateGCodeButton); @@ -108,7 +109,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow layerSelectionButtonsPannel.HAnchor = HAnchor.ParentLeftRight; layerSelectionButtonsPannel.Padding = new BorderDouble(0); - closeButton = textImageButtonFactory.Generate("Close"); + closeButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated); layerSelectionButtonsPannel.AddChild(closeButton); @@ -117,7 +118,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop); - string startingMessage = "Loading GCode..."; + string startingMessage = new LocalizedString("Loading GCode...").Translated; if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE") { gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(printItem.FileLocation)); @@ -133,7 +134,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } else { - startingMessage = "Press 'generate' to view layers"; + startingMessage = "Press 'generate' to view layers"; } if (File.Exists(gcodePathAndFileName) && gcodeFileIsComplete) @@ -361,7 +362,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow layerInfoContainer.HAnchor = HAnchor.ParentLeftRight; layerInfoContainer.Padding = new BorderDouble(5); - layerInfoContainer.AddChild(new TextWidget("Layer Number:", textColor: RGBA_Bytes.White)); + layerInfoContainer.AddChild(new TextWidget("Layer Number:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Layer Height:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Num GCodes:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Filament Used:", textColor: RGBA_Bytes.White)); diff --git a/PrintLibrary/PluginChooserWindow.cs b/PrintLibrary/PluginChooserWindow.cs index 15d179cce..38512e85b 100644 --- a/PrintLibrary/PluginChooserWindow.cs +++ b/PrintLibrary/PluginChooserWindow.cs @@ -38,6 +38,7 @@ using MatterHackers.Agg.UI; using MatterHackers.VectorMath; using MatterHackers.Agg.Image; using MatterHackers.MatterControl.DataStorage; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl.PrintLibrary { @@ -58,7 +59,7 @@ namespace MatterHackers.MatterControl.PrintLibrary public PluginChooserWindow() : base(360, 300) { - Title = "Installed Plugins"; + Title = new LocalizedString("Installed Plugins").Translated; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); @@ -70,7 +71,8 @@ namespace MatterHackers.MatterControl.PrintLibrary headerRow.Padding = new BorderDouble(0, 3, 0, 3); { - TextWidget elementHeader = new TextWidget(string.Format("Select a Design Tool:"), pointSize: 14); + string elementHeaderLbl = new LocalizedString ("Select a Design Tool:").Translated; + TextWidget elementHeader = new TextWidget(string.Format(elementHeaderLbl), pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; @@ -145,7 +147,7 @@ namespace MatterHackers.MatterControl.PrintLibrary //ShowAsSystemWindow(); - Button cancelPresetsButton = textImageButtonFactory.Generate("Cancel"); + Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Cancel").Translated); cancelPresetsButton.Click += (sender, e) => { Close(); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); diff --git a/PrintQueue/PrintQueueItem.cs b/PrintQueue/PrintQueueItem.cs index 14d6a88a2..d7a52064a 100644 --- a/PrintQueue/PrintQueueItem.cs +++ b/PrintQueue/PrintQueueItem.cs @@ -81,6 +81,7 @@ namespace MatterHackers.MatterControl.PrintQueue { string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name); labelName = labelName.Replace('_', ' '); + labelName = new LocalizedString (labelName).Translated; partLabel = new TextWidget(labelName, pointSize: 14); partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 16); diff --git a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs index 55a2ce82a..93d0379e0 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs @@ -38,16 +38,16 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections contentRow.AddChild(printerComPortContainer); { //Construct buttons - nextButton = textImageButtonFactory.Generate("Done"); + nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated); nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click); nextButton.Visible = false; - connectButton = textImageButtonFactory.Generate("Connect"); + connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated); connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click); PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); - refreshButton = textImageButtonFactory.Generate("Refresh"); + refreshButton = textImageButtonFactory.Generate(new LocalizedString("Refresh").Translated); refreshButton.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click); GuiWidget hSpacer = new GuiWidget(); @@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections { printerComPortHelpLink.Visible = false; printerComPortError.TextColor = RGBA_Bytes.Red; - printerComPortError.Text = "Uh-oh! Could not connect to printer."; + printerComPortError.Text = new LocalizedString("Uh-oh! Could not connect to printer.").Translated; connectButton.Visible = true; nextButton.Visible = false; } @@ -216,7 +216,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections { printerComPortHelpLink.Visible = false; printerComPortError.TextColor = RGBA_Bytes.White; - printerComPortError.Text = "Connection succeeded!"; + printerComPortError.Text = new LocalizedString("Connection succeeded!").Translated; nextButton.Visible = true; connectButton.Visible = false; } @@ -264,7 +264,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections this.ActivePrinter.Commit(); printerComPortHelpLink.Visible = false; printerComPortError.TextColor = RGBA_Bytes.White; - printerComPortError.Text = "Attempting to connect..."; + string printerComPortErrorLbl = new LocalizedString("Attempting to connect").Translated; + string printerComPortErrorLblFull = string.Format("{0}...",printerComPortErrorLbl); + printerComPortError.Text = printerComPortErrorLblFull; PrinterCommunication.Instance.ActivePrinter = this.ActivePrinter; PrinterCommunication.Instance.ConnectToActivePrinter(); connectButton.Visible = false; @@ -293,7 +295,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections return button.PortValue; } } - throw new Exception("Could not find a selected button."); + throw new Exception(new LocalizedString("Could not find a selected button.").Translated); } } } diff --git a/PrinterControls/PrinterConnections/SetupStepComPortOne.cs b/PrinterControls/PrinterConnections/SetupStepComPortOne.cs index 8df794858..b9fe112c1 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortOne.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortOne.cs @@ -56,12 +56,18 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections printerMessageOne.HAnchor = HAnchor.ParentLeftRight; printerMessageOne.Margin = elementMargin; - TextWidget printerMessageTwo = new TextWidget(new LocalizedString("1.) Disconnect printer (if currently connected).").Translated, 0, 0, 12); + string printerMessageTwoTxt = new LocalizedString("Disconnect printer").Translated; + string printerMessageTwoTxtEnd = new LocalizedString("if currently connected").Translated; + string printerMessageTwoTxtFull = string.Format ("1.) {0} ({1}).", printerMessageTwoTxt, printerMessageTwoTxtEnd); + TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12); printerMessageTwo.TextColor = RGBA_Bytes.White; printerMessageTwo.HAnchor = HAnchor.ParentLeftRight; printerMessageTwo.Margin = elementMargin; - TextWidget printerMessageThree = new TextWidget(new LocalizedString("2.) Press 'Continue'.").Translated, 0, 0, 12); + string printerMessageThreeTxt = new LocalizedString("Press").Translated; + string printerMessageThreeTxtEnd = new LocalizedString ("Continue").Translated; + string printerMessageThreeFull = string.Format ("2.) {0} '{1}'.", printerMessageThreeTxt, printerMessageThreeTxtEnd); + TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12); printerMessageThree.TextColor = RGBA_Bytes.White; printerMessageThree.HAnchor = HAnchor.ParentLeftRight; printerMessageThree.Margin = elementMargin; diff --git a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs index 998cb6bca..096e516c9 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs @@ -13,6 +13,7 @@ using MatterHackers.PolygonMesh; using MatterHackers.RenderOpenGl; using MatterHackers.VectorMath; using MatterHackers.MatterControl.DataStorage; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections { @@ -33,11 +34,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections contentRow.AddChild(createPrinterConnectionMessageContainer()); { //Construct buttons - nextButton = textImageButtonFactory.Generate("Done"); + nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated); nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click); nextButton.Visible = false; - connectButton = textImageButtonFactory.Generate("Connect"); + connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated); connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click); PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); @@ -70,28 +71,40 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections container.Margin = new BorderDouble(5); BorderDouble elementMargin = new BorderDouble(top: 5); - TextWidget printerMessageOne = new TextWidget("MatterControl will now attempt to auto-detect printer.", 0, 0, 10); + string printerMessageOneText = new LocalizedString ("MatterControl will now attempt to auto-detect printer.").Translated; + TextWidget printerMessageOne = new TextWidget(printerMessageOneText, 0, 0, 10); printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5); printerMessageOne.TextColor = RGBA_Bytes.White; printerMessageOne.HAnchor = HAnchor.ParentLeftRight; printerMessageOne.Margin = elementMargin; - TextWidget printerMessageTwo = new TextWidget("1.) Disconnect printer (if currently connected).", 0, 0, 12); + string printerMessageTwoTxtBeg = new LocalizedString ("Disconnect printer").Translated; + string printerMessageTwoTxtEnd = new LocalizedString ("if currently connected").Translated; + string printerMessageTwoTxtFull = string.Format ("1.) {0} ({1}).", printerMessageTwoTxtBeg, printerMessageTwoTxtEnd); + TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12); printerMessageTwo.TextColor = RGBA_Bytes.White; printerMessageTwo.HAnchor = HAnchor.ParentLeftRight; printerMessageTwo.Margin = elementMargin; - TextWidget printerMessageThree = new TextWidget("2.) Press 'Continue'.", 0, 0, 12); + string printerMessageThreeTxtBeg = new LocalizedString ("Press").Translated; + string printerMessageThreeTxtEnd = new LocalizedString ("Continue").Translated; + string printerMessageThreeTxtFull = string.Format ("2.) {0} '{1}'.", printerMessageThreeTxtBeg, printerMessageThreeTxtEnd); + TextWidget printerMessageThree = new TextWidget(printerMessageThreeTxtFull, 0, 0, 12); printerMessageThree.TextColor = RGBA_Bytes.White; printerMessageThree.HAnchor = HAnchor.ParentLeftRight; printerMessageThree.Margin = elementMargin; - TextWidget printerMessageFour = new TextWidget("3.) Power on and connect printer.", 0, 0, 12); + string printerMessageFourBeg = new LocalizedString ("Power on and connect printer").Translated; + string printerMessageFourFull = string.Format ("3.) {0}.", printerMessageFourBeg); + TextWidget printerMessageFour = new TextWidget(printerMessageFourFull, 0, 0, 12); printerMessageFour.TextColor = RGBA_Bytes.White; printerMessageFour.HAnchor = HAnchor.ParentLeftRight; printerMessageFour.Margin = elementMargin; - TextWidget printerMessageFive = new TextWidget("4.) Press 'Connect'.", 0, 0, 12); + string printerMessageFiveTxtBeg = new LocalizedString ("Press").Translated; + string printerMessageFiveTxtEnd = new LocalizedString ("Connect").Translated; + string printerMessageFiveTxtFull = string.Format ("4.) {0} '{1}'.", printerMessageFiveTxtBeg, printerMessageFiveTxtEnd); + TextWidget printerMessageFive = new TextWidget(printerMessageFiveTxtFull, 0, 0, 12); printerMessageFive.TextColor = RGBA_Bytes.White; printerMessageFive.HAnchor = HAnchor.ParentLeftRight; printerMessageFive.Margin = elementMargin; @@ -99,7 +112,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections GuiWidget vSpacer = new GuiWidget(); vSpacer.VAnchor = VAnchor.ParentBottomTop; - Button manualLink = linkButtonFactory.Generate("Manual Configuration"); + Button manualLink = linkButtonFactory.Generate(new LocalizedString("Manual Configuration").Translated); manualLink.Margin = new BorderDouble(0, 5); manualLink.Click += new ButtonBase.ButtonEventHandler(ManualLink_Click); @@ -148,13 +161,16 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections if (candidatePort == null) { printerErrorMessage.TextColor = RGBA_Bytes.Red; - printerErrorMessage.Text = "Oops! Printer could not be detected."; + string printerErrorMessageLblFull = new LocalizedString ("Oops! Printer could not be detected ").Translated; + printerErrorMessage.Text = printerErrorMessageLblFull; } else { ActivePrinter.ComPort = candidatePort; printerErrorMessage.TextColor = RGBA_Bytes.White; - printerErrorMessage.Text = "Attempting to connect..."; + string printerErrorMessageLblTwo = new LocalizedString ("Attempting to connect").Translated; + string printerErrorMessageLblTwoFull = string.Format("{0}...",printerErrorMessageLblTwo); + printerErrorMessage.Text = printerErrorMessageLblTwoFull; this.ActivePrinter.Commit(); PrinterCommunication.Instance.ActivePrinter = this.ActivePrinter; PrinterCommunication.Instance.ConnectToActivePrinter(); @@ -178,7 +194,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections void onConnectionFailed() { printerErrorMessage.TextColor = RGBA_Bytes.Red; - printerErrorMessage.Text = "Uh-oh! Could not connect to printer."; + printerErrorMessage.Text = new LocalizedString("Uh-oh! Could not connect to printer.").Translated; connectButton.Visible = true; nextButton.Visible = false; } @@ -186,7 +202,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections void onConnectionSuccess() { printerErrorMessage.TextColor = RGBA_Bytes.White; - printerErrorMessage.Text = "Connection succeeded!"; + string printerErrorMessageLblThree = new LocalizedString ("Connection succeeded").Translated; + string printerErrorMessageLblThreeFull = string.Format ("{0}!", printerErrorMessageLblThree); + printerErrorMessage.Text = printerErrorMessageLblThreeFull; nextButton.Visible = true; connectButton.Visible = false; } diff --git a/SliceConfiguration/ActiveSliceSettings.cs b/SliceConfiguration/ActiveSliceSettings.cs index 43ea722ca..dbc71e650 100644 --- a/SliceConfiguration/ActiveSliceSettings.cs +++ b/SliceConfiguration/ActiveSliceSettings.cs @@ -10,6 +10,7 @@ using MatterHackers.Agg.UI; using MatterHackers.VectorMath; using MatterHackers.MatterControl.ContactForm; using MatterHackers.MatterControl.DataStorage; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl { @@ -510,7 +511,7 @@ namespace MatterHackers.MatterControl { string error = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'."; string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter); - string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'"; + string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'"; StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error"); return false; } diff --git a/SliceConfiguration/SettingsControlBar.cs b/SliceConfiguration/SettingsControlBar.cs index b51d1b265..f84acf8a1 100644 --- a/SliceConfiguration/SettingsControlBar.cs +++ b/SliceConfiguration/SettingsControlBar.cs @@ -11,6 +11,7 @@ using Newtonsoft.Json.Utilities; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.VectorMath; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl { @@ -51,7 +52,11 @@ namespace MatterHackers.MatterControl settingsStatusLabelContainer.VAnchor |= VAnchor.ParentTop; settingsStatusLabelContainer.Margin = new BorderDouble(0); { - TextWidget settingsStatusLabel = new TextWidget(string.Format("Active Settings:"), pointSize: 10); + string activeSettingsLabelText = new LocalizedString ("Active Settings:").Translated; + string activeSettingsLabelTextFull = string.Format ("{0}:", activeSettingsLabelText); + + + TextWidget settingsStatusLabel = new TextWidget(string.Format(activeSettingsLabelTextFull), pointSize: 10); settingsStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; settingsStatusDescription = new TextWidget("", pointSize: 14); @@ -70,19 +75,19 @@ namespace MatterHackers.MatterControl settingsStatusLabelContainer.AddChild(unsavedChangesIndicator); } - saveButton = textImageButtonFactory.Generate("Save"); + saveButton = textImageButtonFactory.Generate(new LocalizedString("Save").Translated); saveButton.VAnchor = VAnchor.ParentTop; saveButton.Visible = false; saveButton.Margin = new BorderDouble(0, 0, 0, 10); saveButton.Click += new ButtonBase.ButtonEventHandler(saveButton_Click); - revertbutton = textImageButtonFactory.Generate("Revert"); + revertbutton = textImageButtonFactory.Generate(new LocalizedString("Revert").Translated); revertbutton.VAnchor = VAnchor.ParentTop; revertbutton.Visible = false; revertbutton.Margin = new BorderDouble(0,0,0,10); revertbutton.Click += new ButtonBase.ButtonEventHandler(revertbutton_Click); - SliceOptionsMenuDropList = new DropDownMenu("Options "); + SliceOptionsMenuDropList = new DropDownMenu(new LocalizedString("Options ").Translated); SliceOptionsMenuDropList.Margin = new BorderDouble(top: 11); SliceOptionsMenuDropList.VAnchor |= VAnchor.ParentTop; SliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50); @@ -97,7 +102,9 @@ namespace MatterHackers.MatterControl sliceEngineContainer.Margin = new BorderDouble(0,0,10,0); sliceEngineContainer.VAnchor |= VAnchor.ParentTop; { - TextWidget sliceEngineLabel = new TextWidget(string.Format("Slice Engine:"), pointSize: 10); + string sliceEngineLabelText = new LocalizedString ("Slice Engine").Translated; + string sliceEngineLabelTextFull = string.Format ("{0}:", sliceEngineLabelText); + TextWidget sliceEngineLabel = new TextWidget(string.Format(sliceEngineLabelTextFull), pointSize: 10); sliceEngineLabel.Margin = new BorderDouble(0); sliceEngineLabel.HAnchor = HAnchor.ParentLeft; sliceEngineLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; @@ -204,7 +211,7 @@ namespace MatterHackers.MatterControl //Set the name and callback function of the menu items slicerOptionsMenuItems = new TupleList> { - {"Import", ImportQueueMenu_Click}, + {"Import", ImportQueueMenu_Click}, {"Export", ExportQueueMenu_Click}, }; diff --git a/SliceConfiguration/SliceSettingsOrganizer.cs b/SliceConfiguration/SliceSettingsOrganizer.cs index 75552222b..272e2cdc2 100644 --- a/SliceConfiguration/SliceSettingsOrganizer.cs +++ b/SliceConfiguration/SliceSettingsOrganizer.cs @@ -13,6 +13,7 @@ using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.VectorMath; using MatterHackers.MatterControl.DataStorage; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl { @@ -62,7 +63,7 @@ namespace MatterHackers.MatterControl this.SlicerConfigName = slicerConfigName; this.PresentationName = presentationName; this.DataEditType = dataEditType; - this.HelpText = helpText; + this.HelpText = new LocalizedString(helpText).Translated; } } @@ -192,10 +193,10 @@ namespace MatterHackers.MatterControl return instance; } } - + SliceSettingsOrganizer() { - string layouts = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Layouts.txt"); + string layouts = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Layouts.txt"); string properties = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Properties.txt"); LoadAndParseSettingsFiles(properties, layouts); @@ -259,7 +260,7 @@ namespace MatterHackers.MatterControl sw.Close(); } - void LoadAndParseSettingsFiles(string properties, string layouts) + void LoadAndParseSettingsFiles(string properties, string layout) { { string propertiesFileContents = ""; @@ -282,14 +283,14 @@ namespace MatterHackers.MatterControl } { - string layoutFileContents = ""; - using (FileStream fileStream = new FileStream(layouts, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + string layoutFileContents = ""; + using (FileStream fileStream = new FileStream(layout, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (StreamReader layoutReader = new StreamReader(fileStream)) { layoutFileContents = layoutReader.ReadToEnd(); } - } + } OrganizerUserLevel userLevelToAddTo = null; OrganizerCategory categoryToAddTo = null; diff --git a/SliceConfiguration/SliceSettingsWidget.cs b/SliceConfiguration/SliceSettingsWidget.cs index bfd2e3b9d..76547eb49 100644 --- a/SliceConfiguration/SliceSettingsWidget.cs +++ b/SliceConfiguration/SliceSettingsWidget.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl public UiState(SliceSettingsWidget settingsToCopy) { - showHelp = settingsToCopy.ShowingHelp; + showHelp = settingsToCopy.ShowingHelp; userLevel = settingsToCopy.UserLevel; settingsToCopy.CurrentlyActiveCategory(out selectedCategory.index, out selectedCategory.name); settingsToCopy.CurrentlyActiveGroup(out selectedGroup.index, out selectedGroup.name); @@ -103,10 +103,10 @@ namespace MatterHackers.MatterControl { int minSettingNameWidth = 220; - showHelpBox = new CheckBox("Show Help"); - showHelpBox.Checked = uiState.showHelp; + showHelpBox = new CheckBox(new LocalizedString("Show Help").Translated); + showHelpBox.Checked = uiState.showHelp; - showAllDetails = new CheckBox("Show All Settings"); + showAllDetails = new CheckBox(new LocalizedString("Show All Settings").Translated); showAllDetails.Checked = uiState.userLevel == "Advanced"; FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop); @@ -140,7 +140,8 @@ namespace MatterHackers.MatterControl for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++) { OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex]; - TabPage categoryPage = new TabPage(category.Name); + string categoryPageLbl = new LocalizedString (category.Name).Translated; + TabPage categoryPage = new TabPage(categoryPageLbl); SimpleTextTabWidget textTabWidget = new SimpleTextTabWidget(categoryPage, 16, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); categoryPage.AnchorAll(); @@ -205,7 +206,7 @@ namespace MatterHackers.MatterControl showHelpBox.Cursor = Cursors.Hand; showHelpBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings); - categoryTabs.TabBar.AddChild(showHelpBox); + categoryTabs.TabBar.AddChild(showHelpBox); } pageTopToBottomLayout.AddChild(categoryTabs); @@ -286,7 +287,8 @@ namespace MatterHackers.MatterControl foreach (OrganizerGroup group in category.GroupsList) { tabIndexForItem = 0; - TabPage groupTabPage = new TabPage(group.Name); + string groupTabLbl = new LocalizedString (group.Name).Translated; + TabPage groupTabPage = new TabPage(groupTabLbl); SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); @@ -319,7 +321,8 @@ namespace MatterHackers.MatterControl if (addedSettingToSubGroup) { needToAddSubGroup = true; - GroupBox groupBox = new GroupBox(subGroup.Name); + string groupBoxLbl = new LocalizedString (subGroup.Name).Translated; + GroupBox groupBox = new GroupBox (groupBoxLbl); groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.AddChild(topToBottomSettings); @@ -360,6 +363,7 @@ namespace MatterHackers.MatterControl allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; double helpPointSize = 10; + string[] wrappedText = TypeFacePrinter.WrapText(settingInfo.HelpText, textRegionWidth - allText.Padding.Width, helpPointSize); foreach(string line in wrappedText) { @@ -449,6 +453,7 @@ namespace MatterHackers.MatterControl { string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n"); convertedNewLines = convertedNewLines.Replace("\\n", "\n"); + convertedNewLines = new LocalizedString (convertedNewLines).Translated; TextWidget settingName = new TextWidget(convertedNewLines); settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor; settingName.Width = minSettingNameWidth;