Translations - plural singular / more complex way

Hi guys,

Does any of you has an idea about a solution for translating singular / plural in a more complex way ? I say more complex, because in certain languages (like Romanian) the plural or the singular can completely modify the syntax. For example:

English: 1 minute ago Romanian: Acum 1 minut (or In urma cu 1 minut)

English: 2 minutes ago Romanian: Acum 2 minute

English: 21 minutes ago Romanian: Acum 21 de minute

This is a dummy example, but the things can go more complex than this. So, if any of you has an idea about how i can manage this without adding tons of different translations ... you are the man ! :)

Look at Intl PHP extension and Message Formatter it provides. You can extend basic translate adopter and implement support for parameters passed into underscore method for example.



32.7k

Thanks @roman-kulish,

I am already using it. I was thinking at some already made solution what Zend and Symfony are using, i don't like it. I'll continue extending my own using the intl extension. Thanks.