// For key/value look up purpose public Dictionary <object, LanguageDto> RetrievePublishedLanguagesAndPhrases(bool isMultiLanguageSupported) { IEnumerable <LanguageDto> instances = LanguageSystem.RetrieveAllLanguage(new LanguageConverter()); Dictionary <object, LanguageDto> languageDic = new Dictionary <object, LanguageDto>(); // Attach LanguagePhrases LanguagePhraseFacade sysPhraseFacade = new LanguagePhraseFacade(UnitOfWork); DataPhraseFacade dataPhraseFacade = new DataPhraseFacade(UnitOfWork); foreach (LanguageDto language in instances.Where(o => o.IsPublished)) { languageDic.Add(language.Id, language); if (isMultiLanguageSupported) { // UI level system Phrases SortedDictionary <string, string> sysPhraseDic = new SortedDictionary <string, string>(); foreach (LanguagePhraseDto phrase in sysPhraseFacade.RetrieveLanguagePhrasesByLanguage(language.Id)) { sysPhraseDic.Add(phrase.PhraseKey, phrase.PhraseValue); } language.SysPhrases = sysPhraseDic; // Data Phrases SortedDictionary <string, string> dataPhraseDic = new SortedDictionary <string, string>(); foreach (DataPhraseDto phrase in dataPhraseFacade.RetrieveDataPhrasesByLanguage(language.Id)) { dataPhraseDic.Add(phrase.PhraseKey, phrase.PhraseValue); } language.DataPhrases = dataPhraseDic; } } return(languageDic); }
// For multi-language key/value setup public Dictionary <object, LanguageDto> RetrieveLanguagesAndSysPhrases() { IEnumerable <LanguageDto> instances = LanguageSystem.RetrieveAllLanguage(new LanguageConverter()); Dictionary <object, LanguageDto> languageDic = new Dictionary <object, LanguageDto>(); // Attach LanguagePhrases LanguagePhraseFacade facade = new LanguagePhraseFacade(UnitOfWork); foreach (LanguageDto language in instances) { languageDic.Add(language.Id, language); // UI level system Phrases SortedDictionary <string, string> sysPhraseDic = new SortedDictionary <string, string>(); foreach (LanguagePhraseDto phrase in facade.RetrieveLanguagePhrasesByLanguage(language.Id)) { sysPhraseDic.Add(phrase.PhraseKey, phrase.PhraseValue); } language.SysPhrases = sysPhraseDic; } return(languageDic); }