示例#1
0
        /// <summary>
        /// Constructor that initializes all Strategies and attribtues
        /// </summary>
        public Translator()
        {
            Languages = new Dictionary <string, TranslationStrategy>();

            foreach (Type type in _strategies)
            {
                TranslationStrategy strategy = (TranslationStrategy)Activator.CreateInstance(type);
                Languages.Add(strategy.GetLanguageName(), strategy);
            }

            CurrentLanguage = Languages.Values.First();
        }
示例#2
0
        /// <summary>
        /// Starts the translation of class tree starting at the given root
        /// </summary>
        /// <param name="root">The root of the tree that will be translated to code</param>
        public void Translate(ClassObject root)
        {
            StringBuilder text = CurrentLanguage.Translate(root);

            ModelManager.GetInstance().TranslationChanged(CurrentLanguage.GetLanguageName(), text.ToString());
        }