コード例 #1
0
        public void Create_LoadsNeutralEvenWithSpecificCultureSetOnThread()
        {
            Thread.CurrentThread.CurrentCulture       =
                Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("nl");

            var resource = factory.Create(
                new ResourceDescriptor(null, "key", "Castle.MonoRail.Framework.Tests.Resources.Language", "neutral",
                                       "Castle.MonoRail.Framework.Tests"),
                typeof(DefaultResourceFactoryTestCase).Assembly);

            Assert.IsNotNull(resource);
            var lang = resource.GetString("language");

            Assert.AreEqual("english", lang);
        }
コード例 #2
0
        protected void AddResource(string name, string resourceName, Assembly asm)
        {
            IResourceFactory resourceFactory = new DefaultResourceFactory();
            var descriptor = new ResourceDescriptor(
                null,
                name,
                resourceName,
                null,
                null);
            var resource = resourceFactory.Create(
                descriptor,
                asm);

            ControllerContext.Resources.Add(name, resource);
        }
コード例 #3
0
		protected void AddResource(string name, string resourceName, Assembly asm)
		{
			IResourceFactory resourceFactory = new DefaultResourceFactory();
			ResourceDescriptor descriptor = new ResourceDescriptor(
				null,
				name,
				resourceName,
				null,
				null);
			IResource resource = resourceFactory.Create(
				descriptor,
				asm);
			ControllerContext.Resources.Add(name, resource);
		}