dry-rb / dry-inflector

Inflector for Ruby
https://dry-rb.org/gems/dry-inflector
MIT License
95 stars 15 forks source link

[flexus port] Address singularization #3

Closed abinoam closed 6 years ago

abinoam commented 6 years ago

This definitely should be ported. Everybody agree?

See mbj/inflecto#16 Ptico/flexus#2

jodosha commented 6 years ago

@abinoam yup, please port it as well. 👍

solnic commented 6 years ago

Fun fact: I had to use ActiveSupport::Inflector a couple times just because of address singularization issue 😆

abinoam commented 6 years ago

The current api doesn't have a way to fire up a blank instance of Dry::Inflector (without any rules loaded). So, if we don't update the defaults, anybody can begin with a blank state and add their own rules. (I was already thinking about this at flexus. And let the "loading defaults" step optional on the last commits we did there). This can be useful for internationalization. Although the main use is english, perhaps we should provide room for internationalization.

jodosha commented 6 years ago

@abinoam Loading w/o defaults can be an enhancement.

But how the current design prevents to fix that pluralizations?

abinoam commented 6 years ago

@jodosha, If I try to provide portuguese pluralization and I miss a special case, inflector will fallback to the inner default english rules. I think the appropriate behaviour would be just return the given string when no portuguese rules apply. But, this will not happen. It will keep trying the rules that were loaded at initialization. Perhaps I'm missing something. But I can try to craft an example.

jodosha commented 6 years ago

@abinoam Thanks for the explanation.

What if we just port that fixes from https://github.com/Ptico/flexus/pull/2, ship the v0.1.0, and then we consider multilingual support? If this new feature will require a change in the way defaults are loaded, well we will modify it. WDYT? 😉

Ptico commented 6 years ago

Hi, sorry, I'm a little bit busy today, what if I will make a diff and port all improvements to the current codebase? And then we can release 0.1.0.

And then, I'll finish a big text with my thoughts and suggestions on the future improvements and will open the issue with it.

abinoam commented 6 years ago

@jodosha, I agree. For first release only the things that were already running. I was just comenting but was not my intention to make this a kind of priority or so.

jodosha commented 6 years ago

Hi all, As clarification, is anyone working on this? If not, I'll be able to do it in Monday.

Please let me know, if you already started.

Cheers.

http://lucaguidi.com

On 08 nov 2017, at 21:56, Abinoam P. Marques Jr. notifications@github.com wrote:

@jodosha, I agree. For first release only the things that were already running. I was just comenting but was not my intention to make this a kind of priority or so. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

abinoam commented 6 years ago

See #4.