Esempio n. 1
0
    protected void AddNewLanguage()
    {
        Language objLang = new Language();

        objLang.LanguageName         = this.ddlLanguage.SelectedItem.ToString();
        objLang.LanguageCode         = this.ddlLanguage.SelectedValue.ToString();
        objLang.FallBackLanguage     = "English";
        objLang.FallBackLanguageCode = "en-US";
        try
        {
            LocalizationSqlDataProvider.AddLanguage(objLang);
            string SystemLocaleFilePath = "";
            string newfilepath          = "";
            SystemLocaleFilePath = "~/js/SystemLocale/systemlocale.js";
            string defaultLangFile = HttpContext.Current.Server.MapPath(SystemLocaleFilePath);

            string defaultfileReplace = LocalizationHelper.GetDefaultFilePath(defaultLangFile).Replace(".js", "");;
            if (objLang.LanguageCode != "en-US")
            {
                newfilepath = defaultfileReplace + "." + objLang.LanguageCode + ".js";
            }
            else
            {
                newfilepath = defaultfileReplace + ".js";
            }

            if (!File.Exists(newfilepath))
            {
                File.Copy(defaultLangFile, newfilepath);
            }
            ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("LanguageModule", "LanguageAddedSuccessfully"), "", SageMessageType.Success);
            LoadAllCultures();
            GetFlagImage();
            Localization_CreateLanguagePack clp = (Localization_CreateLanguagePack)this.Parent.FindControl("CreateLanguagePack1");
            DropDownList ddlResourceLocale      = (DropDownList)clp.FindControl("ddlResourceLocale");
            LoadAllCulturesDropDown(ddlResourceLocale);
            UpdateLocalizeMenuFields();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Esempio n. 2
0
    protected void AddNewLanguage()
    {
        Language objLang = new Language();

        objLang.LanguageName         = this.ddlLanguage.SelectedItem.ToString();
        objLang.LanguageCode         = this.ddlLanguage.SelectedValue.ToString();
        objLang.FallBackLanguage     = "English";
        objLang.FallBackLanguageCode = "en-US";
        try
        {
            LocalizationSqlDataProvider.AddLanguage(objLang);
            ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("LanguageModule", "LanguageAddedSuccessfully"), "", SageMessageType.Success);
            LoadAllCultures();
            GetFlagImage();
            Localization_CreateLanguagePack clp = (Localization_CreateLanguagePack)this.Parent.FindControl("CreateLanguagePack1");
            DropDownList ddlResourceLocale      = (DropDownList)clp.FindControl("ddlResourceLocale");
            LoadAllCulturesDropDown(ddlResourceLocale);
            UpdateLocalizeMenuFields();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Esempio n. 3
0
 protected void AddToDataBase(Language objLang)
 {
     objLang.FallBackLanguage     = Thread.CurrentThread.CurrentCulture.EnglishName;
     objLang.FallBackLanguageCode = Thread.CurrentThread.CurrentCulture.ToString();
     LocalizationSqlDataProvider.AddLanguage(objLang);
 }