clipr supports localization, both of the help UI generated by
AutomaticHelpGenerator
and the options themselves. Only the description
of an argument is localizable - the long name of an argument cannot
be localized to prevent issues if a shell script that called your application
were run on a PC under a different locale.
Currently, the UI is only localized in three languages: English, Spanish, German, and Portuguese. If you're fluent in another language or see a problem with the existing translations, please consider adding a translation! More details can be found in issue #28.
To localize an argument description, apply the
clipr.Attributes.LocalizeAttribute
attribute to the property. Localization
requires a strongly-typed Resources class, provided as the ResourceType
property to the attribute. If this attribute is applied to the enclosing class,
the ResourceType
will be inherited by any properties within unless otherwise
specified. If not provided, the ResourceName
defaults to 'ClassName' if
applied to a class or 'ClassName_PropertyName' if applied to a property.
[Localize(ResourceType = typeof(Properties.Resources))]
public class LocalizationOptions
{
[Localize] // Resource Name defaults to LocalizationOptions_TurnOnThePower
[NamedArgument("turnonthepower", Action = ParseAction.StoreTrue)]
public bool TurnOnThePower { get; set; }
[Localize("FileToAdd", typeof(Properties.Resources))]
[PositionalArgument(0)]
public string FileToAdd { get; set; }
}