# HG changeset patch # User IBBoard # Date 1293792137 0 # Node ID bcb437c046854b19e07611f3d2425fbafecd3372 # Parent 73c1e3372b52027840e41877d78aa2c3183ec64b Re #47: Add translatable GTK# widgets * Merge menu item and toolbutton translations diff -r 73c1e3372b52 -r bcb437c04685 Translatable/ControlTranslator.cs --- 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; } }