# HG changeset patch # User IBBoard # Date 1293656163 0 # Node ID b0089e8757544d48c7ff44ebc8b7f4cbefcfee79 # Parent 40857cfb309b5d7b024699eab8634f1de52dd44b Re #308: Make GTK# UI translatable * Make FrmNewUnit translatable diff -r 40857cfb309b -r b0089e875754 FrmNewUnit.cs --- a/FrmNewUnit.cs Wed Dec 29 19:54:00 2010 +0000 +++ b/FrmNewUnit.cs Wed Dec 29 20:56:03 2010 +0000 @@ -9,6 +9,7 @@ using IBBoard.WarFoundry.API.Objects; using IBBoard.WarFoundry.API.Requirements; using log4net; +using IBBoard.Lang; namespace IBBoard.WarFoundry.GUI.GTK { @@ -17,14 +18,15 @@ private ILog logger = LogManager.GetLogger(typeof(FrmNewUnit)); private UnitType unitType; private Army unitArmy; + private Category cat; - public FrmNewUnit(Race race, Category cat, Army army) + public FrmNewUnit(Race race, Category category, Army army) { this.Build(); unitArmy = army; + cat = category; TreeViewColumn unitTypeColumn = new TreeViewColumn(); - unitTypeColumn.Title = "Unit Type"; CellRendererText unitTypeCell = new CellRendererText(); unitTypeColumn.PackStart(unitTypeCell, true); lstUnitTypes.AppendColumn(unitTypeColumn); @@ -41,6 +43,15 @@ lstUnitTypes.Model = store; lstUnitTypes.Selection.Changed += new EventHandler(OnSelectionChanged); + Translate(); + } + + protected override void Translate() + { + base.Translate(); + lstUnitTypes.Columns[0].Title = Translation.GetTranslation("frmNewUnitNewUnitColumn", "unit type"); + Title = Translation.GetTranslation(Name, "Create new unit", cat.Name); + ControlTranslator.TranslateButtons(bttnCreate, bttnCancel); } private void RenderUnitTypeName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) @@ -80,7 +91,7 @@ if (type != null) { - buttonOk.Sensitive = true; + bttnCreate.Sensitive = true; List fails = unitArmy.CanAddUnitType(type); lblNewUnitWarning.Visible = (fails != null); @@ -92,7 +103,7 @@ } else { - buttonOk.Sensitive = false; + bttnCreate.Sensitive = false; lblNewUnitWarning.Visible = false; } } diff -r 40857cfb309b -r b0089e875754 gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewUnit.cs --- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewUnit.cs Wed Dec 29 19:54:00 2010 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewUnit.cs Wed Dec 29 20:56:03 2010 +0000 @@ -6,12 +6,12 @@ { private global::Gtk.VBox vbox2; private global::Gtk.HBox hbox1; - private global::Gtk.Label label1; + private global::IBBoard.GtkSharp.Translatable.TranslatableLabel lblUnitType; private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.TreeView lstUnitTypes; private global::Gtk.Label lblNewUnitWarning; - private global::Gtk.Button buttonCancel; - private global::Gtk.Button buttonOk; + private global::Gtk.Button bttnCancel; + private global::Gtk.Button bttnCreate; protected virtual void Build() { @@ -37,11 +37,11 @@ this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; // Container child hbox1.Gtk.Box+BoxChild - this.label1 = new global::Gtk.Label(); - this.label1.Name = "label1"; - this.label1.LabelProp = global::Mono.Unix.Catalog.GetString("Unit Type:"); - this.hbox1.Add(this.label1); - global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.label1])); + this.lblUnitType = new global::IBBoard.GtkSharp.Translatable.TranslatableLabel(); + this.lblUnitType.Name = "lblUnitType"; + this.lblUnitType.LabelProp = global::Mono.Unix.Catalog.GetString("unit type"); + this.hbox1.Add(this.lblUnitType); + global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.lblUnitType])); w2.Position = 0; w2.Expand = false; w2.Fill = false; @@ -86,28 +86,28 @@ w8.BorderWidth = ((uint)(5)); w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild - this.buttonCancel = new global::Gtk.Button(); - this.buttonCancel.CanDefault = true; - this.buttonCancel.CanFocus = true; - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.UseStock = true; - this.buttonCancel.UseUnderline = true; - this.buttonCancel.Label = "gtk-cancel"; - this.AddActionWidget(this.buttonCancel, -6); - global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8[this.buttonCancel])); + this.bttnCancel = new global::Gtk.Button(); + this.bttnCancel.CanDefault = true; + this.bttnCancel.CanFocus = true; + this.bttnCancel.Name = "bttnCancel"; + this.bttnCancel.UseStock = true; + this.bttnCancel.UseUnderline = true; + this.bttnCancel.Label = "gtk-cancel"; + this.AddActionWidget(this.bttnCancel, -6); + global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8[this.bttnCancel])); w9.Expand = false; w9.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild - this.buttonOk = new global::Gtk.Button(); - this.buttonOk.Sensitive = false; - this.buttonOk.CanDefault = true; - this.buttonOk.CanFocus = true; - this.buttonOk.Name = "buttonOk"; - this.buttonOk.UseStock = true; - this.buttonOk.UseUnderline = true; - this.buttonOk.Label = "gtk-ok"; - this.AddActionWidget(this.buttonOk, -5); - global::Gtk.ButtonBox.ButtonBoxChild w10 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8[this.buttonOk])); + this.bttnCreate = new global::Gtk.Button(); + this.bttnCreate.Sensitive = false; + this.bttnCreate.CanDefault = true; + this.bttnCreate.CanFocus = true; + this.bttnCreate.Name = "bttnCreate"; + this.bttnCreate.UseStock = true; + this.bttnCreate.UseUnderline = true; + this.bttnCreate.Label = "gtk-ok"; + this.AddActionWidget(this.bttnCreate, -5); + global::Gtk.ButtonBox.ButtonBoxChild w10 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8[this.bttnCreate])); w10.Position = 1; w10.Expand = false; w10.Fill = false; @@ -119,8 +119,8 @@ this.DefaultHeight = 318; this.Show(); this.lstUnitTypes.RowActivated += new global::Gtk.RowActivatedHandler(this.OnRowActivated); - this.buttonCancel.Activated += new global::System.EventHandler(this.OnButtonCancelActivated); - this.buttonOk.Clicked += new global::System.EventHandler(this.OnButtonOkClicked); + this.bttnCancel.Activated += new global::System.EventHandler(this.OnButtonCancelActivated); + this.bttnCreate.Clicked += new global::System.EventHandler(this.OnButtonOkClicked); } } } diff -r 40857cfb309b -r b0089e875754 gtk-gui/gui.stetic --- a/gtk-gui/gui.stetic Wed Dec 29 19:54:00 2010 +0000 +++ b/gtk-gui/gui.stetic Wed Dec 29 20:56:03 2010 +0000 @@ -575,9 +575,9 @@ 6 - + - Unit Type: + unit type 0 @@ -645,7 +645,7 @@ 2 End - + True True @@ -662,7 +662,7 @@ - + False True diff -r 40857cfb309b -r b0089e875754 translations/en.translation --- a/translations/en.translation Wed Dec 29 19:54:00 2010 +0000 +++ b/translations/en.translation Wed Dec 29 20:56:03 2010 +0000 @@ -30,7 +30,7 @@ Races: Army name: Army size: -Create army +Create Cancel Create unit Unit types: @@ -41,6 +41,8 @@ Create Army Race Add New {0} Choice +Unit Type +Unit Type: About WarFoundry Export army Cancel