Beispiel #1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="LanguageManager" /> class.
		/// </summary>
		/// <param name="settings">The settings.</param>
		/// <param name="context">The OWIN context.</param>
		public LanguageManager(ISimplifyWebSettings settings, IOwinContext context)
		{
			_responseCookies = context.Response.Cookies;

			if (!TrySetLanguageFromCookie(context))
				if (!settings.AcceptBrowserLanguage || (settings.AcceptBrowserLanguage && !TrySetLanguageFromRequestHeader(context)))
					SetCurrentLanguage(settings.DefaultLanguage);
		}
Beispiel #2
0
        public void Initialize()
        {
            var settings = new Mock <ISimplifyWebSettings>();

            settings.SetupGet(x => x.DefaultTemplatesPath).Returns("Templates");
            settings.SetupGet(x => x.DefaultStyle).Returns("Main");
            settings.SetupGet(x => x.DefaultMasterTemplateFileName).Returns("Master.tpl");
            settings.SetupGet(x => x.DataPath).Returns("App_Data");

            _settings = settings.Object;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LanguageManager" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="context">The OWIN context.</param>
        public LanguageManager(ISimplifyWebSettings settings, IOwinContext context)
        {
            _responseCookies = context.Response.Cookies;

            if (!TrySetLanguageFromCookie(context))
            {
                if (!settings.AcceptBrowserLanguage || (settings.AcceptBrowserLanguage && !TrySetLanguageFromRequestHeader(context)))
                {
                    SetCurrentLanguage(settings.DefaultLanguage);
                }
            }
        }
Beispiel #4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Environment"/> class.
		/// </summary>
		/// <param name="sitePhysicalPath">The site physical path.</param>
		/// <param name="settings">The settings.</param>
		public Environment(string sitePhysicalPath, ISimplifyWebSettings settings)
		{
			sitePhysicalPath = sitePhysicalPath.Replace("\\", "/");

			if (!sitePhysicalPath.EndsWith("/"))
				sitePhysicalPath = sitePhysicalPath + "/";

			SitePhysicalPath = sitePhysicalPath;

			TemplatesPath = settings.DefaultTemplatesPath;
			DataPath = settings.DataPath;
			SiteStyle = settings.DefaultStyle;
			MasterTemplateFileName = settings.DefaultMasterTemplateFileName;
		}
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Environment"/> class.
        /// </summary>
        /// <param name="sitePhysicalPath">The site physical path.</param>
        /// <param name="settings">The settings.</param>
        public Environment(string sitePhysicalPath, ISimplifyWebSettings settings)
        {
            sitePhysicalPath = sitePhysicalPath.Replace("\\", "/");

            if (!sitePhysicalPath.EndsWith("/"))
            {
                sitePhysicalPath = sitePhysicalPath + "/";
            }

            SitePhysicalPath = sitePhysicalPath;

            TemplatesPath          = settings.DefaultTemplatesPath;
            DataPath               = settings.DataPath;
            SiteStyle              = settings.DefaultStyle;
            MasterTemplateFileName = settings.DefaultMasterTemplateFileName;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LanguageManager" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="context">The OWIN context.</param>
        public LanguageManager(ISimplifyWebSettings settings, HttpContext context)
        {
            _responseCookies = context.Response.Cookies;

            if (TrySetLanguageFromCookie(context))
            {
                return;
            }

            if (!settings.AcceptBrowserLanguage || (settings.AcceptBrowserLanguage && !TrySetLanguageFromRequestHeader(context)))
            {
                if (!SetCurrentLanguage(settings.DefaultLanguage))
                {
                    Language = "iv";
                }
            }
        }
 public LanguageManagerProvider(ISimplifyWebSettings settings)
 {
     _settings = settings;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="LanguageManagerProvider" /> class.
		/// </summary>
		/// <param name="settings">The settings.</param>
		public LanguageManagerProvider(ISimplifyWebSettings settings)
		{
			_settings = settings;
		}