protected void LoadLanguage()
        {

            languageDic = new Dictionary<string, IDictionary<string, string>>();
            IList<CodeMaster> languages = codeMasterMgrE.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_LANGUAGE);
            foreach (CodeMaster language in languages)
            {
                string languageKey = language.Value;
                string resourceFile = languageFileFolder + "/Language_" + languageKey + ".properties";
                IDictionary<string, string> targetLanguageDic = new Dictionary<string, string>();

                PropertyFileReader propertyFileReader = new PropertyFileReader(resourceFile);
                while (!propertyFileReader.EndOfStream)
                {
                    string[] property = propertyFileReader.GetPropertyLine();
                    if (property != null)
                    {
                        try
                        {
                            targetLanguageDic.Add(property[0].Trim(), property[1].Trim());
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                try
                {
                    string resourceExtFile = languageFileFolder + "/Language-ext_" + languageKey + ".properties";
                    if (File.Exists(resourceExtFile))
                    {
                        PropertyFileReader propertyExtFileReader = new PropertyFileReader(resourceExtFile);
                        while (!propertyExtFileReader.EndOfStream)
                        {
                            string[] property = propertyExtFileReader.GetPropertyLine();
                            if (property != null)
                            {
                                try
                                {
                                    if (targetLanguageDic.ContainsKey(property[0].Trim()))
                                    {
                                        targetLanguageDic.Remove(property[0].Trim());
                                    }
                                    targetLanguageDic.Add(property[0].Trim(), property[1].Trim());
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }

                    }
                }
                catch (Exception e)
                {
                    log.Error(e.Message, e);
                }

                languageDic.Add(languageKey, targetLanguageDic);
            }
        }
Example #2
0
        private void LoadLanguage()
        {
            languageDic = new Dictionary<string, IDictionary<string, string>>();
            IList<CodeMaster> languages = codeMasterMgr.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_LANGUAGE);
            foreach (CodeMaster language in languages)
            {
                string languageKey = language.Value;
                string resourceFile = languageFileFolder + "/ApplicationResources_" + languageKey + ".properties";
                IDictionary<string, string> targetLanguageDic = new Dictionary<string, string>();

                PropertyFileReader propertyFileReader = new PropertyFileReader(resourceFile);
                while (!propertyFileReader.EndOfStream)
                {
                    string[] property = propertyFileReader.GetPropertyLine();
                    if (property != null)
                    {
                        try
                        {
                            targetLanguageDic.Add(property[0].Trim(), property[1].Trim());
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                languageDic.Add(languageKey, targetLanguageDic);
            }
        }