- Removed BackOfficeArea - Injected IEmailSender - Uses nameof instead of magic strings - Uses GetControllerName instead of magic strings Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Umbraco.Core;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
@@ -9,21 +11,22 @@ namespace Umbraco.Web.PublishedCache
|
||||
public class DefaultCultureAccessor : IDefaultCultureAccessor
|
||||
{
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly IOptions<GlobalSettings> _options;
|
||||
private readonly RuntimeLevel _runtimeLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DefaultCultureAccessor"/> class.
|
||||
/// </summary>
|
||||
public DefaultCultureAccessor(ILocalizationService localizationService, IRuntimeState runtimeState)
|
||||
public DefaultCultureAccessor(ILocalizationService localizationService, IRuntimeState runtimeState, IOptions<GlobalSettings> options)
|
||||
{
|
||||
_localizationService = localizationService;
|
||||
_options = options;
|
||||
_runtimeLevel = runtimeState.Level;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DefaultCulture => _runtimeLevel == RuntimeLevel.Run
|
||||
? _localizationService.GetDefaultLanguageIsoCode() ?? "" // fast
|
||||
// TODO: Shouldn't this come from GlobalSettings.DefaultUILanguage?
|
||||
: "en-US"; // default for install and upgrade, when the service is n/a
|
||||
: _options.Value.DefaultUILanguage; // default for install and upgrade, when the service is n/a
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user