コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        private void InitializePresentedLanguagesDescriptions()
        {
            var sourceLanguagesCollection = AllowedLangages != null
                                                ? PresentedLanguages.OrderBy(x => AllowedLangages.IndexOf(x)).ToList()
                                                : PresentedLanguages;

            PresentedLanguagesDescriptions = sourceLanguagesCollection.Select(x => new LanguageDescription(x)).ToList();
        }