Example #1
0
        public void BindLanguageList()
        {
            List <Language> lstAvailableLocales = LocaleController.AddNativeNamesToList(LocalizationSqlDataProvider.GetAvailableLocales());

            ddlLanuage.DataSource = lstAvailableLocales;
            ddlLanuage.DataBind();
            ddlLanuage.SelectedValue = GetCurrentCulture();
        }
        public void GetLanguageList()
        {
            string          mode = languageMode == "Native" ? "NativeName" : "LanguageName";
            List <Language> lstAvailableLocales = LocaleController.AddNativeNamesToList(LocalizationSqlDataProvider.GetAvailableLocales());

            ddlDefaultLanguage.DataSource     = lstAvailableLocales;
            ddlDefaultLanguage.DataTextField  = mode;
            ddlDefaultLanguage.DataValueField = "LanguageCode";
            ddlDefaultLanguage.DataBind();
            ddlDefaultLanguage.SelectedIndex = ddlDefaultLanguage.Items.IndexOf(ddlDefaultLanguage.Items.FindByValue(ViewState["SelectedLanguageCulture"].ToString()));
            ViewState["RowCount"]            = lstAvailableLocales.Count;
        }
    private void AddLanguage()
    {
        int             PortalID         = GetPortalID;
        List <Language> lstLanguage      = LocalizationSqlDataProvider.GetPortalLanguages(PortalID);
        List <Language> lstLanguageFlags = LocaleController.AddNativeNamesToList(AddFlagPath(LocalizationSqlDataProvider.GetPortalLanguages(PortalID), GetApplicationName));

        if (lstLanguage.Count < 1 || lstLanguageFlags.Count < 1)
        {
            languageSetting.Visible = false;
        }
        else
        {
            var query = from listlang in lstLanguage
                        join listflag in lstLanguageFlags
                        on listlang.LanguageCode equals listflag.LanguageCode
                        select new
            {
                listlang.LanguageCode,
                listflag.FlagPath
            };
            StringBuilder ddlLanguage = new StringBuilder();
            string        cultureCode = GetCurrentCulture();
            ddlLanguage.Append("<ul id=\"languageSelect\" class=\"sfListmenu\"");
            ddlLanguage.Append(">");
            foreach (var item in query)
            {
                if (item.LanguageCode == cultureCode)
                {
                    ddlLanguage.Append("<li value=\"" + item.LanguageCode + "\" class='languageSelected'>");
                    ddlLanguage.Append(item.LanguageCode + "-" + "<img src=\"" + item.FlagPath + "\">");
                    ddlLanguage.Append("</li>");
                }
                else
                {
                    ddlLanguage.Append("<li value=\"" + item.LanguageCode + "\">");
                    ddlLanguage.Append(item.LanguageCode + "-" + "<img src=\"" + item.FlagPath + "\">");
                    ddlLanguage.Append("</li>");
                }
            }
            ddlLanguage.Append("</ul>");
            languageSetting.Text = ddlLanguage.ToString();
        }
    }
    public void GetLocale()
    {
        List <string> localeList = new List <string>();

        localeList = GetLocaleList("~/Modules", ".resx", localeList);
        localeList = GetLocaleList("~/Modules", ".js", localeList);
        localeList = GetLocaleList("~/Modules", ".xml", localeList);
        localeList = GetLocaleList("~/XMLMessage", ".xml", localeList);
        localeList = GetLocaleList("~/Sagin", ".resx", localeList);
        localeList = GetLocaleList("~/Controls", ".resx", localeList);
        localeList = GetLocaleList("~/js/SystemLocale", ".js", localeList);

        List <string>   localeListWihoutDuplicates = localeList.Distinct().ToList();
        List <Language> lstAllCultures             = LocaleController.GetCultures();
        List <Language> lstNewCulture = new List <Language>();

        foreach (string locale in localeListWihoutDuplicates)
        {
            int index = lstAllCultures.FindIndex(delegate(Language obj) { return(obj.LanguageCode == locale); });
            if (index > -1)
            {
                lstNewCulture.Add(lstAllCultures[index]);
            }
        }
        List <Language> lstAvailableLocales = LocaleController.AddNativeNamesToList(LocalizationSqlDataProvider.GetAvailableLocales());

        ddlResourceLocale.DataSource     = lstAvailableLocales;
        ddlResourceLocale.DataTextField  = "LanguageName";
        ddlResourceLocale.DataValueField = "LanguageCode";
        ddlResourceLocale.DataBind();

        List <ListItem> listCopy = new List <ListItem>();

        foreach (ListItem item in ddlResourceLocale.Items)
        {
            listCopy.Add(item);
        }
        ddlResourceLocale.Items.Clear();
        foreach (ListItem item in listCopy.OrderBy(item => item.Text))
        {
            ddlResourceLocale.Items.Add(item);
        }
    }
Example #5
0
    private void LoadFlags(List <LanguageSwitchKeyValue> lstSetting)
    {
        List <Language> lstLanguage = LocaleController.AddNativeNamesToList(AddFlagPath(LocalizationSqlDataProvider.GetPortalLanguages(PortalID), GetApplicationName));

        BindFlags(lstLanguage, lstSetting);
    }
Example #6
0
    public static List <Language> GetAvailableLanguages(string baseURL, int PortalID)
    {
        List <Language> lstLanguage = LocaleController.AddNativeNamesToList(AddFlagPath(LocalizationSqlDataProvider.GetPortalLanguages(PortalID), baseURL));

        return(lstLanguage);
    }