Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
changeset 85:bfb29a60b802
Re #308: Make GTK# UI translatable
* Translate the bits of FrmNewArmy that can't be translated via cascade
* Set up label names and translations for translating (need to get Stetic to use TranslatableLabel)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 29 Dec 2010 16:56:55 +0000 |
parents | 9db2112b31d7 |
children | 9515b57ba752 |
files | FrmNewArmy.cs gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs gtk-gui/gui.stetic translations/en.translation |
diffstat | 4 files changed, 67 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmNewArmy.cs Wed Dec 29 16:32:15 2010 +0000 +++ b/FrmNewArmy.cs Wed Dec 29 16:56:55 2010 +0000 @@ -36,7 +36,7 @@ raceColumn.PackStart(raceCell, true); lstRaces.AppendColumn(raceColumn); raceColumn.SetCellDataFunc(raceCell, GtkWarFoundryUtil.RenderWarFoundryObjectName); - ControlTranslator.TranslateWidget(this); + Translate(); if (gameSystem != null) { @@ -48,6 +48,13 @@ } } + protected override void Translate() + { + base.Translate(); + bttnCreate.Label = Translation.GetTranslation("bttnCreate", "create"); + bttnCancel.Label = Translation.GetTranslation("bttnCancel", "cancel"); + } + protected virtual void OnSelectionChanged(object o, EventArgs e) { logger.Debug("Race selection changed");
--- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs Wed Dec 29 16:32:15 2010 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmNewArmy.cs Wed Dec 29 16:56:55 2010 +0000 @@ -9,10 +9,10 @@ private global::Gtk.TreeView lstRaces; private global::Gtk.HBox hbox2; private global::Gtk.SpinButton sbPointsValue; - private global::Gtk.Label label1; - private global::Gtk.Label label2; - private global::Gtk.Label label3; - private global::Gtk.Label label4; + private global::Gtk.Label lblArmyName; + private global::Gtk.Label lblArmySize; + private global::Gtk.Label lblGameSystem; + private global::Gtk.Label lblRace; private global::Gtk.ComboBoxEntry systemCombo; private global::Gtk.Entry txtArmyName; private global::Gtk.Button bttnCancel; @@ -86,41 +86,41 @@ w5.XOptions = ((global::Gtk.AttachOptions)(4)); w5.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild - this.label1 = new global::Gtk.Label(); - this.label1.Name = "label1"; - this.label1.LabelProp = global::Mono.Unix.Catalog.GetString("Race"); - this.table1.Add(this.label1); - global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table1[this.label1])); - w6.TopAttach = ((uint)(1)); - w6.BottomAttach = ((uint)(2)); + this.lblArmyName = new global::Gtk.Label(); + this.lblArmyName.Name = "lblArmyName"; + this.lblArmyName.LabelProp = global::Mono.Unix.Catalog.GetString("army name"); + this.table1.Add(this.lblArmyName); + global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table1[this.lblArmyName])); + w6.TopAttach = ((uint)(2)); + w6.BottomAttach = ((uint)(3)); w6.XOptions = ((global::Gtk.AttachOptions)(4)); w6.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild - this.label2 = new global::Gtk.Label(); - this.label2.Name = "label2"; - this.label2.LabelProp = global::Mono.Unix.Catalog.GetString("Army name"); - this.table1.Add(this.label2); - global::Gtk.Table.TableChild w7 = ((global::Gtk.Table.TableChild)(this.table1[this.label2])); - w7.TopAttach = ((uint)(2)); - w7.BottomAttach = ((uint)(3)); + this.lblArmySize = new global::Gtk.Label(); + this.lblArmySize.Name = "lblArmySize"; + this.lblArmySize.LabelProp = global::Mono.Unix.Catalog.GetString("points value"); + this.table1.Add(this.lblArmySize); + global::Gtk.Table.TableChild w7 = ((global::Gtk.Table.TableChild)(this.table1[this.lblArmySize])); + w7.TopAttach = ((uint)(3)); + w7.BottomAttach = ((uint)(4)); w7.XOptions = ((global::Gtk.AttachOptions)(4)); w7.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild - this.label3 = new global::Gtk.Label(); - this.label3.Name = "label3"; - this.label3.LabelProp = global::Mono.Unix.Catalog.GetString("Points value"); - this.table1.Add(this.label3); - global::Gtk.Table.TableChild w8 = ((global::Gtk.Table.TableChild)(this.table1[this.label3])); - w8.TopAttach = ((uint)(3)); - w8.BottomAttach = ((uint)(4)); + this.lblGameSystem = new global::Gtk.Label(); + this.lblGameSystem.Name = "lblGameSystem"; + this.lblGameSystem.LabelProp = global::Mono.Unix.Catalog.GetString("game system"); + this.table1.Add(this.lblGameSystem); + global::Gtk.Table.TableChild w8 = ((global::Gtk.Table.TableChild)(this.table1[this.lblGameSystem])); w8.XOptions = ((global::Gtk.AttachOptions)(4)); w8.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild - this.label4 = new global::Gtk.Label(); - this.label4.Name = "label4"; - this.label4.LabelProp = global::Mono.Unix.Catalog.GetString("game system"); - this.table1.Add(this.label4); - global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1[this.label4])); + this.lblRace = new global::Gtk.Label(); + this.lblRace.Name = "lblRace"; + this.lblRace.LabelProp = global::Mono.Unix.Catalog.GetString("race"); + this.table1.Add(this.lblRace); + global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1[this.lblRace])); + w9.TopAttach = ((uint)(1)); + w9.BottomAttach = ((uint)(2)); w9.XOptions = ((global::Gtk.AttachOptions)(4)); w9.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild
--- a/gtk-gui/gui.stetic Wed Dec 29 16:32:15 2010 +0000 +++ b/gtk-gui/gui.stetic Wed Dec 29 16:56:55 2010 +0000 @@ -377,28 +377,9 @@ </packing> </child> <child> - <widget class="Gtk.Label" id="label1"> + <widget class="Gtk.Label" id="lblArmyName"> <property name="MemberName" /> - <property name="LabelProp" translatable="yes">Race</property> - </widget> - <packing> - <property name="TopAttach">1</property> - <property name="BottomAttach">2</property> - <property name="AutoSize">True</property> - <property name="XOptions">Fill</property> - <property name="YOptions">Fill</property> - <property name="XExpand">False</property> - <property name="XFill">True</property> - <property name="XShrink">False</property> - <property name="YExpand">False</property> - <property name="YFill">True</property> - <property name="YShrink">False</property> - </packing> - </child> - <child> - <widget class="Gtk.Label" id="label2"> - <property name="MemberName" /> - <property name="LabelProp" translatable="yes">Army name</property> + <property name="LabelProp" translatable="yes">army name</property> </widget> <packing> <property name="TopAttach">2</property> @@ -415,9 +396,9 @@ </packing> </child> <child> - <widget class="Gtk.Label" id="label3"> + <widget class="Gtk.Label" id="lblArmySize"> <property name="MemberName" /> - <property name="LabelProp" translatable="yes">Points value</property> + <property name="LabelProp" translatable="yes">points value</property> </widget> <packing> <property name="TopAttach">3</property> @@ -434,7 +415,7 @@ </packing> </child> <child> - <widget class="Gtk.Label" id="label4"> + <widget class="Gtk.Label" id="lblGameSystem"> <property name="MemberName" /> <property name="LabelProp" translatable="yes">game system</property> </widget> @@ -451,6 +432,25 @@ </packing> </child> <child> + <widget class="Gtk.Label" id="lblRace"> + <property name="MemberName" /> + <property name="LabelProp" translatable="yes">race</property> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> <widget class="Gtk.ComboBoxEntry" id="systemCombo"> <property name="MemberName" /> <property name="IsTextCombo">True</property>
--- a/translations/en.translation Wed Dec 29 16:32:15 2010 +0000 +++ b/translations/en.translation Wed Dec 29 16:56:55 2010 +0000 @@ -26,19 +26,16 @@ <translation id="armyCategoryColumnTitle">Army Categories</translation> <translation id="menuRemoveUnit">Remove Unit</translation> <translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> -<translation id="bttnSelectRace">Create army</translation> +<translation id="lblGameSystem">Game systems:</translation> +<translation id="lblRaceList">Races:</translation> +<translation id="lblArmyName">Army name:</translation> +<translation id="lblArmySize">Army size:</translation> +<translation id="bttnCreate">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="statusPanelPoints">{0} pts / {1} pts</translation> <translation id="IBBoard.WarFoundry.GUI.GTK.FrmNewArmy">Create Army</translation>