website icon indicating copy to clipboard operation
website copied to clipboard

Add Wordsmith::Inflection customization docs

Open stephendolan opened this issue 4 years ago • 2 comments

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.

stephendolan avatar May 07 '21 16:05 stephendolan

🛑 This is a nuclear option I don't think we should recommend, see https://github.com/luckyframework/wordsmith/issues/17#issuecomment-834746709

matthewmcgarvey avatar May 07 '21 20:05 matthewmcgarvey

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.

stephendolan avatar May 07 '21 20:05 stephendolan