Model, retrieval, mapping and display for fall back language editing

This commit is contained in:
AndyButland
2018-07-05 16:00:53 +02:00
parent 2bae3e2eda
commit 592de8bebc
12 changed files with 100 additions and 5 deletions

View File

@@ -33,5 +33,11 @@ namespace Umbraco.Core.Models
/// If true, a variant node cannot be published unless this language variant is created
/// </summary>
bool Mandatory { get; set; }
/// <summary>
/// Defines the fallback language that can be used in multi-lingual scenarios to provide
/// content if the requested language does not have it published.
/// </summary>
ILanguage FallbackLanguage { get; set; }
}
}

View File

@@ -19,6 +19,7 @@ namespace Umbraco.Core.Models
private string _cultureName;
private bool _isDefaultVariantLanguage;
private bool _mandatory;
private ILanguage _fallbackLanguage;
public Language(string isoCode)
{
@@ -32,6 +33,7 @@ namespace Umbraco.Core.Models
public readonly PropertyInfo CultureNameSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.CultureName);
public readonly PropertyInfo IsDefaultVariantLanguageSelector = ExpressionHelper.GetPropertyInfo<Language, bool>(x => x.IsDefaultVariantLanguage);
public readonly PropertyInfo MandatorySelector = ExpressionHelper.GetPropertyInfo<Language, bool>(x => x.Mandatory);
public readonly PropertyInfo FallbackLanguageSelector = ExpressionHelper.GetPropertyInfo<Language, ILanguage>(x => x.FallbackLanguage);
}
/// <summary>
@@ -71,5 +73,11 @@ namespace Umbraco.Core.Models
get => _mandatory;
set => SetPropertyValueAndDetectChanges(value, ref _mandatory, Ps.Value.MandatorySelector);
}
public ILanguage FallbackLanguage
{
get => _fallbackLanguage;
set => SetPropertyValueAndDetectChanges(value, ref _fallbackLanguage, Ps.Value.FallbackLanguageSelector);
}
}
}