I am just localizing a Rails app for the first time and I wonder if there’s a shorter way to say this:
flash[:success] = t('.views.person.flash_messages.person_was_successfully_updated')
This is an excerpt of my de.yml file:
de:
views:
person:
flash_messages:
person_was_successfully_updated: "Person aktualisiert."
I would looove to say something like this:
flash[:success] = t('person_was_successfully_updated')
But Rails is giving me an error, when I try to do so.
I don’t understand why because person_was_successfully_updated is absolutely unique in my .yml file and I don’t see the need for typing in the entire path every time. This is not very DRY either.
Any ideas?
I would looove to say something like this
If you want to call
person_was_successfully_updateddirectly then you should put that in first level. i.e., under de:..But Rails is giving me an error, when I try to do so.
Yes it will definitely give error because there is no
person_was_successfully_updatedin root level.For more info. http://guides.rubyonrails.org/i18n.html