From 7c7d0f11dd87436b94933afa7c0fc3eaf78562b6 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Mon, 6 Oct 2014 14:48:18 -0400 Subject: [PATCH] Complete localization of BloomPack dialogs --- DistFiles/localization/Bloom.en.tmx | 36 ++++++++++++++++++ .../BloomPackInstallDialog.Designer.cs | 25 ++++++++++++ .../BloomPack/BloomPackInstallDialog.cs | 38 ++++++++++--------- .../BloomPack/BloomPackInstallDialog.resx | 3 ++ src/BloomExe/Program.cs | 3 ++ 5 files changed, 87 insertions(+), 18 deletions(-) diff --git a/DistFiles/localization/Bloom.en.tmx b/DistFiles/localization/Bloom.en.tmx index 7274fce3d9a9..02c407f83f6a 100644 --- a/DistFiles/localization/Bloom.en.tmx +++ b/DistFiles/localization/Bloom.en.tmx @@ -125,11 +125,27 @@ If you need somewhere to put more information about the book, you can use this page, which is the outside of the back cover. + + + Bloom Pack Installation + + The {0} Collection is now ready to use on this computer. + + Displayed as the message box title + + BloomPack Installer + + + + + {0} does not exist + + Bloom was not able to install that Bloom Pack @@ -146,11 +162,31 @@ Bloom is already running, but the contents will not show up until the next time you run Bloom + + + The Bloom collection will not be installed. + + Opening {0}... + + + This computer already has a Bloom collection named '{0}'. Do you want to replace it with the one from this BloomPack? + + + + + Bloom Packs should have only a single collection folder at the top level of the zip file. + + + + + Bloom was not able to remove the existing copy of '{0}'. Quit Bloom if it is running & try again. Otherwise, try again after restarting your computer. + + true diff --git a/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.Designer.cs b/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.Designer.cs index 68f630aec5c8..850e0dcc2a14 100644 --- a/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.Designer.cs +++ b/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.Designer.cs @@ -36,13 +36,18 @@ private void InitializeComponent() this._errorImage = new System.Windows.Forms.PictureBox(); this._backgroundWorker = new System.ComponentModel.BackgroundWorker(); this._startupTimer = new System.Windows.Forms.Timer(this.components); + this._L10NSharpExtender = new L10NSharp.UI.L10NSharpExtender(this.components); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorImage)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.Image = global::Bloom.Properties.Resources.BloomPack64x64; + this._L10NSharpExtender.SetLocalizableToolTip(this.pictureBox1, null); + this._L10NSharpExtender.SetLocalizationComment(this.pictureBox1, null); + this._L10NSharpExtender.SetLocalizingId(this.pictureBox1, "BloomPackInstallDialog.pictureBox1"); this.pictureBox1.Location = new System.Drawing.Point(12, 12); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(67, 68); @@ -51,6 +56,9 @@ private void InitializeComponent() // // _okButton // + this._L10NSharpExtender.SetLocalizableToolTip(this._okButton, null); + this._L10NSharpExtender.SetLocalizationComment(this._okButton, null); + this._L10NSharpExtender.SetLocalizingId(this._okButton, "Common.OKButton"); this._okButton.Location = new System.Drawing.Point(317, 126); this._okButton.Name = "_okButton"; this._okButton.Size = new System.Drawing.Size(75, 23); @@ -67,6 +75,10 @@ private void InitializeComponent() this._message.BorderStyle = System.Windows.Forms.BorderStyle.None; this._message.Enabled = false; this._message.Font = new System.Drawing.Font("Segoe UI", 9F); + this._message.ForeColor = System.Drawing.SystemColors.ControlText; + this._L10NSharpExtender.SetLocalizableToolTip(this._message, null); + this._L10NSharpExtender.SetLocalizationComment(this._message, null); + this._L10NSharpExtender.SetLocalizingId(this._message, "BloomPackInstallDialog._message"); this._message.Location = new System.Drawing.Point(96, 12); this._message.Multiline = true; this._message.Name = "_message"; @@ -78,6 +90,9 @@ private void InitializeComponent() // _errorImage // this._errorImage.Image = global::Bloom.Properties.Resources.Error70x70; + this._L10NSharpExtender.SetLocalizableToolTip(this._errorImage, null); + this._L10NSharpExtender.SetLocalizationComment(this._errorImage, null); + this._L10NSharpExtender.SetLocalizingId(this._errorImage, "BloomPackInstallDialog._errorImage"); this._errorImage.Location = new System.Drawing.Point(12, 106); this._errorImage.Name = "_errorImage"; this._errorImage.Size = new System.Drawing.Size(42, 43); @@ -98,6 +113,11 @@ private void InitializeComponent() this._startupTimer.Enabled = true; this._startupTimer.Tick += new System.EventHandler(this._startupTimer_Tick); // + // _L10NSharpExtender + // + this._L10NSharpExtender.LocalizationManagerId = "Bloom"; + this._L10NSharpExtender.PrefixForNewItems = "BloomPackInstallDialog"; + // // BloomPackInstallDialog // this.AcceptButton = this._okButton; @@ -109,12 +129,16 @@ private void InitializeComponent() this.Controls.Add(this._okButton); this.Controls.Add(this.pictureBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this._L10NSharpExtender.SetLocalizableToolTip(this, null); + this._L10NSharpExtender.SetLocalizationComment(this, null); + this._L10NSharpExtender.SetLocalizingId(this, "BloomPackInstallDialog.BloomPackInstallation"); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "BloomPackInstallDialog"; this.Text = "Bloom Pack Installation"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorImage)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -128,5 +152,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox _errorImage; private System.ComponentModel.BackgroundWorker _backgroundWorker; private System.Windows.Forms.Timer _startupTimer; + private L10NSharp.UI.L10NSharpExtender _L10NSharpExtender; } } \ No newline at end of file diff --git a/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.cs b/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.cs index 635de9c83060..afc53ed236f6 100644 --- a/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.cs +++ b/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.cs @@ -36,7 +36,8 @@ private void BeginInstall() { if (!File.Exists(_path)) { - Palaso.Reporting.ErrorReport.NotifyUserOfProblem("{0} does not exist", _path); + string msg = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.DoesNotExist", "{0} does not exist"); + ErrorReport.NotifyUserOfProblem(msg, _path); return; } using (var zip = new ZipFile(_path)) @@ -48,14 +49,15 @@ private void BeginInstall() if (Directory.Exists(destinationFolder)) { Logger.WriteEvent("BloomPack already exists, asking..."); - var msg = - string.Format( - "This computer already has a Bloom collection named '{0}'. Do you want to replace it with the one from this BloomPack?", - _folderName); - if (DialogResult.OK != MessageBox.Show(msg, "BloomPack Installer", MessageBoxButtons.OKCancel)) + string title = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.BloomPackInstaller", + "BloomPack Installer", "Displayed as the message box title"); + string msg = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.Replace", + "This computer already has a Bloom collection named '{0}'. Do you want to replace it with the one from this BloomPack?"); + msg = string.Format(msg, _folderName); + if (DialogResult.OK != MessageBox.Show(msg, title, MessageBoxButtons.OKCancel)) { - _message.Text = "The Bloom collection will not be installed."; - _okButton.Text = "&Cancel"; + _message.Text = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.NotInstalled", "The Bloom collection will not be installed."); + _okButton.Text = L10NSharp.LocalizationManager.GetString("Common.CancelButton", "&Cancel"); return; } try @@ -65,9 +67,8 @@ private void BeginInstall() } catch (Exception error) { - throw new ApplicationException(string.Format( - "Bloom was not able to remove the existing copy of '{0}'. Quit Bloom if it is running & try again. Otherwise, try again after restarting your computer.", - destinationFolder), error); + string text = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.UnableToReplace", "Bloom was not able to remove the existing copy of '{0}'. Quit Bloom if it is running & try again. Otherwise, try again after restarting your computer."); + throw new ApplicationException(string.Format(text, destinationFolder), error); } } zip.Close(); @@ -107,10 +108,11 @@ private string GetRootFolderName(ZipFile zip) var parts = zipEntry.Name.Split(new[] { '/', '\\' }); if (fileName != null && fileName != parts[0]) { - string msg = "Bloom Packs should have only a single collection folder at the top level of the zip file."; + string msg = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.SingleCollectionFolder", + "Bloom Packs should have only a single collection folder at the top level of the zip file."); _message.Text = msg; pictureBox1.Image = _errorImage.Image; - _okButton.Text = "&Cancel"; + _okButton.Text = L10NSharp.LocalizationManager.GetString("Common.CancelButton", "&Cancel"); return null; } fileName = parts[0]; @@ -196,17 +198,17 @@ private void _backgroundWorker_RunWorkerCompleted(object sender, RunWorkerComple _errorImage.Visible = true; _okButton.Text = L10NSharp.LocalizationManager.GetString("Common.CancelButton","&Cancel"); DesktopAnalytics.Analytics.ReportException(e.Error); - Palaso.Reporting.ErrorReport.NotifyUserOfProblem(e.Error, _message.Text); + ErrorReport.NotifyUserOfProblem(e.Error, _message.Text); return; } var allDone = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.BloomPackInstalled", - "The {0} Collection is now ready to use on this computer."); + "The {0} Collection is now ready to use on this computer."); _message.Text = string.Format(allDone, _folderName); if (Process.GetProcesses().Count(p => p.ProcessName.Contains("Bloom")) > 1) { - _message.Text += System.Environment.NewLine + System.Environment.NewLine - + L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.MustRestartToSee", - "Bloom is already running, but the contents will not show up until the next time you run Bloom"); + _message.Text += Environment.NewLine + Environment.NewLine + + L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.MustRestartToSee", + "Bloom is already running, but the contents will not show up until the next time you run Bloom"); } //Analytics.Track("Install BloomPack"); } diff --git a/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.resx b/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.resx index d8fac6c82378..9ba5491dcdd6 100644 --- a/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.resx +++ b/src/BloomExe/Collection/BloomPack/BloomPackInstallDialog.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 323, 17 + 141, 21 diff --git a/src/BloomExe/Program.cs b/src/BloomExe/Program.cs index 1c66fa63489f..24e25d28105a 100644 --- a/src/BloomExe/Program.cs +++ b/src/BloomExe/Program.cs @@ -98,6 +98,9 @@ static void Main(string[] args) { if (args.Length == 1 && args[0].ToLower().EndsWith(".bloompack")) { + SetUpErrorHandling(); + _applicationContainer = new ApplicationContainer(); + SetUpLocalization(); var path = args[0]; // This allows local links to bloom packs. if (path.ToLowerInvariant().StartsWith("bloom://"))