Esempio n. 1
0
 /// <summary>
 /// Sets the current language.
 /// Illegal calls are ignored.
 /// </summary>
 /// <param name="language">The language that will used from now on</param>
 public void SetLanguage(string language)
 {
     if (!Languages.ContainsKey(language))
     {
         return;
     }
     CurrentLanguage = Languages[language];
 }
Esempio n. 2
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();
        }