Support the ongoing development of Laravel.io →
Configuration
Last updated 1 year ago.
0

Hi Ricardo,

Here how to pluralize or singularize irregular strings (based on old Laravel 4 issue #2101) for Laravel 4:

<?php
// Fails:
// echo str_plural('bureau');// → 'bureaus'

$newIrregular = ['bureau' => 'bureaux'];
$oldIrregular = \Illuminate\Support\Pluralizer::$irregular;
\Illuminate\Support\Pluralizer::$irregular = array_merge($oldIrregular, $newIrregular);

// Success:
echo str_plural('bureau');// → 'bureaux'

Cheers, Tortue Torche

Last updated 7 years ago.
0

And here how to pluralize or singularize irregular strings for Laravel 5:

// Fails:
// echo str_plural('bureau');// → 'bureaus'

$newIrregularRules = ['bureau' => 'bureaux'];
\Doctrine\Common\Inflector\Inflector::rules('plural', [
    'irregular' => $newIrregularRules
]);

// Success:
echo str_plural('bureau');// → 'bureaux'
Last updated 7 years ago.
0

I think this topic can be marked as solved.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.