-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localization and nuspec #322
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -416,7 +416,6 @@ public HelpText AddOptions<T>(ParserResult<T> result) | |
|
||
return AddOptionsImpl( | ||
GetSpecificationsFromType(result.TypeInfo.Current), | ||
SentenceBuilder.RequiredWord(), | ||
MaximumDisplayWidth); | ||
} | ||
|
||
|
@@ -433,7 +432,6 @@ public HelpText AddVerbs(params Type[] types) | |
|
||
return AddOptionsImpl( | ||
AdaptVerbsToSpecifications(types), | ||
SentenceBuilder.RequiredWord(), | ||
MaximumDisplayWidth); | ||
} | ||
|
||
|
@@ -449,7 +447,6 @@ public HelpText AddOptions<T>(int maximumLength, ParserResult<T> result) | |
|
||
return AddOptionsImpl( | ||
GetSpecificationsFromType(result.TypeInfo.Current), | ||
SentenceBuilder.RequiredWord(), | ||
maximumLength); | ||
} | ||
|
||
|
@@ -467,7 +464,6 @@ public HelpText AddVerbs(int maximumLength, params Type[] types) | |
|
||
return AddOptionsImpl( | ||
AdaptVerbsToSpecifications(types), | ||
SentenceBuilder.RequiredWord(), | ||
maximumLength); | ||
} | ||
|
||
|
@@ -720,7 +716,6 @@ private IEnumerable<Specification> AdaptVerbsToSpecifications(IEnumerable<Type> | |
|
||
private HelpText AddOptionsImpl( | ||
IEnumerable<Specification> specifications, | ||
string requiredWord, | ||
int maximumLength) | ||
{ | ||
var maxLength = GetMaxLength(specifications); | ||
|
@@ -731,7 +726,7 @@ private HelpText AddOptionsImpl( | |
|
||
specifications.ForEach( | ||
option => | ||
AddOption(requiredWord, maxLength, option, remainingSpace)); | ||
AddOption(maxLength, option, remainingSpace)); | ||
|
||
return this; | ||
} | ||
|
@@ -765,7 +760,7 @@ private HelpText AddPreOptionsLine(string value, int maximumLength) | |
return this; | ||
} | ||
|
||
private HelpText AddOption(string requiredWord, int maxLength, Specification specification, int widthOfHelpText) | ||
private HelpText AddOption(int maxLength, Specification specification, int widthOfHelpText) | ||
{ | ||
if (specification.Hidden) | ||
return this; | ||
|
@@ -784,13 +779,13 @@ private HelpText AddOption(string requiredWord, int maxLength, Specification spe | |
var optionHelpText = specification.HelpText; | ||
|
||
if (addEnumValuesToHelpText && specification.EnumValues.Any()) | ||
optionHelpText += " Valid values: " + string.Join(", ", specification.EnumValues); | ||
optionHelpText += " {0}: ".FormatInvariant(SentenceBuilder.ValidValuesPhrase()) + string.Join(", ", specification.EnumValues); | ||
|
||
specification.DefaultValue.Do( | ||
defaultValue => optionHelpText = "(Default: {0}) ".FormatInvariant(FormatDefaultValue(defaultValue)) + optionHelpText); | ||
defaultValue => optionHelpText = "({0}: {1}) ".FormatInvariant(SentenceBuilder.DefaultWord(), FormatDefaultValue(defaultValue)) + optionHelpText); | ||
|
||
if (specification.Required) | ||
optionHelpText = "{0} ".FormatInvariant(requiredWord) + optionHelpText; | ||
optionHelpText = "{0} ".FormatInvariant(SentenceBuilder.RequiredWord()) + optionHelpText; | ||
|
||
if (!string.IsNullOrEmpty(optionHelpText)) | ||
{ | ||
|
@@ -860,8 +855,8 @@ private string AddValueName(int maxLength, ValueSpecification specification) | |
return new StringBuilder(maxLength) | ||
.BimapIf( | ||
specification.MetaName.Length > 0, | ||
it => it.AppendFormat("{0} (pos. {1})", specification.MetaName, specification.Index), | ||
it => it.AppendFormat("value pos. {0}", specification.Index)) | ||
it => it.AppendFormat("{0} ({1} {2})", specification.MetaName, SentenceBuilder.PositionWord(), specification.Index), | ||
it => it.AppendFormat("{0} {1}", SentenceBuilder.ValuePositionPhrase(), specification.Index)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these localization changes dont actually fit the need. Some languages might need the number in a different spot. French sometimes likes '1 de juen' instead of 'june 1' for example (thats a date but you should understand my point). The strings might need to include numeric placeholders too... I feel like localization for now needs to be reconsidered and rearchitected in this lib. |
||
.AppendFormatWhen( | ||
specification.MetaValue.Length > 0, " {0}", specification.MetaValue) | ||
.ToString(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dependency changes will probably conflict with upcoming netcore standard 2.0 adjustments (#307)