diff --git a/CHANGELOG.md b/CHANGELOG.md index 7345a668f..ffdc2e09b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added +- [SIL.Windows.Forms.WritingSystems] Made WritingSystemSetupDialog controls localizable via L10NSharpExtender - [SIL.Windows.Forms.Archiving, SIL.Windows.Forms.DblBundle] Added `net8.0-windows` target. - [SIL.Core.Clearshare] Added new classes MetadataCore, CreativeCommonsLicenseInfo, and CustomLicenseInfo; these are Winforms-free base versions of the classes Metadata, CreativeCommonsLicense, and CustomLicense. - [SIL.Core.Clearshare and SIL.Windows.Forms.Clearshare] Added LicenseUtils and LicenseWithImageUtils to handle the FromXmp method for creating a license. LicenseUtils constructs a bare license object that is Winforms-independent; LicenseWithImageUtils constructs a Winforms-dependent license object with access to license images. diff --git a/SIL.Windows.Forms.WritingSystems.Tests/UITests.cs b/SIL.Windows.Forms.WritingSystems.Tests/UITests.cs index 907e80286..b5bf8aab8 100644 --- a/SIL.Windows.Forms.WritingSystems.Tests/UITests.cs +++ b/SIL.Windows.Forms.WritingSystems.Tests/UITests.cs @@ -14,6 +14,24 @@ namespace SIL.Windows.Forms.WritingSystems.Tests [TestFixture] public class UITests { + [Test] + [Explicit("Requires KeyboardController and LocalizationManager infrastructure — run by hand")] + [Apartment(ApartmentState.STA)] + public void WritingSystemSetupDialog_Construct_DoesNotThrow() + { + using (var folder = new TemporaryFolder("WS-Test-Smoke")) + { + var repository = LdmlInFolderWritingSystemRepository.Initialize(folder.Path); + Assert.DoesNotThrow(() => + { + using (var dlg = new WritingSystemSetupDialog(repository)) + { + Assert.That(dlg, Is.Not.Null); + } + }); + } + } + //NB: in Mar 2011, I couldn't get these to run in vs 2010 with resharper, because // of the need to be in single apartment thread mode. The app.config is there, requesting // it, but it doesn't work. So I had to plug in this CrossThreadTestRunner thing diff --git a/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.Designer.cs b/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.Designer.cs index 59bc3de53..e0a29d465 100644 --- a/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.Designer.cs +++ b/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.Designer.cs @@ -36,11 +36,14 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this._writingSystemSetupView = new WritingSystemSetupView(); this._closeButton = new System.Windows.Forms.Button(); this._openGlobal = new System.Windows.Forms.Button(); this._openDirectory = new System.Windows.Forms.Button(); this._openLabel = new System.Windows.Forms.Label(); + this._L10NSharpExtender = new L10NSharp.Windows.Forms.L10NSharpExtender(this.components); + ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).BeginInit(); this.SuspendLayout(); // // _writingSystemSetupView @@ -53,42 +56,55 @@ private void InitializeComponent() this._writingSystemSetupView.Size = new System.Drawing.Size(841, 461); this._writingSystemSetupView.TabIndex = 0; // - // + // _L10NSharpExtender + // + this._L10NSharpExtender.LocalizationManagerId = "Palaso"; + this._L10NSharpExtender.PrefixForNewItems = "WritingSystemSetupDialog"; + // // _closeButton - // + // this._closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._closeButton.Location = new System.Drawing.Point(767, 444); this._closeButton.Name = "_closeButton"; this._closeButton.Size = new System.Drawing.Size(75, 23); this._closeButton.TabIndex = 1; this._closeButton.Text = "Close"; + this._L10NSharpExtender.SetLocalizableToolTip(this._closeButton, null); + this._L10NSharpExtender.SetLocalizationComment(this._closeButton, null); + this._L10NSharpExtender.SetLocalizingId(this._closeButton, "WritingSystemSetupDialog.CloseButton"); this._closeButton.UseVisualStyleBackColor = true; this._closeButton.Click += new System.EventHandler(this._closeButton_Click); - // + // // _openGlobal - // + // this._openGlobal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._openGlobal.Location = new System.Drawing.Point(521, 444); this._openGlobal.Name = "_openGlobal"; this._openGlobal.Size = new System.Drawing.Size(75, 23); this._openGlobal.TabIndex = 2; this._openGlobal.Text = "Computer"; + this._L10NSharpExtender.SetLocalizableToolTip(this._openGlobal, null); + this._L10NSharpExtender.SetLocalizationComment(this._openGlobal, null); + this._L10NSharpExtender.SetLocalizingId(this._openGlobal, "WritingSystemSetupDialog.ComputerButton"); this._openGlobal.UseVisualStyleBackColor = true; this._openGlobal.Click += new System.EventHandler(this._openGlobal_Click); - // + // // _openDirectory - // + // this._openDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._openDirectory.Location = new System.Drawing.Point(602, 444); this._openDirectory.Name = "_openDirectory"; this._openDirectory.Size = new System.Drawing.Size(75, 23); this._openDirectory.TabIndex = 4; this._openDirectory.Text = "Directory"; + this._L10NSharpExtender.SetLocalizableToolTip(this._openDirectory, null); + this._L10NSharpExtender.SetLocalizationComment(this._openDirectory, null); + this._L10NSharpExtender.SetLocalizingId(this._openDirectory, "WritingSystemSetupDialog.DirectoryButton"); this._openDirectory.UseVisualStyleBackColor = true; this._openDirectory.Click += new System.EventHandler(this._openDirectory_Click); - // + // // _openLabel - // + // this._openLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._openLabel.AutoSize = true; this._openLabel.Location = new System.Drawing.Point(380, 448); @@ -96,9 +112,12 @@ private void InitializeComponent() this._openLabel.Size = new System.Drawing.Size(36, 13); this._openLabel.TabIndex = 10; this._openLabel.Text = "Open Writing Systems:"; - // + this._L10NSharpExtender.SetLocalizableToolTip(this._openLabel, null); + this._L10NSharpExtender.SetLocalizationComment(this._openLabel, null); + this._L10NSharpExtender.SetLocalizingId(this._openLabel, "WritingSystemSetupDialog.OpenWritingSystemsLabel"); + // // WritingSystemSetupDialog - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(855, 479); @@ -107,8 +126,12 @@ private void InitializeComponent() this.Controls.Add(this._openGlobal); this.Controls.Add(this._closeButton); this.Controls.Add(this._writingSystemSetupView); + this._L10NSharpExtender.SetLocalizableToolTip(this, null); + this._L10NSharpExtender.SetLocalizationComment(this, null); + this._L10NSharpExtender.SetLocalizingId(this, "WritingSystemSetupDialog.WindowTitle"); this.Name = "WritingSystemSetupDialog"; this.Text = "Writing Systems"; + ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -121,5 +144,6 @@ private void InitializeComponent() private System.Windows.Forms.Button _openGlobal; private System.Windows.Forms.Button _openDirectory; private System.Windows.Forms.Label _openLabel; + private L10NSharp.Windows.Forms.L10NSharpExtender _L10NSharpExtender; } } \ No newline at end of file diff --git a/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.cs b/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.cs index a066823c2..782ce9c22 100644 --- a/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.cs +++ b/SIL.Windows.Forms.WritingSystems/WritingSystemSetupDialog.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; +using L10NSharp; using SIL.Windows.Forms.WritingSystems.WSTree; using SIL.WritingSystems; @@ -74,7 +75,8 @@ private void _closeButton_Click(object sender, EventArgs e) catch (ArgumentException exception) { MessageBox.Show ( - this, exception.Message, "Input Systems Error", + this, exception.Message, + LocalizationManager.GetString("WritingSystemSetupDialog.InputSystemsError", "Input Systems Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); } @@ -87,7 +89,7 @@ private void _openDirectory_Click(object sender, EventArgs e) openDir.RootFolder = Environment.SpecialFolder.Personal; // Set the help text description for the FolderBrowserDialog. - openDir.Description = "Select the folder with Writing Systems"; + openDir.Description = LocalizationManager.GetString("WritingSystemSetupDialog.SelectFolderDescription", "Select the folder with Writing Systems"); // Allow the user to create new files via the FolderBrowserDialog. openDir.ShowNewFolderButton = true; @@ -105,7 +107,7 @@ private void _openDirectory_Click(object sender, EventArgs e) dlg.WritingSystemSuggestor.SuggestVoice = true; dlg.WritingSystemSuggestor.OtherKnownWritingSystems = null; - dlg.Text = String.Format("Writing Systems in folder {0}", newDir); + dlg.Text = String.Format(LocalizationManager.GetString("WritingSystemSetupDialog.TitleWithFolder", "Writing Systems in folder {0}", "The {0} is replaced with the folder path."), newDir); dlg.Show(); } @@ -117,7 +119,7 @@ private void _openGlobal_Click(object sender, EventArgs e) dlg.WritingSystemSuggestor.SuggestVoice = true; dlg.WritingSystemSuggestor.OtherKnownWritingSystems = null; dlg.DisposeRepository = true; - dlg.Text = String.Format("Writing Systems for all users of this computer"); + dlg.Text = LocalizationManager.GetString("WritingSystemSetupDialog.TitleAllUsers", "Writing Systems for all users of this computer"); dlg.Show(); }