private void ConsumeLocalizationDataResource(LocalizationDataResource localizationDataResource) { if (localizationDataResource == null) { throw new Exception("Заданный локализационный ресурс имеет не верный формат."); } if (IsInitialzed) { throw new Exception("Инициализация LocalizationManager уже завершена."); } foreach (var languageName in localizationDataResource.PresentedLanguages) { if (PresentedLanguages.Contains(languageName) == false) { PresentedLanguages.Add(languageName); } } foreach (var localizationDataItem in localizationDataResource.LocalizationDataItems) { if (DataItemsRepository.ContainsKey(localizationDataItem.Key) == false) { DataItemsRepository.Add(localizationDataItem.Key, localizationDataItem); } else { DataItemsRepository[localizationDataItem.Key] = localizationDataItem; } } }
private void InitializePresentedLanguagesDescriptions() { var sourceLanguagesCollection = AllowedLangages != null ? PresentedLanguages.OrderBy(x => AllowedLangages.IndexOf(x)).ToList() : PresentedLanguages; PresentedLanguagesDescriptions = sourceLanguagesCollection.Select(x => new LanguageDescription(x)).ToList(); }