using System; using System.Reflection; using System.Runtime.Serialization; using Umbraco.Core.Models.EntityBase; namespace Umbraco.Core.Models { /// /// Represents a translation for a /// [Serializable] [DataContract(IsReference = true)] public class DictionaryTranslation : Entity, IDictionaryTranslation { private ILanguage _language; private string _value; public DictionaryTranslation(ILanguage language, string value) { _language = language; _value = value; } public DictionaryTranslation(ILanguage language, string value, Guid uniqueId) { _language = language; _value = value; Key = uniqueId; } private static readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo(x => x.Language); private static readonly PropertyInfo ValueSelector = ExpressionHelper.GetPropertyInfo(x => x.Value); /// /// Gets or sets the for the translation /// [DataMember] public ILanguage Language { get { return _language; } set { _language = value; OnPropertyChanged(LanguageSelector); } } /// /// Gets or sets the translated text /// [DataMember] public string Value { get { return _value; } set { _value = value; OnPropertyChanged(ValueSelector); } } } }