adrianaisemberg/CLAP — pull request #27 by brutaldev (2014-04-05 18:37:49+00:00)
Title: Allow for localization of description text

My requirement is to be able to localize the descriptions in Verbs and Global parameters. Being able to inherit from these attributes and override the description allows me to use a resource manager (or database/XML whatever) to retrieve the string. This relates to issue #26.

Here is a code sample of how you can use a resource manager (for example) to get the string value:
```
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
internal sealed class LocalizedGlobalAttribute : GlobalAttribute
{
private static readonly ResourceManager Manager = new ResourceManager(typeof(Resources).FullName, typeof(Resources).Assembly);

public string DescriptionResourceKey { get; set; }

public override string Description
{
get
{
if (!string.IsNullOrEmpty(DescriptionResourceKey))
{
return Manager.GetString(DescriptionResourceKey, CultureInfo.CurrentCulture);
}

return base.Description;
}
}
}
```

You would now be able to provide a default description through the normal property as well as a lookup key and get the string using any mechanism you want.