Support the ongoing development of Laravel.io →
posted 10 years ago
IOC
Last updated 2 years ago.
0

Did you check this:

'apples' => '{0} There are none|[1,19] There are some|[20,Inf] There are many',

from the documentation? (http://laravel.com/docs/localization)

Last updated 2 years ago.
0

I have but I was trying to use the first example they have in the documentation:

'apples' => 'There is one apple|There are many apples',
echo Lang::choice('apples', 10);

I have pretty much exactly the same thing as the first example in the documentation:

'customer' => 'customer|customers';
$num_customers = count($customer_array);
echo Lang::choice('customer', $num_customers);

And it works fine as long as $num_customers < 20. As soon as it becomes larger, that's when the error shows up without changing anything other than that $num_customers.

I'm trying to keep it simpler than using :

'customer' => '[0,1] customer|[2,Inf] customers',
Last updated 2 years ago.
0

Never mind. I have figured it out. I was trying to translate it into Ro and apparently there's different pluralization rules for 'ro' for numbers such as 101, 102, ... 119, 201, 202... 219... etc... and that's what was causing the issue.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

DOOMitru doomitru Joined 9 May 2014

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.