コード例 #1
0
        /// <summary>
        /// Register the jQueryUI date picker language file.
        /// </summary>
        /// <param name="element">Control element to put in</param>
        /// <param name="currentCulture">The current culture.</param>
        public void RegisterJQueryUILanguageFile(Control element, CultureInfo currentCulture)
        {
            // If registered or told not to register, don't bother
            if (this.PageElementExists("datepickerlang"))
            {
                return;
            }

            string jqueryUILangUrl;

            // Check if override file is set ?
            if (Config.JQueryUIOverrideLangFile.IsSet())
            {
                jqueryUILangUrl = !Config.JQueryUIOverrideLangFile.StartsWith("http")
                                  && !Config.JQueryUIOverrideLangFile.StartsWith("//")
                                      ? YafForumInfo.GetURLToScripts(Config.JQueryUIOverrideLangFile)
                                      : Config.JQueryUIOverrideLangFile;
            }
            else
            {
                jqueryUILangUrl = YafContext.Current.Get<YafBoardSettings>().JqueryUICDNHosted
                                      ? "//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/i18n/jquery-ui-i18n.min.js"
#if DEBUG
                                      : YafForumInfo.GetURLToScripts("jquery-ui-i18n.js");
#else
                                      : YafForumInfo.GetURLToScripts("jquery-ui-i18n.min.js");
#endif
            }

            // load jQuery UI from google...
            element.Controls.Add(ControlHelper.MakeJsIncludeControl(jqueryUILangUrl));

            this.AddPageElement("datepickerlang");

            if (currentCulture.IsFarsiCulture())
            {
                this.RegisterJsScriptsInclude("datepicker-farsi", "jquery.ui.datepicker-farsi.min.js");
            }
        }
コード例 #2
0
        /// <summary>
        /// Finds the corresponding DayOfWeek in specified culture
        /// </summary>
        /// <param name="day"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public static DayOfWeek GetCultureDayOfWeek(int day, CultureInfo culture)
        {
            if(culture.IsFarsiCulture())
            {
                return PersianDoW[day];
            }

            return GregorianDoW[day];
        }