website
website copied to clipboard
Add Wordsmith::Inflection customization docs
Wordsmith has somewhat opinionated defaults that can be hard to customize, as detailed in this issue: https://github.com/luckyframework/wordsmith/issues/17
My guidance to a new Lucky user was to do something like this when a bunch of overrides/customization are needed, effectively clearing out all defaults and building back up from scratch with what will work for your app:
# config/inflections.cr
module Wordsmith
Inflector.inflections.clear
Inflector.inflections.plural(/$/, "s")
Inflector.inflections.plural(/s$/i, "s")
# etc, etc, etc
end
We should probably include some kind of note or reference to the Wordsmith docs in the guides around the pluralization text helper section.
🛑 This is a nuclear option I don't think we should recommend, see https://github.com/luckyframework/wordsmith/issues/17#issuecomment-834746709
If it's in the public API and we don't want people to use it, I think we should remove it from the public API. It still seems like a viable approach to me since all of the defaults are in a single file.