-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Pluralization and capitalization issues #20
Labels
Comments
PRs welcome. Please. :)
…-----------
Mark Bates
On Apr 13, 2019, 1:31 AM -0400, dvli2007 ***@***.***>, wrote:
Pluralize() should in theory pluralize a name while maintaining the cases. For example, FooBar -> FooBars.
However, there are a few cases where the pluralization produces unintentional lowercasing.
1. > Half -> halves
It seems that when the whole word matches an item in the singularToPlural map, the entire word gets converted in lowercase. On the contrary, this seems to behave correctly when a singular word is attached to another one, such as the case of LemonHalf -> LemonHalves.
2. > SmartPerson -> SmartpeopleIt seems that when the suffix matches one of thepluralRules`, the entire matched portion remains lowercase.
3. > SuperbOx -> Superboxes
It seems that camel-casing is not respected for breaking up words. In fact, the pluralRules seem to be applied first (box -> boxes) before the singularToPlural rules (ox -> oxen).
Overall, having consistent behavior here is important as this package is used by gobuffalo/pop for auto-generating table names from camel-case structs. Happy to help discuss potential solutions!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
PR #29 should fix the |
The above PR #29 covers multi-words. Maybe a more elegant suffix-function is needed. |
Thank you for reporting the issue. it was fixed by #59 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pluralize()
should in theory pluralize a name while maintaining the cases. For example,FooBar -> FooBars
.However, there are a few cases where the pluralization produces unintentional lowercasing.
Half -> halves
It seems that when the whole word matches an item in the
singularToPlural
map, the entire word gets converted in lowercase. On the contrary, this seems to behave correctly when a singular word is attached to another one, such as the case ofLemonHalf -> LemonHalves
.SmartPerson -> Smartpeople
It seems that when the suffix matches one of the
pluralRules
, the entire matched portion remains lowercase.SuperbOx -> Superboxes
It seems that camel-casing is not respected for breaking up words.
In fact, theIn fact, it seems that whenpluralRules
seem to be applied first (box -> boxes
) before thesingularToPlural
rules (ox -> oxen
).ox
is attached to another word, it will never be changed tooxen
(example:big_ox -> big_oxes
).Overall, having consistent behavior here is important as this package is used by
gobuffalo/pop
for auto-generating table names from camel-case structs. Happy to help discuss potential solutions!The text was updated successfully, but these errors were encountered: