February 2020
Intermediate to advanced
496 pages
12h 36m
English
Now it’s time to begin providing the translated text. Let’s start with the layout, because it’s pretty visible. We replace any text that needs to be translated with calls to I18n.translate. Not only is this method conveniently aliased as I18n.t, but a helper named t is provided.
The parameter to the translate function is a unique dot-qualified name. We can choose any name we like, but if we use the t helper function provided, names that start with a dot will first be expanded using the name of the template. So, let’s do that:
| | <nav class="side_nav"> |
| | |
| | <div id="cart" class="carts"> |
| | |
| | <%= render_if @cart && @cart.line_items.any?, @cart ... |
Read now
Unlock full access