changeset 143:28105d9c2b25

Re #265: Add language preference UI * Make unit form and army tree translate on translation language change Army tree title translation still seems patchy
author IBBoard <dev@ibboard.co.uk>
date Wed, 14 Apr 2010 19:59:35 +0000
parents e0af96397e26
children 4023a9bdcb8b
files FrmArmyTree.cs FrmUnit.cs
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/FrmArmyTree.cs	Wed Apr 14 19:42:45 2010 +0000
+++ b/FrmArmyTree.cs	Wed Apr 14 19:59:35 2010 +0000
@@ -50,7 +50,12 @@
 			nodes = new Dictionary<string, TreeNode>();
 			this.Name = "ArmyTree";			
 			WarFoundryCore.ArmyChanged+= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged);
+			TranslateForm();
+			Translation.TranslationChanged+=new MethodInvoker(TranslateForm);
+		}
 
+		private void TranslateForm()
+		{
 			foreach (Control ctrl in Controls)
 			{
 				ControlTranslator.TranslateControl(ctrl);
--- a/FrmUnit.cs	Wed Apr 14 19:42:45 2010 +0000
+++ b/FrmUnit.cs	Wed Apr 14 19:59:35 2010 +0000
@@ -56,9 +56,8 @@
 			// Required for Windows Form Designer support
 			//
 			InitializeComponent();
-			ControlTranslator.TranslateControl(this);
-			tbUnitName.Text = unit.Name;
-			Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name);
+			TranslateForm();
+			Translation.TranslationChanged += new MethodInvoker(TranslateForm);
 			unit.NameChanged += new StringValChangedDelegate(unit_NameChanged);
 			unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged);
 			unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
@@ -77,6 +76,13 @@
 			SetWeapons();
 		}
 
+		private void TranslateForm()
+		{
+			ControlTranslator.TranslateControl(this);
+			tbUnitName.Text = unit.Name;
+			Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name);
+		}
+
 		void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue)
 		{
 			SetPointsValueText();