Translations and Internationalization

Bullet Train and views generated by Super Scaffolding are localized by default, meaning all of the human-readable text in your application has been extracted into a YAML configuration file in config/locales/en and can be translated into any language you would like to target.

We override the native I18n translation method to automatically include the current team name or other objects depending on the string. For example, here's a description of a membership which you can find on a membership's show page:

The following are the details for David’s Membership on Your Team.

The view can be found here in the bullet_train-base gem:
bullet_train-base/app/views/account/memberships/show.html.erb

Looking at the view, you can see we are only passing a key to the translation method for I18n to process:

<%= t('.description') %>

However, looking at the locale itself, you can see that the string takes two variables, memberships_possessive and team_name, to complete the string:

description: The following are the details for %{memberships_possessive} Membership on %{team_name}.

Usually, you would pass the variable as a keyword argument:

t('.description', memberships_possessive: memberships_possessive, team_name: current_team.name)

However, in Bullet Train, we override the original translation method to include variable names like this automatically in our locales. Check out the locale helper to get a closer look at how we handle strings for internationalization. For example, the two variables above are generated by the method model_locales in the locale helper.

You can find more information in the indirection documentation about using bin/resolve and logs to pinpoint where your locales are coming from.