コード例 #1
0
        public override IStringLocalizer GetStringLocalizer()
        {
            var source = new DbStringLocalizerSource();
            var stringLocalizerFactory = new StringLocalizerFactory();

            stringLocalizerFactory.AddSource(source);
            return(stringLocalizerFactory.CreateStringLocalizer());
        }
        public override IStringLocalizer GetStringLocalizer()
        {
            var source = new ResourceManagerStringLocalizerSource(
                $"{baseName}.SharedResource",
                Assembly.GetExecutingAssembly());

            var stringLocalizerFactory = new StringLocalizerFactory();

            stringLocalizerFactory.AddSource(source);

            return(stringLocalizerFactory.CreateStringLocalizer());
        }
コード例 #3
0
        public override IStringLocalizer GetStringLocalizer()
        {
            var source = new JsonStringLocalizerSource
            {
                Directory       = Directory.GetCurrentDirectory() + "/Resource",
                FilePathPattern = $"SharedResource.*.json"
            };

            source.ResolveFileProvider();

            var stringLocalizerFactory = new StringLocalizerFactory();

            stringLocalizerFactory.AddSource(source);
            return(stringLocalizerFactory.CreateStringLocalizer());
        }