ember-inflector icon indicating copy to clipboard operation
ember-inflector copied to clipboard

"Child"/"Children" words are lowercased on singularize/pluralize.

Open arnaudbesnier opened this issue 6 years ago • 4 comments

pluralize('car') // => cars
pluralize('Car') // => Cars
singularize('cars') // => car
singularize('Cars') // => Car

// So far, so good...

pluralize('child') // => children
pluralize('Child') // => children # why lowercased?
singularize('children') // => child
singularize('Children') // => child # why lowercased?

Using version 2.0.1.

arnaudbesnier avatar Oct 13 '17 10:10 arnaudbesnier

Why is it lowercased here: https://github.com/emberjs/ember-inflector/blob/master/addon/lib/system/inflector.js#L183?

arnaudbesnier avatar Oct 13 '17 10:10 arnaudbesnier

@arnaudbesnier the thing with child is that it's an irregular and it's registered lowercase. The regular rules aren't registered but use regex to replace or add the singular/plural form.

fsmanuel avatar Oct 13 '17 10:10 fsmanuel

@fsmanuel thanks for your response, that's what I discovered about child. Do we agree that this is a bug? I probably don't know all the constraints.

Not sure to understand how to bypass this issue. Can you share an example of code I should add to have the expected behaviour?

arnaudbesnier avatar Oct 13 '17 11:10 arnaudbesnier

@arnaudbesnier personally I think it is a bug but I'm not sure how we deal with it. I'll open a PR with failing tests.

fsmanuel avatar Oct 13 '17 15:10 fsmanuel