czukowski / I18n_Plural

I18n module for grammatically correct plural inflections, and maybe even some extra features related to i18n.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation message's?

opened this issue · comments

Validation class returns the message, which also must be inflected depending on the parameter, such as ':field must be exactly :param1 characters long'

Yes, it's an issue, but I can't see a good solution for that yet.
We'd need to override some Kohana code to handle that, but that isn't as big deal as that there are sometimes multiple parameters in validation messages, and the ___() can handle only one for now.
If you have ideas, please let me know.

I think, it can be one of solution:

Some method replace pattern "{:count word}" in translated string to another translation. Fragment of translation file.
http://kohana.pastebin.com/XvU7UnRb

So, if you want to get the string
if the 1 minut plus 23 minutes is 24 minutes then I'm late

=>

if the {:time1 minute} plus {:time2 minute} is {:result minute} then I'm :what

An attempt has been made to solve this, see https://github.com/czukowski/I18n_Plural/blob/5efe8ff20992d6f677b10332427a8e38507086fe/classes/i18n/validation.php or README for details.

Although I'm not 100% happy with how this works, I wouldn't like to complicate things more than they're now unless it becomes absolutely necessary, so for now I'm going to leave it this way.