Mercurial > repos > IBBoard.GtkSharp
changeset 29:bcb437c04685
Re #47: Add translatable GTK# widgets
* Merge menu item and toolbutton translations
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 31 Dec 2010 10:42:17 +0000 |
parents | 73c1e3372b52 |
children | c9e1ad81afbe |
files | Translatable/ControlTranslator.cs |
diffstat | 1 files changed, 8 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Translatable/ControlTranslator.cs Thu Dec 30 20:58:47 2010 +0000 +++ b/Translatable/ControlTranslator.cs Fri Dec 31 10:42:17 2010 +0000 @@ -25,14 +25,9 @@ { Translation.Translate((ITranslatable)toTranslate); } - else if (toTranslate is MenuItem) + else if (toTranslate is MenuItem || toTranslate is ToolButton) { - TranslateAction(((MenuItem)toTranslate).Action); - } - else if (toTranslate is ToolButton) - { - ToolButton toolButton = ((ToolButton)toTranslate); - TranslateToolButton(toolButton); + TranslateWidgetWithAction((Widget)toTranslate); } if (cascade && toTranslate is Container) @@ -41,18 +36,18 @@ } } - private static void TranslateToolButton(ToolButton toolButton) + private static void TranslateWidgetWithAction(Widget widget) { - Action action = toolButton.Action; - string translation = Translation.GetTranslation(toolButton.Name, ""); + Action action = widget.Action; + string translation = Translation.GetTranslation(widget.Name, ""); if (translation == "") { - toolButton.TooltipText = action.Label; + widget.TooltipText = translation; } - else + else if (action != null) { - toolButton.TooltipText = translation; + widget.TooltipText = action.Label; } }