/// <summary> /// Setup the proxy with the factory create handler and the cultureInfoService. /// </summary> /// <param name="cultureInfoService">Culture info service to get current culture.</param> /// <param name="localizerFactory">Localizer Internal Factory.</param> public StringLocalizerProxy(ICultureInfoService cultureInfoService, IJsonStringLocalizerFactoryInternal localizerFactory) { this.localizerFactory = localizerFactory ?? throw new ArgumentNullException(nameof(localizerFactory)); this.cultureInfoService = cultureInfoService; this.cultureInfo = this.cultureInfoService.CurrentUICulture; this.stringLocalizer = localizerFactory.CreateStringLocalizer(this.cultureInfo); }
/// <summary> /// Setup the factory. /// </summary> /// <param name="options">The JsonLocalization options.</param> /// <param name="cultureInfoService">Service providing the current culture.</param> /// <param name="extensionResolverService">The service resolver to get the JsonLocalization /// extension service.</param> /// <param name="cacheService">The service to cache the loaded data.</param> /// <param name="logger">Logger where to log processing messages.</param> public JsonStringLocalizerFactory( IOptions <JsonLocalizationOptions> options, ICultureInfoService cultureInfoService, IExtensionResolverService extensionResolverService, ICacheService cacheService, ILogger <JsonStringLocalizerFactory> logger) { if (options == null) { throw new ArgumentNullException(nameof(options)); } this.logger = logger; this.options = options.Value; this.extensionResolverService = extensionResolverService; this.cultureInfoService = cultureInfoService; this.cacheService = cacheService; }
public HomeController(ITimeService timeService, ICultureInfoService cultureInfoService) { _cultureInfoService = cultureInfoService; _timeService = timeService; }