/// <summary> /// Initialize a new instance of <see cref="XStringLocalizerFactory{TResource}"/> /// </summary> /// <param name="cache"></param> /// <param name="translatorFactory"></param> /// <param name="provider"></param> /// <param name="options"></param> /// <param name="loggerFactory"></param> /// <param name="localizationOptions"></param> public XStringLocalizerFactory(ExpressMemoryCache cache, ITranslatorFactory translatorFactory, IXResourceProvider provider, IOptions <XLocalizerOptions> options, IOptions <RequestLocalizationOptions> localizationOptions, ILoggerFactory loggerFactory) { _cache = cache; _options = options; _provider = provider; _loggerFactory = loggerFactory; _translatorFactory = translatorFactory; _localizationOptions = localizationOptions; }
/// <summary> /// Initialize a new instance of <see cref="XStringLocalizer{TResource}"/> /// </summary> /// <param name="cache"></param> /// <param name="translatorFactory"></param> /// <param name="provider"></param> /// <param name="loggerFactory"></param> /// <param name="localizationOptions"></param> /// <param name="options"></param> public XStringLocalizer(ExpressMemoryCache cache, ITranslatorFactory translatorFactory, IXResourceProvider provider, IOptions <XLocalizerOptions> options, IOptions <RequestLocalizationOptions> localizationOptions, ILoggerFactory loggerFactory) { _cache = cache; _translator = translatorFactory.Create(); _provider = provider; _options = options.Value; _transCulture = options.Value.TranslateFromCulture ?? localizationOptions.Value.DefaultRequestCulture.Culture.Name; _logger = loggerFactory.CreateLogger <XStringLocalizer <TResource> >(); }