Translation in .yml with optional parameter

Yes, definitely. You just write the translations like this:

my_translation: This is my translation with an optional parameter which value is %{parameter}

Is the parameter really optional? In above translation, you have to provide all parameters.

UPDATE: Sorry, I answered too soon. I don’t think it’s easy to do. Maybe the easiest way is like this:

> I18n.t('my_translation1')
=> "This is my translation"
> I18n.t('my_translation2', parameter: 1)
=> "This is my translation with an optional parameter which value is 1"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)