Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
changeset 82:fb16ca1cb52b
Re #308: Make GTK# UI translatable
* Match button names to WinForms for consistency
* Translate army column title
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 28 Dec 2010 20:20:16 +0000 |
parents | 3ff8e10de45a |
children | 678e9a0392fc |
files | FrmMainWindow.cs gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmMainWindow.cs gtk-gui/gui.stetic translations/en.translation |
diffstat | 4 files changed, 54 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmMainWindow.cs Tue Dec 28 19:58:00 2010 +0000 +++ b/FrmMainWindow.cs Tue Dec 28 20:20:16 2010 +0000 @@ -106,14 +106,12 @@ Build(); //Replace the undo/redo buttons with menu versions, which Monodevelop's GUI editor doesn't currently support redoMenuButton = new MenuToolButton("gtk-redo"); - redoMenuButton.Label = "Redo"; - redoMenuButton.TooltipText = "Redo"; + redoMenuButton.Name = "bttnRedo"; redoMenuButton.Clicked += redoTBButtonActivated; redoMenuButton.Sensitive = false; toolbar.Insert(redoMenuButton, CATEGORY_BUTTON_SEPARATOR_INDEX); undoMenuButton = new MenuToolButton("gtk-undo"); - undoMenuButton.Label = "Undo"; - undoMenuButton.TooltipText = "Undo"; + undoMenuButton.Name = "bttnUndo"; undoMenuButton.Clicked += undoTBButtonActivated; undoMenuButton.Sensitive = false; toolbar.Insert(undoMenuButton, CATEGORY_BUTTON_SEPARATOR_INDEX); @@ -121,9 +119,7 @@ toolbar.Remove(toolbar.Children[CATEGORY_BUTTON_SEPARATOR_INDEX - 2]); toolbar.ShowAll(); - Title = AppTitle; TreeViewColumn mainColumn = new TreeViewColumn(); - mainColumn.Title = "Army Categories"; CellRendererText mainCell = new CellRendererText(); mainColumn.PackStart(mainCell, true); treeUnits.AppendColumn(mainColumn); @@ -227,6 +223,7 @@ { ControlTranslator.TranslateWidget(this); SetAppTitle(); + treeUnits.GetColumn(0).Title = Translation.GetTranslation("armyCategoryColumnTitle", "categories"); } private void FileLoadingFinished(List<FileLoadFailure> failures) @@ -563,7 +560,7 @@ loadedArmyPath = null; //New army has no changes, so we can't save it miSaveArmy.Sensitive = false; - saveArmyButton.Sensitive = false; + bttnSaveArmy.Sensitive = false; CommandStack.Reset(); SetPointsPanelText(); @@ -727,7 +724,7 @@ undoMenuButton.Menu = null; } - saveArmyButton.Sensitive = commandStack.IsDirty() && WarFoundryCore.CurrentArmy != null; + bttnSaveArmy.Sensitive = commandStack.IsDirty() && WarFoundryCore.CurrentArmy != null; miSaveArmy.Sensitive = commandStack.IsDirty() && WarFoundryCore.CurrentArmy != null; } @@ -875,7 +872,7 @@ if (WarFoundrySaver.GetSaver().Save(WarFoundryCore.CurrentArmy, filePath)) { miSaveArmy.Sensitive = false; - saveArmyButton.Sensitive = false; + bttnSaveArmy.Sensitive = false; CommandStack.setCleanMark(); loadedArmyPath = filePath; success = true;
--- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmMainWindow.cs Tue Dec 28 19:58:00 2010 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmMainWindow.cs Tue Dec 28 20:20:16 2010 +0000 @@ -11,7 +11,7 @@ private global::Gtk.Action miSaveArmy; private global::Gtk.Action miSaveArmyAs; private global::Gtk.Action miCloseArmy; - private global::Gtk.Action refreshAction; + private global::Gtk.Action miReloadFiles; private global::Gtk.Action miExit; private global::Gtk.Action menuEdit; private global::Gtk.Action miUndo; @@ -19,11 +19,11 @@ private global::Gtk.Action menuHelp; private global::Gtk.Action miAbout; private global::Gtk.Action miDebugInformation; - private global::Gtk.Action newArmyButton; - private global::Gtk.Action openArmyButton; - private global::Gtk.Action saveArmyButton; - private global::Gtk.Action undoActionButton; - private global::Gtk.Action redoActionButton; + private global::Gtk.Action bttnNewArmy; + private global::Gtk.Action bttnOpenArmy; + private global::Gtk.Action bttnSaveArmy; + private global::Gtk.Action bttnUndo; + private global::Gtk.Action bttnRedo; private global::Gtk.Action goDown; private global::Gtk.Action add; private global::Gtk.Action miExportArmyAs; @@ -63,9 +63,9 @@ this.miCloseArmy.Sensitive = false; this.miCloseArmy.ShortLabel = global::Mono.Unix.Catalog.GetString("Close army"); w1.Add(this.miCloseArmy, null); - this.refreshAction = new global::Gtk.Action("refreshAction", global::Mono.Unix.Catalog.GetString("Reload files"), null, "gtk-refresh"); - this.refreshAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Reload files"); - w1.Add(this.refreshAction, null); + this.miReloadFiles = new global::Gtk.Action("miReloadFiles", global::Mono.Unix.Catalog.GetString("Reload files"), null, "gtk-refresh"); + this.miReloadFiles.ShortLabel = global::Mono.Unix.Catalog.GetString("Reload files"); + w1.Add(this.miReloadFiles, null); this.miExit = new global::Gtk.Action("miExit", global::Mono.Unix.Catalog.GetString("Exit"), null, "gtk-quit"); this.miExit.ShortLabel = global::Mono.Unix.Catalog.GetString("Exit"); w1.Add(this.miExit, null); @@ -89,19 +89,19 @@ this.miDebugInformation = new global::Gtk.Action("miDebugInformation", global::Mono.Unix.Catalog.GetString("Debug Information"), null, null); this.miDebugInformation.ShortLabel = global::Mono.Unix.Catalog.GetString("Debug Information"); w1.Add(this.miDebugInformation, null); - this.newArmyButton = new global::Gtk.Action("newArmyButton", null, null, "gtk-new"); - w1.Add(this.newArmyButton, null); - this.openArmyButton = new global::Gtk.Action("openArmyButton", null, null, "gtk-open"); - w1.Add(this.openArmyButton, null); - this.saveArmyButton = new global::Gtk.Action("saveArmyButton", null, null, "gtk-save"); - this.saveArmyButton.Sensitive = false; - w1.Add(this.saveArmyButton, null); - this.undoActionButton = new global::Gtk.Action("undoActionButton", null, null, "gtk-undo"); - this.undoActionButton.Sensitive = false; - w1.Add(this.undoActionButton, null); - this.redoActionButton = new global::Gtk.Action("redoActionButton", null, null, "gtk-redo"); - this.redoActionButton.Sensitive = false; - w1.Add(this.redoActionButton, null); + this.bttnNewArmy = new global::Gtk.Action("bttnNewArmy", null, null, "gtk-new"); + w1.Add(this.bttnNewArmy, null); + this.bttnOpenArmy = new global::Gtk.Action("bttnOpenArmy", null, null, "gtk-open"); + w1.Add(this.bttnOpenArmy, null); + this.bttnSaveArmy = new global::Gtk.Action("bttnSaveArmy", null, null, "gtk-save"); + this.bttnSaveArmy.Sensitive = false; + w1.Add(this.bttnSaveArmy, null); + this.bttnUndo = new global::Gtk.Action("bttnUndo", null, null, "gtk-undo"); + this.bttnUndo.Sensitive = false; + w1.Add(this.bttnUndo, null); + this.bttnRedo = new global::Gtk.Action("bttnRedo", null, null, "gtk-redo"); + this.bttnRedo.Sensitive = false; + w1.Add(this.bttnRedo, null); this.goDown = new global::Gtk.Action("goDown", null, null, null); w1.Add(this.goDown, null); this.add = new global::Gtk.Action("add", null, null, "gtk-add"); @@ -122,7 +122,7 @@ this.vbox1 = new global::Gtk.VBox(); this.vbox1.Name = "vbox1"; // Container child vbox1.Gtk.Box+BoxChild - this.UIManager.AddUiFromString("<ui><menubar name='menubar1'><menu name='menuFile' action='menuFile'><menuitem name='miNewArmy' action='miNewArmy'/><menuitem name='miOpenArmy' action='miOpenArmy'/><menuitem name='miSaveArmy' action='miSaveArmy'/><menuitem name='miSaveArmyAs' action='miSaveArmyAs'/><menu name='miExportArmyAs' action='miExportArmyAs'><menuitem name='miExportAsBasicHtml' action='miExportAsBasicHtml'/></menu><menuitem name='miCloseArmy' action='miCloseArmy'/><separator/><menuitem name='refreshAction' action='refreshAction'/><separator/><menuitem name='miExit' action='miExit'/></menu><menu name='menuEdit' action='menuEdit'><menuitem name='miUndo' action='miUndo'/><menuitem name='miRedo' action='miRedo'/></menu><menu name='menuHelp' action='menuHelp'><menuitem name='miAbout' action='miAbout'/></menu></menubar></ui>"); + this.UIManager.AddUiFromString("<ui><menubar name='menubar1'><menu name='menuFile' action='menuFile'><menuitem name='miNewArmy' action='miNewArmy'/><menuitem name='miOpenArmy' action='miOpenArmy'/><menuitem name='miSaveArmy' action='miSaveArmy'/><menuitem name='miSaveArmyAs' action='miSaveArmyAs'/><menu name='miExportArmyAs' action='miExportArmyAs'><menuitem name='miExportAsBasicHtml' action='miExportAsBasicHtml'/></menu><menuitem name='miCloseArmy' action='miCloseArmy'/><separator/><menuitem name='miReloadFiles' action='miReloadFiles'/><separator/><menuitem name='miExit' action='miExit'/></menu><menu name='menuEdit' action='menuEdit'><menuitem name='miUndo' action='miUndo'/><menuitem name='miRedo' action='miRedo'/></menu><menu name='menuHelp' action='menuHelp'><menuitem name='miAbout' action='miAbout'/></menu></menubar></ui>"); this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox1.Add(this.menubar1); @@ -131,7 +131,7 @@ w2.Expand = false; w2.Fill = false; // Container child vbox1.Gtk.Box+BoxChild - this.UIManager.AddUiFromString("<ui><toolbar name='toolbar'><toolitem name='newArmyButton' action='newArmyButton'/><toolitem name='openArmyButton' action='openArmyButton'/><toolitem name='saveArmyButton' action='saveArmyButton'/><separator/><toolitem name='undoActionButton' action='undoActionButton'/><toolitem name='redoActionButton' action='redoActionButton'/><separator/></toolbar></ui>"); + this.UIManager.AddUiFromString("<ui><toolbar name='toolbar'><toolitem name='bttnNewArmy' action='bttnNewArmy'/><toolitem name='bttnOpenArmy' action='bttnOpenArmy'/><toolitem name='bttnSaveArmy' action='bttnSaveArmy'/><separator/><toolitem name='bttnUndo' action='bttnUndo'/><toolitem name='bttnRedo' action='bttnRedo'/><separator/></toolbar></ui>"); this.toolbar = ((global::Gtk.Toolbar)(this.UIManager.GetWidget("/toolbar"))); this.toolbar.HeightRequest = 36; this.toolbar.Name = "toolbar"; @@ -188,14 +188,14 @@ this.miSaveArmy.Activated += new global::System.EventHandler(this.OnSaveArmyActivated); this.miSaveArmyAs.Activated += new global::System.EventHandler(this.OnSaveArmyAsActivated); this.miCloseArmy.Activated += new global::System.EventHandler(this.OnCloseArmyActivated); - this.refreshAction.Activated += new global::System.EventHandler(this.OnReloadFilesActivated); + this.miReloadFiles.Activated += new global::System.EventHandler(this.OnReloadFilesActivated); this.miExit.Activated += new global::System.EventHandler(this.OnExitActivated); this.miAbout.Activated += new global::System.EventHandler(this.HelpAboutActivated); - this.newArmyButton.Activated += new global::System.EventHandler(this.newTBButtonActivated); - this.openArmyButton.Activated += new global::System.EventHandler(this.openTBButtonActivated); - this.saveArmyButton.Activated += new global::System.EventHandler(this.saveTBButtonActivated); - this.undoActionButton.Activated += new global::System.EventHandler(this.undoTBButtonActivated); - this.redoActionButton.Activated += new global::System.EventHandler(this.redoTBButtonActivated); + this.bttnNewArmy.Activated += new global::System.EventHandler(this.newTBButtonActivated); + this.bttnOpenArmy.Activated += new global::System.EventHandler(this.openTBButtonActivated); + this.bttnSaveArmy.Activated += new global::System.EventHandler(this.saveTBButtonActivated); + this.bttnUndo.Activated += new global::System.EventHandler(this.undoTBButtonActivated); + this.bttnRedo.Activated += new global::System.EventHandler(this.redoTBButtonActivated); this.miExportAsBasicHtml.Activated += new global::System.EventHandler(this.OnMiExportAsBasicHtmlActivated); this.treeUnits.RowActivated += new global::Gtk.RowActivatedHandler(this.ArmyRowActivated); this.treeUnits.PopupMenu += new global::Gtk.PopupMenuHandler(this.OnTreeUnitsPopupMenu);
--- a/gtk-gui/gui.stetic Tue Dec 28 19:58:00 2010 +0000 +++ b/gtk-gui/gui.stetic Tue Dec 28 20:20:16 2010 +0000 @@ -53,7 +53,7 @@ <property name="StockId">gtk-close</property> <signal name="Activated" handler="OnCloseArmyActivated" /> </action> - <action id="refreshAction"> + <action id="miReloadFiles"> <property name="Type">Action</property> <property name="Label" translatable="yes">Reload files</property> <property name="ShortLabel" translatable="yes">Reload files</property> @@ -103,33 +103,33 @@ <property name="Label" translatable="yes">Debug Information</property> <property name="ShortLabel" translatable="yes">Debug Information</property> </action> - <action id="newArmyButton"> + <action id="bttnNewArmy"> <property name="Type">Action</property> <property name="Label" translatable="yes" /> <property name="StockId">gtk-new</property> <signal name="Activated" handler="newTBButtonActivated" /> </action> - <action id="openArmyButton"> + <action id="bttnOpenArmy"> <property name="Type">Action</property> <property name="Label" translatable="yes" /> <property name="StockId">gtk-open</property> <signal name="Activated" handler="openTBButtonActivated" /> </action> - <action id="saveArmyButton"> + <action id="bttnSaveArmy"> <property name="Type">Action</property> <property name="Label" translatable="yes" /> <property name="Sensitive">False</property> <property name="StockId">gtk-save</property> <signal name="Activated" handler="saveTBButtonActivated" /> </action> - <action id="undoActionButton"> + <action id="bttnUndo"> <property name="Type">Action</property> <property name="Label" translatable="yes" /> <property name="Sensitive">False</property> <property name="StockId">gtk-undo</property> <signal name="Activated" handler="undoTBButtonActivated" /> </action> - <action id="redoActionButton"> + <action id="bttnRedo"> <property name="Type">Action</property> <property name="Label" translatable="yes" /> <property name="Sensitive">False</property> @@ -179,7 +179,7 @@ </node> <node type="Menuitem" action="miCloseArmy" /> <node type="Separator" /> - <node type="Menuitem" action="refreshAction" /> + <node type="Menuitem" action="miReloadFiles" /> <node type="Separator" /> <node type="Menuitem" action="miExit" /> </node> @@ -207,12 +207,12 @@ <property name="ButtonStyle">Icons</property> <property name="IconSize">LargeToolbar</property> <node name="toolbar" type="Toolbar"> - <node type="Toolitem" action="newArmyButton" /> - <node type="Toolitem" action="openArmyButton" /> - <node type="Toolitem" action="saveArmyButton" /> + <node type="Toolitem" action="bttnNewArmy" /> + <node type="Toolitem" action="bttnOpenArmy" /> + <node type="Toolitem" action="bttnSaveArmy" /> <node type="Separator" /> - <node type="Toolitem" action="undoActionButton" /> - <node type="Toolitem" action="redoActionButton" /> + <node type="Toolitem" action="bttnUndo" /> + <node type="Toolitem" action="bttnRedo" /> <node type="Separator" /> </node> </widget>
--- a/translations/en.translation Tue Dec 28 19:58:00 2010 +0000 +++ b/translations/en.translation Tue Dec 28 20:20:16 2010 +0000 @@ -17,6 +17,12 @@ <translation id="miUndo">_Undo</translation> <translation id="miRedo">_Redo</translation> <translation id="miAbout">_About</translation> +<translation id="bttnNewArmy">Create new army</translation> +<translation id="bttnOpenArmy">Open army</translation> +<translation id="bttnSaveArmy">Save army</translation> +<translation id="bttnUndo">Undo</translation> +<translation id="bttnRedo">Redo</translation> +<translation id="armyCategoryColumnTitle">Army Categories</translation> <translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> <translation id="bttnSelectRace">Create army</translation> <translation id="bttnCancel">Cancel</translation> @@ -32,9 +38,6 @@ <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="FrmNewUnit">Add New {0} Choice</translation> <translation id="IBBoard.WarFoundry.GUI.GTK.FrmAbout">About WarFoundry</translation>