diff FrmUnit.cs @ 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 18d607b0249b
children 51463bc1fb21
line wrap: on
line diff
--- 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();