Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
changeset 80:c243b043aa62
Re #179: Make sure that translations are used throughout UI
* Put names back on menu items
* Add some more translation calls
* Make some extra items translatable
* Update English translation file
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 21 Oct 2009 20:11:18 +0000 |
parents | e3488dd61a21 |
children | e749b748e7ea |
files | FrmEditUnitEquipment.cs FrmMain.cs FrmNewArmy.cs UI/EquipmentAmountControl.cs translations/en.translation |
diffstat | 5 files changed, 177 insertions(+), 171 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmEditUnitEquipment.cs Sun Oct 11 19:57:13 2009 +0000 +++ b/FrmEditUnitEquipment.cs Wed Oct 21 20:11:18 2009 +0000 @@ -7,6 +7,8 @@ using System.ComponentModel; using System.Windows.Forms; using IBBoard.Commands; +using IBBoard.Windows.Forms; +using IBBoard.Windows.Forms.I18N; using IBBoard.WarFoundry.API; using IBBoard.WarFoundry.API.Commands; using IBBoard.WarFoundry.API.Objects; @@ -21,9 +23,9 @@ private Unit unit; private UnitEquipmentItem equipItem; private CommandStack commandStack; - private System.Windows.Forms.Label lblAmount; - private System.Windows.Forms.Button bttnCancel; - private System.Windows.Forms.Button bttnOkay; + private IBBLabel lblAmount; + private IBBButton bttnCancel; + private IBBButton bttnOkay; private IBBoard.WarFoundry.GUI.WinForms.UI.EquipmentAmountControl equipmentAmount; /// <summary> /// Required designer variable. @@ -36,6 +38,7 @@ this.unit = unit; this.equipItem = equipItem; InitializeComponent(); + ControlTranslator.TranslateControls(Controls); this.Text = equipItem.Name + " for " + unit.Name; equipmentAmount.SetUnit(unit); equipmentAmount.SetUnitEquipmentItem(equipItem); @@ -64,9 +67,9 @@ /// </summary> private void InitializeComponent() { - this.lblAmount = new System.Windows.Forms.Label(); - this.bttnCancel = new System.Windows.Forms.Button(); - this.bttnOkay = new System.Windows.Forms.Button(); + this.lblAmount = new IBBLabel(); + this.bttnCancel = new IBBButton(); + this.bttnOkay = new IBBButton(); this.equipmentAmount = new IBBoard.WarFoundry.GUI.WinForms.UI.EquipmentAmountControl(); this.SuspendLayout(); //
--- a/FrmMain.cs Sun Oct 11 19:57:13 2009 +0000 +++ b/FrmMain.cs Wed Oct 21 20:11:18 2009 +0000 @@ -87,8 +87,8 @@ private System.Windows.Forms.ContextMenu redoMenu; private IBBoard.Windows.Forms.ColorableStatusBar statusBar; private System.Windows.Forms.Timer statusBarTimer; - private MenuItem miExportArmyAs; - private MenuItem miExportArmyAsBasicHTML; + private IBBoard.Windows.Forms.IBBMenuItem miExportArmyAs; + private IBBoard.Windows.Forms.IBBMenuItem miExportArmyAsBasicHTML; private System.Windows.Forms.Panel pnlRight; /// <summary> @@ -133,21 +133,8 @@ //pnlRight.Top = toolBar.Height + 5; //pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3; - foreach (Control ctrl in Controls) - { - ControlTranslator.TranslateControl(ctrl); - } - - foreach(Component comp in components.Components) - { - ControlTranslator.TranslateComponent(comp); - } - - foreach (IBBMenuItem mi in Menu.MenuItems) - { - ControlTranslator.TranslateComponent(mi); - } - + ControlTranslator.TranslateControls(Controls); + ControlTranslator.TranslateComponents(components.Components); ControlTranslator.TranslateComponent(openArmyDialog); ControlTranslator.TranslateComponent(saveArmyDialog); unitWindows = new Dictionary<string, FrmUnit>(); @@ -247,8 +234,8 @@ this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem(); this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem(); this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); - this.miExportArmyAs = new System.Windows.Forms.MenuItem(); - this.miExportArmyAsBasicHTML = new System.Windows.Forms.MenuItem(); + this.miExportArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); + this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBMenuItem(); this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); this.miSep2 = new System.Windows.Forms.MenuItem(); this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); @@ -396,18 +383,21 @@ this.miSep3, this.miExit}); this.menuFile.Text = "&file"; + this.menuFile.Name = "menuFile"; // // miNewArmy // this.miNewArmy.Index = 0; this.miNewArmy.Text = "&new army"; this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); + this.miNewArmy.Name = "miNewArmy"; // // miOpenArmy // this.miOpenArmy.Index = 1; this.miOpenArmy.Text = "&open army"; this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); + this.miOpenArmy.Name = "miOpenArmy"; // // miSaveArmy // @@ -415,6 +405,7 @@ this.miSaveArmy.Index = 2; this.miSaveArmy.Text = "&save army"; this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); + this.miSaveArmy.Name = "miSaveArmy"; // // miSaveArmyAs // @@ -422,6 +413,7 @@ this.miSaveArmyAs.Index = 3; this.miSaveArmyAs.Text = "save army &as..."; this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); + this.miSaveArmyAs.Name = "miSaveArmyAs"; // // miExportArmyAs // @@ -430,12 +422,14 @@ this.miExportArmyAs.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.miExportArmyAsBasicHTML}); this.miExportArmyAs.Text = "export army as..."; + this.miExportArmyAs.Name = "miExportArmyAs"; // // miExportArmyAsBasicHTML // this.miExportArmyAsBasicHTML.Index = 0; - this.miExportArmyAsBasicHTML.Text = "Basic HTML"; + this.miExportArmyAsBasicHTML.Text = "basic html"; this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); + this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; // // miCloseArmy // @@ -443,6 +437,7 @@ this.miCloseArmy.Index = 5; this.miCloseArmy.Text = "&close army"; this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); + this.miCloseArmy.Name = "miCloseArmy"; // // miSep2 // @@ -454,6 +449,7 @@ this.miReloadFiles.Index = 7; this.miReloadFiles.Text = "&reload files"; this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); + this.miReloadFiles.Name = "miReloadFiles"; // // miSep3 // @@ -465,6 +461,7 @@ this.miExit.Index = 9; this.miExit.Text = "e&xit"; this.miExit.Click += new System.EventHandler(this.miExit_Click); + this.miExit.Name = "miExit"; // // menuEdit // @@ -473,6 +470,7 @@ this.miUndo, this.miRedo}); this.menuEdit.Text = "&edit"; + this.menuEdit.Name = "menuEdit"; // // miUndo // @@ -480,6 +478,7 @@ this.miUndo.Index = 0; this.miUndo.Text = "&undo"; this.miUndo.Click += new System.EventHandler(this.miUndo_Click); + this.miUndo.Name = "miUndo"; // // miRedo // @@ -487,6 +486,7 @@ this.miRedo.Index = 1; this.miRedo.Text = "&redo"; this.miRedo.Click += new System.EventHandler(this.miRedo_Click); + this.miRedo.Name = "miRedo"; // // menuHelp // @@ -494,12 +494,14 @@ this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.miAbout}); this.menuHelp.Text = "&help"; + this.menuHelp.Name = "menuHelp"; // // miAbout // this.miAbout.Enabled = false; this.miAbout.Index = 0; this.miAbout.Text = "&about"; + this.miAbout.Name = "miAbout"; // // saveArmyDialog //
--- a/FrmNewArmy.cs Sun Oct 11 19:57:13 2009 +0000 +++ b/FrmNewArmy.cs Wed Oct 21 20:11:18 2009 +0000 @@ -1,49 +1,49 @@ -// This file (FrmNewArmy.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. -// -// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. - -using System; -using System.Drawing; -using System.ComponentModel; -using System.Windows.Forms; -using IBBoard; -using IBBoard.Lang; -using IBBoard.Windows.Forms; -using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Objects; +// This file (FrmNewArmy.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.ComponentModel; +using System.Windows.Forms; +using IBBoard; +using IBBoard.Lang; +using IBBoard.Windows.Forms; +using IBBoard.WarFoundry.API; +using IBBoard.WarFoundry.API.Objects; using IBBoard.Windows.Forms.I18N; -namespace IBBoard.WarFoundry.GUI.WinForms -{ - /// <summary> - /// Summary description for FrmNewArmy. - /// </summary> - public class FrmNewArmy : IBBForm - { - /// <summary> - /// Required designer variable. - /// </summary> - private System.ComponentModel.Container components = null; - private IBBoard.Windows.Forms.IBBButton bttnCancel; - private IBBoard.Windows.Forms.IBBLabel lblRaceList; - private IBBoard.Windows.Forms.IBBButton bttnSelectRace; - private System.Windows.Forms.ListBox lstRaces; - private IBBoard.Windows.Forms.IBBLabel lblArmyName; - private IBBoard.Windows.Forms.IBBLabel lblArmySize; +namespace IBBoard.WarFoundry.GUI.WinForms +{ + /// <summary> + /// Summary description for FrmNewArmy. + /// </summary> + public class FrmNewArmy : IBBForm + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.Container components = null; + private IBBoard.Windows.Forms.IBBButton bttnCancel; + private IBBoard.Windows.Forms.IBBLabel lblRaceList; + private IBBoard.Windows.Forms.IBBButton bttnSelectRace; + private System.Windows.Forms.ListBox lstRaces; + private IBBoard.Windows.Forms.IBBLabel lblArmyName; + private IBBoard.Windows.Forms.IBBLabel lblArmySize; private System.Windows.Forms.NumericUpDown armySize; - private Label lblGameSystem; - private ComboBox gameSystems; + private IBBLabel lblGameSystem; + private ComboBox gameSystems; private System.Windows.Forms.TextBox txtArmyName; private GameSystem system; private Race race; private string armyName; - private int maxPoints; - - public FrmNewArmy(GameSystem system) - { - InitializeComponent(); - + private int maxPoints; + + public FrmNewArmy(GameSystem system) + { + InitializeComponent(); + ControlTranslator.TranslateControl(this); foreach (GameSystem gameSystem in WarFoundryLoader.GetDefault().GetGameSystems()) @@ -54,7 +54,7 @@ if (WarFoundryCore.CurrentGameSystem != null) { gameSystems.SelectedItem = FrmMain.CurrentGameSystem; - } + } } private void SetRaces(GameSystem system) @@ -63,29 +63,29 @@ { lstRaces.Items.Add(race); } - } - - /// <summary> - /// Clean up any resources being used. - /// </summary> - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if(components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - #region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewArmy)); this.lstRaces = new System.Windows.Forms.ListBox(); @@ -96,7 +96,7 @@ this.txtArmyName = new System.Windows.Forms.TextBox(); this.lblArmySize = new IBBoard.Windows.Forms.IBBLabel(); this.armySize = new System.Windows.Forms.NumericUpDown(); - this.lblGameSystem = new System.Windows.Forms.Label(); + this.lblGameSystem = new IBBoard.Windows.Forms.IBBLabel(); this.gameSystems = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize) (this.armySize)).BeginInit(); this.SuspendLayout(); @@ -237,40 +237,40 @@ this.ResumeLayout(false); this.PerformLayout(); - } + } #endregion public GameSystem SelectedSystem { get { return system; } - } - - public Race SelectedRace - { - get { return race; } - } - - public string ArmyName - { - get { return armyName; } - } - - public int ArmySize - { - get { return maxPoints; } - } - - private void bttnCancel_Click(object sender, System.EventArgs e) - { - DialogResult = DialogResult.Cancel; - this.Close(); - } - - private void bttnSelectRace_Click(object sender, System.EventArgs e) - { + } + + public Race SelectedRace + { + get { return race; } + } + + public string ArmyName + { + get { return armyName; } + } + + public int ArmySize + { + get { return maxPoints; } + } + + private void bttnCancel_Click(object sender, System.EventArgs e) + { + DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void bttnSelectRace_Click(object sender, System.EventArgs e) + { DialogResult = DialogResult.OK; - SetValues(); - this.Close(); + SetValues(); + this.Close(); } private void SetValues() @@ -284,21 +284,21 @@ private GameSystem GetSelectedGameSystem() { return (GameSystem) gameSystems.SelectedItem; - } - - private void txtArmyName_TextChanged(object sender, System.EventArgs e) - { - setSelectRaceEnabledVal(); - } - - private void setSelectRaceEnabledVal() - { - bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0); - } - - private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) - { - setSelectRaceEnabledVal(); + } + + private void txtArmyName_TextChanged(object sender, System.EventArgs e) + { + setSelectRaceEnabledVal(); + } + + private void setSelectRaceEnabledVal() + { + bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0); + } + + private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) + { + setSelectRaceEnabledVal(); } private void gameSystems_SelectedValueChanged(object sender, EventArgs e) @@ -310,6 +310,6 @@ { SetRaces(selected); } - } - } -} + } + } +}
--- a/UI/EquipmentAmountControl.cs Sun Oct 11 19:57:13 2009 +0000 +++ b/UI/EquipmentAmountControl.cs Wed Oct 21 20:11:18 2009 +0000 @@ -5,7 +5,7 @@ using System.Data; using System.Text; using System.Windows.Forms; -using IBBoard.Lang; +using IBBoard.CustomMath; using IBBoard.WarFoundry.API; using IBBoard.WarFoundry.API.Objects;
--- a/translations/en.translation Sun Oct 11 19:57:13 2009 +0000 +++ b/translations/en.translation Wed Oct 21 20:11:18 2009 +0000 @@ -1,38 +1,39 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <translations xmlns="http://ibboard.co.uk/translation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" lang="en"> -<translation id="menuFile">&File</translation> -<translation id="menuEdit">&Edit</translation> -<translation id="menuHelp">&Help</translation> -<translation id="miNewArmy">&Create army</translation> -<translation id="miOpenArmy">&Open army</translation> -<translation id="miExit">E&xit</translation> -<translation id="miAbout">&About</translation> -<translation id="miSaveArmy">&Save army</translation> -<translation id="miSaveArmyAs">Save army &as...</translation> -<translation id="miCloseArmy">&Close army</translation> -<translation id="miChangeSystem">Change &game system</translation> -<translation id="miUndo">&Undo</translation> -<translation id="miRedo">&Redo</translation> -<translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> -<translation id="bttnSelectRace">Create army</translation> -<translation id="bttnCancel">Cancel</translation> -<translation id="bttnSelectUnit">Create unit</translation> -<translation id="lblUnitList">Unit types:</translation> -<translation id="lblRaceList">Races:</translation> -<translation id="lblArmyName">Army name:</translation> -<translation id="bttnSelectSystem">Select system</translation> -<translation id="lblSystemList">Game systems:</translation> -<translation id="FrmSelectSystem">Game system selection</translation> -<translation id="ArmyTree">Army tree</translation> -<translation id="FrmNewArmy">Create new army</translation> -<translation id="saveArmyDialog">Save army</translation> -<translation id="lblArmySize">Army size:</translation> -<translation id="defaultUnitName">Unit of {0} {1}</translation> -<translation id="bttnNewArmy">Create army</translation> -<translation id="bttnOpenArmy">Open army</translation> -<translation id="bttnSaveArmy">Save army</translation> -<translation id="statusPanelPoints">{0} pts / {1} pts</translation> -<translation id="miReloadFiles">&Reload files</translation> -<translation id="miDebugWindow">&Debug information</translation> -<translation id="FrmNewUnit">Add New {0} Choice</translation> + <translation id="menuFile">&File</translation> + <translation id="menuEdit">&Edit</translation> + <translation id="menuHelp">&Help</translation> + <translation id="miNewArmy">&Create army</translation> + <translation id="miOpenArmy">&Open army</translation> + <translation id="miExit">E&xit</translation> + <translation id="miAbout">&About</translation> + <translation id="miSaveArmy">&Save army</translation> + <translation id="miSaveArmyAs">Save army &as...</translation> + <translation id="miExportArmyAs">&Export army</translation> + <translation id="miExportArmyAsBasicHTML">Basic HTML</translation> + <translation id="miCloseArmy">&Close army</translation> + <translation id="miUndo">&Undo</translation> + <translation id="miRedo">&Redo</translation> + <translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> + <translation id="bttnSelectRace">Create army</translation> + <translation id="bttnOkay">OK</translation> + <translation id="bttnCancel">Cancel</translation> + <translation id="bttnSelectUnit">Create unit</translation> + <translation id="lblUnitList">Unit types:</translation> + <translation id="lblRaceList">Races:</translation> + <translation id="lblArmyName">Army name:</translation> + <translation id="lblGameSystem">Game systems:</translation> + <translation id="ArmyTree">Army Tree</translation> + <translation id="FrmNewArmy">Create new army</translation> + <translation id="openArmyDialog">Open Army</translation> + <translation id="saveArmyDialog">Save army</translation> + <translation id="lblArmySize">Army size:</translation> + <translation id="defaultUnitName">Unit of {0} {1}</translation> + <translation id="bttnNewArmy">Create army</translation> + <translation id="bttnOpenArmy">Open army</translation> + <translation id="bttnSaveArmy">Save army</translation> + <translation id="statusPanelPoints">{0} pts / {1} pts</translation> + <translation id="miReloadFiles">&Reload files</translation> + <translation id="FrmNewUnit">Add New {0} Choice</translation> + <translation id="lblAmount">Amount:</translation> </translations> \ No newline at end of file