using Umbraco.Core;
using Umbraco.Core.Services;
namespace Umbraco.Web.PublishedCache
{
///
/// Provides the default implementation of .
///
public class DefaultCultureAccessor : IDefaultCultureAccessor
{
private readonly ILocalizationService _localizationService;
private readonly RuntimeLevel _runtimeLevel;
///
/// Initializes a new instance of the class.
///
public DefaultCultureAccessor(ILocalizationService localizationService, IRuntimeState runtimeState)
{
_localizationService = localizationService;
_runtimeLevel = runtimeState.Level;
}
///
public string DefaultCulture => _runtimeLevel == RuntimeLevel.Run
? _localizationService.GetDefaultLanguageIsoCode() ?? "" // fast
: "en-US"; // default for install and upgrade, when the service is n/a
}
}