← Back to Upcase

Question about Upcase _head_contents.html.erb partial


(Acandael Acandael) #1

Hi,

In the Upcase repository, in the app/views/application/_head_contents.html.erb partial, there is a piece of code I’m not fully understand. I guess it shows a default description when no specific desription value is passed to the layout file:

<meta http-equiv="Description" name="Description" content="<%= yield(:meta_description).presence || t('layouts.meta_description') %>" />

What does this t() do? and where does layouts.meta_description come from?

thanks for the advice,

greetings,

Anthony


(Frank West) #2

It is a rails helper method for internationalization.

http://guides.rubyonrails.org/i18n.html
http://apidock.com/rails/ActionView/Helpers/TranslationHelper/translate

layouts.meta_description comes from config/locales/{language}.yml


(Acandael Acandael) #3

Hi Frank,

Thanks for the explanation!

greetings,

Anthony