예제 #1
0
 /// <summary>
 /// Add/Replace phrases pair in the existen language and new/existen section.<br/>
 /// If translations for this language exists and 'replaced' is true - translations will be rewritten for full section<br/>
 /// If translations not exist - pair will be added.
 /// If translations exist and 'replaced' is false - translations will be not added.
 /// </summary>
 /// <param name="language"></param>
 /// <param name="sectionName"></param>
 /// <param name="pairs"></param>
 /// <param name="replaced"></param>
 public static void AddTranslations(string language, string sectionName, Dictionary <string, string> pairs, bool replaced)
 {
     if (!Cache[language].ContainsSection(sectionName))
     {
         Cache[language].AddSection(new UTranslationSection {
             SectionName = sectionName, Translations = pairs
         });
         _modules.Add(sectionName);
     }
     else if (replaced)
     {
         Cache[language][sectionName] = new UTranslationSection {
             SectionName = sectionName, Translations = pairs
         }
     }
     ;
 }
예제 #2
0
 public static void Change(string language, string sectionName)
 {
     _currLanguage = language;
     _module       = sectionName;
     if (_languages.Contains(_currLanguage) && Cache[_currLanguage].ContainsSection(_module))
     {
         _translation = Cache[_currLanguage][_module];
         if (TranslationChanged != null)
         {
             TranslationChanged(_currLanguage, _module);
         }
     }
     else
     {
         if (QueryLanguage != null)
         {
             QueryLanguage(_currLanguage, _module);
         }
     }
 }