Exemple #1
0
 public JsonStringLocalizer(string resourceBaseName,
                            IHostingEnvironment env,
                            JsonGlobalResources globalResources,
                            RequestCulture defaultCulture,
                            IActionContextAccessor actionContextAccessor,
                            JsonLocalizationOptions options,
                            ILoggerFactory loggerFactory) : base(resourceBaseName, env, globalResources, defaultCulture, actionContextAccessor, options, loggerFactory)
 {
 }
Exemple #2
0
        public JsonStringLocalizer(
            string resourceBaseName,
            IHostingEnvironment env,
            JsonGlobalResources globalResources,
            RequestCulture defaultCulture,
            IActionContextAccessor actionContextAccessor,
            JsonLocalizationOptions options,
            ILoggerFactory loggerFactory)
        {
            _options               = options ?? throw new ArgumentNullException(nameof(options));
            _env                   = env ?? throw new ArgumentNullException(nameof(env));
            GlobalResources        = globalResources ?? throw new ArgumentNullException(nameof(globalResources));
            DefaultCulture         = defaultCulture ?? throw new ArgumentNullException(nameof(defaultCulture));
            _actionContextAccessor = actionContextAccessor ?? throw new ArgumentNullException(nameof(actionContextAccessor));
            _logger                = loggerFactory.CreateLogger <JsonStringLocalizer <T> >();

            _resourcesRelativePath = _options.ResourcesPath ?? string.Empty;
            if (!string.IsNullOrEmpty(_resourcesRelativePath))
            {
                _resourcesRelativePath = _resourcesRelativePath.Replace(Path.AltDirectorySeparatorChar, '.').Replace(Path.DirectorySeparatorChar, '.');
            }

            ResourceFileLocations = LocalizerUtil.ExpandPaths(resourceBaseName).ToList();
        }