After installing Globalize and adding the following lines to the files:
environment.rb at the end:
include Globalize
Locale.set_base_language ‘es-ES’
Locale.set(‘es-ES’)
LOCALES = {‘es’ => ‘es-ES’,
‘en’ => ‘en-EN’}.freeze
routes.rb at the begining:
map.connect ‘:locale/:controller/:action/:id’
application.rb:
before_filter :set_locale
def set_locale
begin
Locale.set params[:locale]
rescue ArgumentError
redirect_to params.merge( ‘locale’ => Locale.base_language.code )
end
end
some accentuated strings now give me a lot of problems that they were
not giving before the Globalize installation.I have a controller in
which:
@options << option("Investigación","investigacion","index")
throws the following error:
./script/…/config/…/app/controllers/menu_controller.rb:14: parse
error, unexpected tIDENTIFIER, expecting ‘)’
@options << option(“Investigaci�n”,“investigacion”,“index”)
^
This can be solved changing “Investigación” with “Investigacion”. But
I’ve read that the base language can be the one of your choice. Because
all the basic content of the web is spanish I decided to set the base
language to spanish.
I’m worried because I thought that the web that I’m trying to
internationalize (to english) should work perfectly in spanish as it was
before.
If someone had this problem and knows where the problem is, I would
appreciate a little help with the question.
Best regards