Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added a FrenchInflector for the String component#36929

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromAlexandre-T:french-inflector
Jul 31, 2020
Merged

Added a FrenchInflector for the String component#36929

fabpot merged 1 commit intosymfony:masterfromAlexandre-T:french-inflector
Jul 31, 2020

Conversation

@Alexandre-T
Copy link
Contributor

@Alexandre-TAlexandre-T commentedMay 23, 2020
edited
Loading

I read inthis blog post this sentence

Symfony Inflector component converts words between their singular and plural forms (for now, only in English)

So I created a FrenchInflector class implementing the InflectorInterface from the String component. This inflector uses regular expressions and it is tested in the FrenchInflectorTest with a lot of the french exceptions.

QA
Branchmaster
Bug fixno
New featureyes
Deprecationsno
LicenseMIT
Doc PRNot yet

Changelog has been updated, but I'm not sure I did it in the good paragraph.

I don't know if I should update the symfony/symfony-docs, but I have created an example and I could create a PR with it, if you want.

<?phpuseSymfony\Component\String\Inflector\FrenchInflector;$inflector =newFrenchInflector();$result =$inflector->singularize('dents');// ['dent']$result =$inflector->singularize('souris');// ['souris']$result =$inflector->singularize('messieurs');// ['monsieur']$result =$inflector->pluralize('cinquante');// ['cinquante']$result =$inflector->pluralize('pou');// ['poux']$result =$inflector->pluralize('cheval');// ['chevaux']

fabbot.io is detecting a typo, but this is not. The patch done by fabpot suggests to replace the french 'embarras' word by 'embarrass'. I shall not remove or replace it, because "embarras" is an invariant word.

YaFou reacted with thumbs up emojilinaori and Kocal reacted with rocket emoji
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nice thanks.
Here is my quick review.
Did you use any source we should mention to build this?

@Alexandre-T
Copy link
ContributorAuthor

Alexandre-T commentedMay 24, 2020
edited
Loading

Thanks for your review, Nicolas!

As source, I verified that I forgot no rules with this chapter onNouvelObs and I used a reversed dictionnary to find all nouns finishing with -al.

  • Do you want that I add the link to the source as you do it in EnglishInflector?
  • Should I use solution1 (private singleton) or solution2 (long declaration for static uninflectedWords)link to review?

I will update my PR as soon as I have your recommendations.

@Alexandre-T
Copy link
ContributorAuthor

Alexandre-T commentedJun 27, 2020
edited
Loading

Hi@nicolas-grekas ,
I fixed what you suggested in your reviews.
There is always a warning from fabbot.io that detects an error on the word: embarras. This is an invariable french word. I shouldn't replace it with embarrassment.
The bugs on Travis are due to other commits on master.

French inflector implements InflectorInterface, it uses regexp and it is tested in the FrenchInflectorTest
@Alexandre-T
Copy link
ContributorAuthor

Thanks for your review@GromNaN ! It's commited and pushed!

@fabpot
Copy link
Member

Thank you@Alexandre-T.

Alexandre-T reacted with thumbs up emoji

@fabpotfabpot merged commit5256323 intosymfony:masterJul 31, 2020
@nicolas-grekasnicolas-grekas modified the milestones:next,5.2Oct 5, 2020
@fabpotfabpot mentioned this pull requestOct 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@GromNaNGromNaNGromNaN left review comments

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

5 participants

@Alexandre-T@fabpot@nicolas-grekas@GromNaN@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp