Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
changeset 87:4c5c8f91937a
Re #179: Make sure that translations are used throughout UI
* Translate context menu on army tree
* Translate warning messages in main form
* Add translation strings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 31 Oct 2009 21:09:10 +0000 |
parents | a9d80b4984bc |
children | 340e711ca4c3 |
files | FrmArmyTree.cs FrmMain.cs translations/en.translation |
diffstat | 3 files changed, 31 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmArmyTree.cs Sat Oct 31 20:57:20 2009 +0000 +++ b/FrmArmyTree.cs Sat Oct 31 21:09:10 2009 +0000 @@ -26,8 +26,8 @@ private IContainer components; private Dictionary<string, TreeNode> nodes; private System.Windows.Forms.ContextMenu contextMenu; - private IBBMenuItem miDelete; - private IBBMenuItem miEdit; + private IBBMenuItem miDeleteUnit; + private IBBMenuItem miEditUnit; private ObjectAddDelegate UnitAddedMethod; private ObjectRemoveDelegate UnitRemovedMethod; @@ -92,8 +92,8 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmArmyTree)); this.contextMenu = new System.Windows.Forms.ContextMenu(); - this.miEdit = new IBBoard.Windows.Forms.IBBMenuItem(); - this.miDelete = new IBBoard.Windows.Forms.IBBMenuItem(); + this.miEditUnit = new IBBoard.Windows.Forms.IBBMenuItem(); + this.miDeleteUnit = new IBBoard.Windows.Forms.IBBMenuItem(); this.imageList = new System.Windows.Forms.ImageList(this.components); this.toolBar = new System.Windows.Forms.ToolBar(); this.bttnEdit = new IBBoard.Windows.Forms.IBBToolBarButton(); @@ -104,21 +104,23 @@ // contextMenu // this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.miEdit, - this.miDelete}); + this.miEditUnit, + this.miDeleteUnit}); this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); // // miEdit // - this.miEdit.Index = 0; - this.miEdit.Text = "&edit unit"; - this.miEdit.Click += new System.EventHandler(this.miEdit_Click); + this.miEditUnit.Index = 0; + this.miEditUnit.Text = "&edit unit"; + this.miEditUnit.Click += new System.EventHandler(this.miEdit_Click); + this.miEditUnit.Name = "miEditUnit"; // // miDelete // - this.miDelete.Index = 1; - this.miDelete.Text = "&delete unit"; - this.miDelete.Click += new System.EventHandler(this.miDelete_Click); + this.miDeleteUnit.Index = 1; + this.miDeleteUnit.Text = "&delete unit"; + this.miDeleteUnit.Click += new System.EventHandler(this.miDelete_Click); + this.miDeleteUnit.Name = "miDeleteUnit"; // // imageList //
--- a/FrmMain.cs Sat Oct 31 20:57:20 2009 +0000 +++ b/FrmMain.cs Sat Oct 31 21:09:10 2009 +0000 @@ -580,11 +580,11 @@ } catch (RequiredDataMissingException ex) { - MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "Invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (InvalidFileException ex) { - MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "Invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } } @@ -623,13 +623,13 @@ catch (RequiredDataMissingException ex) { log.Error(ex); - MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidArmyFileBoxTitle", "invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } catch (InvalidFileException ex) { log.Error(ex); - MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidArmyFileBoxTitle", "invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } @@ -652,7 +652,9 @@ if (CommandStack.IsDirty()) { - DialogResult dr = MessageBox.Show(this, "The army \""+CurrentArmy.Name+"\" has been modified.\r\nSave changes before closing army?", "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); + string saveChanges = Translation.GetTranslation("SaveChangesQuestion", "the army \"{0}\" has been modified\r\nsave changes before closing army?", CurrentArmy.Name); + string saveChangesTitle = Translation.GetTranslation("SaveChangesTitle", "unsaved changes"); + DialogResult dr = MessageBox.Show(this, saveChanges, saveChangesTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); if (dr == DialogResult.Yes) { @@ -749,7 +751,7 @@ } else { - MessageBox.Show(this, Translation.GetTranslation("SaveFailed"), Translation.GetTranslation("SaveFailedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, Translation.GetTranslation("SaveFailed", "file save failed - check log for details"), Translation.GetTranslation("SaveFailedTitle", "file save failed"), MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
--- a/translations/en.translation Sat Oct 31 20:57:20 2009 +0000 +++ b/translations/en.translation Sat Oct 31 21:09:10 2009 +0000 @@ -21,6 +21,8 @@ <translation id="bttnOpenArmy">Open army</translation> <translation id="bttnSaveArmy">Save army</translation> <translation id="ArmyTree">Army Tree</translation> + <translation id="miDeleteUnit">&Delete unit</translation> + <translation id="miEditUnit">&Edit unit</translation> <translation id="openArmyDialog">Open Army</translation> <translation id="saveArmyDialog">Save Army</translation> <translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> @@ -58,4 +60,11 @@ <translation id="bttnRemoveWeapon">Remove</translation> <translation id="bttnReplaceWeapon">Replace</translation> <translation id="bttnEditWeapon">Edit</translation> + <translation id="InvalidRaceFileBoxTitle">Invalid race file</translation> + <translation id="InvalidArmyFileBoxTitle">Invalid army file</translation> + <translation id="SaveChangesQuestion">The army "{0}" has been modified. +Save changes before closing army?</translation> + <translation id="SaveChangesTitle">Unsaved changes</translation> + <translation id="SaveFailed">WarFoundry was unable to save the file. Please check the log for more details</translation> + <translation id="SaveFailedTitle">File save failed</translation> </translations> \ No newline at end of file