Prev | Current Page 396 | Next

Brad Ediger

"Advanced Rails"

html.erb



<%= @person_form.text_field :first_name %>




<%= @person_form.text_field :last_name %>




<%= @person_form.text_field :home_phone %>




<%= @person_form.text_field :office_phone %>




<%= @person_form.text_field :mobile_phone %>




<%= @person_form.text_area :address, :size => '30x5' %>




<%= @person_form.text_field :country %>


Next, we need to integrate Globalize into the controllers. We will use an initializer to
set up Globalize and some locale settings for the application.
config/initializers/globalize.rb
include Globalize
Locale.set_base_language 'en-US'
LOCALES = {
'en' => 'en-US',
'es' => 'es-MX'
}.freeze
The Locale.set_base_language method tells Globalize that our views are in U.S.
English, and it need not bother with translation if the user??™s locale is the same.
266 | Chapter 8: i18n and L10n
The LOCALES hash is a list mapping two-letter language codes to the actual locale
names that Globalize uses.


Pages:
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408