Search code examples
ruby-on-railsinternationalizationi18n-gem

Rails I18n not replacing variable


I'm having trouble with some of my translations not having their variable replacements replaced with the text I supply and instead just outputting the translation literally.

An example translation

formats:
   view_all_other: "View all other %{format_title}"

An example use (HAML)

= link_to t('formats.view_all_other', format_title: @format.title.downcase), "/#{@format.to_param}/all"

What gets output

enter image description here

I've been scouring the web, but I haven't seen anyone with this issue. This is the first time I've used i18n but it doesn't look like I've got anything set up wrong, other translations work correctly (including ones with variable replacements).


Solution

  • facepalm I'd had issues with another translation and I initially called the variable 'format', I suspected it might be a reserved word or something of the sort so I changed all the translations to use format_title and forgot to update the views.