/// <summary>
 /// Sets a description on an object.
 /// </summary>
 internal static void SetDescription(
     this IDescribable obj,
     TranslationContext context,
     Func <string> describer)
 {
     if (context.AddDescriptions)
     {
         var longDescription = describer();
         obj.SetDescription(context, longDescription, null);
     }
 }
Пример #2
0
        private protected void Describe(TranslationContext context, IDescribable obj)
        {
            if (context.AddDescriptions && obj.LongDescription is null && obj.ShortDescription is null && !(string.IsNullOrWhiteSpace(LongDescription) || string.IsNullOrWhiteSpace(ShortDescription)))
            {
                obj.SetDescription(context, LongDescription, ShortDescription);
            }

            if (context.AddDescriptions && obj.Name is null && !string.IsNullOrWhiteSpace(Name))
            {
                obj.SetName(Name);
            }
        }