- 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:
Bjarke Berg
2020-10-22 13:37:47 +02:00
parent 785c3a34e9
commit ca8e54ffc6
7 changed files with 26 additions and 70 deletions

View File

@@ -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
}
}