예제 #1
0
        // 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);
        }
예제 #2
0
        // For multi-language key/value setup
        public Dictionary <object, LanguageDto> RetrieveLanguagesAndDataPhrases()
        {
            IEnumerable <LanguageDto> instances = LanguageSystem.RetrieveAllLanguage(new LanguageConverter());

            Dictionary <object, LanguageDto> languageDic = new Dictionary <object, LanguageDto>();
            // Attach LanguagePhrases
            DataPhraseFacade facade = new DataPhraseFacade(UnitOfWork);

            foreach (LanguageDto language in instances)
            {
                languageDic.Add(language.Id, language);
                // Data Phrases
                SortedDictionary <string, string> dataPhraseDic = new SortedDictionary <string, string>();
                foreach (DataPhraseDto phrase in facade.RetrieveDataPhrasesByLanguage(language.Id))
                {
                    dataPhraseDic.Add(phrase.PhraseKey, phrase.PhraseValue);
                }
                language.DataPhrases = dataPhraseDic;
            }

            return(languageDic);
        }