September 2016
Intermediate to advanced
488 pages
12h 21m
English
We start by creating a new configuration file that encapsulates our knowledge of what locales are available and which one is to be used as the default:
| | #encoding: utf-8 |
| | I18n.default_locale = :en |
| | |
| | LANGUAGES = [ |
| | ['English', 'en'], |
| | ["Español".html_safe, 'es'] |
| | ] |
This code is doing two things.
The first thing it does is use the I18n module to set the default locale. I18n is a funny name, but it sure beats typing out internationalization all the time. Internationalization, after all, starts with an i, ends with an n, and has eighteen letters in between.
Then it defines a list of associations between display names and locale names. Unfortunately, ...
Read now
Unlock full access