framework icon indicating copy to clipboard operation
framework copied to clipboard

[11.x] Improved translation for displaying the count of errors in the validation message

Open andrey-helldar opened this issue 1 year ago • 1 comments

The https://github.com/laravel/framework/pull/50546 (this is a fix for https://github.com/laravel/framework/issues/50534) solved the problem of message translation. I now propose to consider improving the translation of plurals.

In English, the plural will always be "plural", but in other languages, such as Ukrainian, Russian and many others, the plural has two forms.

For example:

Count English Russian Ukrainian
1 error ошибка помилка
2 errors ошибки помилки
5 errors ошибок помилок

It turns out that now, even with the translation, there will be an incorrect definition of the plural form. For example, "и ещё 4 ошибок". There is a grammatical error here and it is correct to write "и ещё 4 ошибки".

Thus, we come to the point where we can not only bring back the old functionality I added earlier, but also improve it. What do you think about that?

// uk.json
{
    "(and :count more error)": "(та ще :count помилка)"
    "(and :count more errors)": "(та ще :count помилка)|(та ще :count помилки)|(та ще :count помилок)"
}

In this way, the current structure of phrase formation will be preserved, and it will also make it possible to do grammatically correct translations into different languages with multiple forms of plurals.

andrey-helldar avatar Mar 14 '24 16:03 andrey-helldar

The tests show errors, but they are not related to my code.

andrey-helldar avatar Mar 14 '24 16:03 andrey-helldar