Change Pluralizer Rules #34564
Unanswered
cristian-home
asked this question in
General
Replies: 1 comment
-
anything news? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a project in Laravel which has model names, fields and messages in Spanish, I am currently using
laravel-shift/blueprint
to generate all the base code of the application from ayaml
file, at the moment of Laravel infer the pluralization of the names for the migrations, controllers, variables etc, it makes them treating the words as English words, for example:Looking at the framework I realized that in the file
vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php
uses the Doctrine Inflector rules for the English language to create the inflector instance that Laravel uses:I edited the file to use the Spanish rules:
So the pluralization works as I expected for the Spanish words.
Is there any way to tell laravel to use the Spanish rules without having to change code inside the vendor folder?
P.S.
Previously I used a service provider that extended the array of irregular words in the rules for plural in inflector:
but this doesn't seem to work anymore in Laravel 7 and Laravel 8
Thank you in advance for your time and help.
Beta Was this translation helpful? Give feedback.
All reactions