Example #1
0
        private static Dictionary<LocaleInfo, LocalizationManager> LoadLocales(XElement localeElements)
        {
            var locales = new Dictionary<LocaleInfo, LocalizationManager>();
            foreach (XElement localeElement in localeElements.Elements("locale"))
            {
                string localeId = XmlHelper.GetAttributeValue(localeElement, "id");
                string localeName = XmlHelper.GetAttributeValue(localeElement, "name");
                LocaleInfo localeInfo = new LocaleInfo(localeId, localeName);

                // Ensure locale ID is unique
                if (locales.ContainsKey(localeInfo))
                    throw XmlHelper.CreateException(localeElement, "Duplicate definition of locale: " + localeInfo);

                Debug.WriteLine("Loading locale: " + localeInfo);
                Dictionary<string, LocalizedString> localizedStrings = LoadSingleLocale(localeElement);
                LocalizationManager locale = new LocalizationManager(localizedStrings);
                locales.Add(localeInfo, locale);
            }

            return locales;
        }
Example #2
0
 public LookupToken(LocalizationManager container)
 {
     _container = container;
     _seenStringNames = new HashSet<string>();
 }
Example #3
0
File: Form1.cs Project: apsun/EzGPA
 private void UpdateLocale()
 {
     if (_suppressLocaleChange) return;
     string locale = ((LanguageData)languageComboBox.SelectedItem).Key;
     try
     {
         _localization = Settings.GetLocalizationObject(locale);
     }
     catch (LocalizationLoadException ex)
     {
         ErrorMsgBox(_localization.LocaleChangeFailMessage(ex));
         var locales = languageComboBox.Items.Cast<LanguageData>();
         _suppressLocaleChange = true;
         languageComboBox.SelectedItem = locales.FirstOrDefault(l => l.Key == _localization.LanguageKey);
         _suppressLocaleChange = false;
         return;
     }
     RefreshControlLocalization();
 }