I am looking over the source code for rubygems.org to further understand Rails and how to use it with a functional site.
One question I have is what exactly do these do?:
<%= t 'download_count', :count => number_with_delimiter(@downloads_count) %>
<%= t '.welcome_blurb' %>
Are download_count and .welcome_blurb variables that store the text somewhere? If so, where do I find that and how does it know where to look?
download_countand.welcome_blurbare translated strings, you can find them in theconfig/locales/directory in a file with a filename corresponding to the language, in this caseen.ymlfor English:download_count: https://github.com/rubygems/rubygems.org/blob/master/config/locales/en.yml#L11.welcome_blurb: https://github.com/rubygems/rubygems.org/blob/master/config/locales/en.yml#L31The dot before
welcome_blurbsignifies a lazy lookup, which means that the namespace for the translation defaults to the view you are calling it from, as you’ll see in theen.ymlfile:So
.welcome_blurbactually meanshome.index.welcome_blurb.See the rails i18n documentation for more details.