Example #1
0
        /// <summary>
        /// Reloads all label files in which are in Labels folder.
        /// </summary>
        /// <returns></returns>
        public static bool ReloadLabels()
        {
            String       DefaultLanguage = "eng";
            Dictionaries Dictionaries    = new Logic.Dictionaries();

            if (Parameters.LanguagePublicDefault != null && Parameters.LanguagePublicDefault.Value != null && Parameters.LanguagePublicDefault.Value.Length > 0)
            {
                DefaultLanguage = Parameters.LanguagePublicDefault.Value.ToLower();
            }

            Dictionaries.DefaultLanguage = DefaultLanguage;
            Dictionaries.Initialize(HttpContext.Current.Server.MapPath("~/Labels"));
            String[] FileNames = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/Labels"), "labels-*.txt", SearchOption.AllDirectories);

            foreach (String FileName in FileNames)
            {
                String FileNameOnly = Path.GetFileNameWithoutExtension(FileName);
                String LanguageID   = FileNameOnly.ToLower().Replace("labels-", "");

                Dictionaries.AddFromFlatFile(LanguageID, "utf-8", FileName);
            }

            HttpContext.Current.Application.Lock();
            HttpContext.Current.Application["Dictionaries"] = Dictionaries;
            HttpContext.Current.Application.UnLock();

            return(true);
        }
        /// <summary>
        /// Reloads all label files in which are in Labels folder.
        /// </summary>
        /// <returns></returns>
        public static bool ReloadLabels()
        {
            String DefaultLanguage = "eng";
            Dictionaries Dictionaries = new Logic.Dictionaries();

            if (Parameters.LanguagePublicDefault != null && Parameters.LanguagePublicDefault.Value != null && Parameters.LanguagePublicDefault.Value.Length > 0)
                DefaultLanguage = Parameters.LanguagePublicDefault.Value.ToLower();

            Dictionaries.DefaultLanguage = DefaultLanguage;
            Dictionaries.Initialize(HttpContext.Current.Server.MapPath("~/Labels"));
            String[] FileNames = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/Labels"), "labels-*.txt", SearchOption.AllDirectories);

            foreach (String FileName in FileNames)
            {
                String FileNameOnly = Path.GetFileNameWithoutExtension(FileName);
                String LanguageID = FileNameOnly.ToLower().Replace("labels-", "");

                Dictionaries.AddFromFlatFile(LanguageID, "utf-8", FileName);
            }

            HttpContext.Current.Application.Lock();
            HttpContext.Current.Application["Dictionaries"] = Dictionaries;
            HttpContext.Current.Application.UnLock();

            return true;
        }