Files
Umbraco-CMS/src/Umbraco.Core/Models/PublishedContent/PublishedCultureInfos.cs

51 lines
1.6 KiB
C#
Raw Normal View History

using System;
2018-04-28 16:34:43 +02:00
using Umbraco.Core.Exceptions;
namespace Umbraco.Core.Models.PublishedContent
{
2018-04-28 16:34:43 +02:00
/// <summary>
/// Contains culture specific values for <see cref="IPublishedContent"/>.
/// </summary>
public class PublishedCultureInfo
2018-04-28 16:34:43 +02:00
{
/// <summary>
/// Initializes a new instance of the <see cref="PublishedCultureInfo"/> class.
2018-04-28 16:34:43 +02:00
/// </summary>
public PublishedCultureInfo(string culture, string name, DateTime date)
2018-04-28 16:34:43 +02:00
{
if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentNullOrEmptyException(nameof(culture));
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
Culture = culture;
Name = name;
UrlSegment = name.ToUrlSegment(culture);
2018-04-29 20:02:38 +02:00
Date = date;
2018-04-28 16:34:43 +02:00
}
/// <summary>
/// Gets the culture.
/// </summary>
public string Culture { get; }
/// <summary>
/// Gets the name of the item.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the url segment of the item.
/// </summary>
public string UrlSegment { get; }
/// <summary>
2018-04-29 20:02:38 +02:00
/// Gets the date associated with the culture.
2018-04-28 16:34:43 +02:00
/// </summary>
2018-04-29 20:02:38 +02:00
/// <remarks>
/// <para>For published culture, this is the date the culture was published. For draft
/// cultures, this is the date the culture was made available, ie the last time its
/// name changed.</para>
/// </remarks>
public DateTime Date { get; }
2018-04-28 16:34:43 +02:00
}
}