# HG changeset patch # User IBBoard # Date 1293564246 0 # Node ID 0364560fcec21d6c03300e587f8d875a204cf563 # Parent 06715f517af6b7ab78fb3b68973015648c20fd31 Re #47: Add translatable GTK# widgets * Handle menu items and actions (which can't obviously be made ITranslatable using Stetic) diff -r 06715f517af6 -r 0364560fcec2 Translatable/ControlTranslator.cs --- a/Translatable/ControlTranslator.cs Mon Dec 27 20:48:29 2010 +0000 +++ b/Translatable/ControlTranslator.cs Tue Dec 28 19:24:06 2010 +0000 @@ -25,6 +25,10 @@ { Translation.Translate((ITranslatable)toTranslate); } + else if (toTranslate is MenuItem) + { + TranslateAction(((MenuItem)toTranslate).Action); + } if (cascade && toTranslate is Container) { @@ -49,12 +53,15 @@ { foreach (Action action in actionContainer.Actions) { - if (action is ITranslatable) - { - Translation.Translate((ITranslatable)action); - } + TranslateAction(action); } } + + private static void TranslateAction(Action action) + { + System.Console.WriteLine(action.Name); + action.Label = Translation.GetTranslation(action.Name, action.Label); + } } }