changeset 21:0364560fcec2

Re #47: Add translatable GTK# widgets * Handle menu items and actions (which can't obviously be made ITranslatable using Stetic)
author IBBoard <dev@ibboard.co.uk>
date Tue, 28 Dec 2010 19:24:06 +0000
parents 06715f517af6
children edae1d817962
files Translatable/ControlTranslator.cs
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);
+		}
 	}
 }