8000 StringUtil::singularify() does not convert "movies" correctly · Issue #14189 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

StringUtil::singularify() does not convert "movies" correctly #14189

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

Closed
gwijnja opened this issue Apr 2, 2015 · 5 comments
Closed

StringUtil::singularify() does not convert "movies" correctly #14189

gwijnja opened this issue Apr 2, 2015 · 5 comments

Comments

@gwijnja
Copy link
Contributor
gwijnja commented Apr 2, 2015

The plural map contains:

// babies (baby)
array('sei', 3, false, true, 'y'),

And as a result, movies is singularified to movy. Symfony is now looking for 'addMovy' and 'removeMovy' instead of 'addMovie' and 'removeMovie'.

(Is there a possibility to hint for function names by the way?)

The word 'movies' seems to be an exception to the general rule. I checked a couple of word sites and there are only 2 words ending in 'ovies': movies and anchovies. The singular of the latter is anchovy. All other words ending in "vies" should be singularified to "vy", as far as I can tell. This would result in an exception for just the word 'movies'.

Putting this in front of the 'babies' entry solves the issue:

// movies (movie)
array('seivom', 6, true, true, 'movie'),

Added a pull request, my very very first pull request on GitHub. Hope I did everything right.

@gwijnja
Copy link
Contributor Author
gwijnja commented Apr 3, 2015

Reopened the PR, the first one was accidentally set for 2.7 instead of 2.3.

@javiereguiluz
Copy link
Member

@GerbenWijnja thanks for fixing this error.

However, as I always do when someone reports a problem with the "magic Symfony pluralizator", I'll say it again: I think it's a big mistake to have this code inside Symfony. It's really hard to take into account the myriad of English irregularities and it can interfere with languages different from English. In addition, whenever we add more lines of code to fix these exceptions, we complicate the code of Symfony and (very very very slightly) degrade its performance.

@wouterj
Copy link
Member
wouterj commented Apr 3, 2015

@javiereguiluz I think that the core team have understood your opinion on this class. It doesn't make sense to repeat it again and again.

@GerbenWijnja thank you for submitting a PR! If you know you're going to submit a PR, you don't have to create an issue. Issues are a way to discuss new features or to explain the problem, and let someone else fix it.

@jakzal
Copy link
Contributor
jakzal commented Apr 3, 2015

I agree with @javiereguiluz. We can't possibly account for every case and exception.

We need to find a solution though. Perhaps a solution would be to provide end users with a way to either map words or define rules themselves.

@wouterj
Copy link
Member
wouterj commented Apr 3, 2015

I've mentioned it a couple of times already during these discussions. But imo, we should keep using the StringUtil class, but also support the syntax proposed in this PR: #3819

This would mean that in this case, one can set movies|movie as the property_path and everything would have worked fine, without having to wait on another bug fix release.

fabpot added a commit that referenced this issue Apr 3, 2015
…jnja)

This PR was merged into the 2.3 branch.

Discussion
----------

[StringUtil] Fixed singularification of 'movies'

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #14189
| License       | MIT
| Doc PR        | n/a

The word 'movies' was singularified to 'movy'. There seem to be only two
words ending in 'ovies', which are 'movies' and 'anchovies'. The singular
of the latter is 'anchovy'. All other words ending in 'vies' singularify to
'vy', so the word 'movies' is an exception to the general rule.

Commits
-------

6f5e95b [StringUtil] Fixed singularification of 'movies'
@fabpot fabpot closed this as completed Apr 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
0