From f35db925c20a01b431c3dc85d0ea239695b135e1 Mon Sep 17 00:00:00 2001 From: Emilio Blanco Date: Thu, 24 Mar 2011 21:06:13 -0300 Subject: [PATCH] Added spanish translation and some fixes for rails 2.3.2 --- app/controllers/application_controller.rb | 8 + app/controllers/contacts_controller.rb | 4 +- app/views/contacts/index.html.erb | 8 +- app/views/contacts/new.html.erb | 8 +- app/views/webmail/compose.rhtml | 2 +- config/environment.rb | 4 +- config/routes.rb | 6 +- lib/webmail/mail2screen.rb | 2 +- locale/.messages.pot | 466 ------------------- locale/bg_BG/LC_MESSAGES/messages.mo | Bin 6864 -> 0 bytes locale/bg_BG/LC_MESSAGES/messages.po | 527 ---------------------- 11 files changed, 26 insertions(+), 1009 deletions(-) delete mode 100644 locale/.messages.pot delete mode 100644 locale/bg_BG/LC_MESSAGES/messages.mo delete mode 100644 locale/bg_BG/LC_MESSAGES/messages.po diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9e78181..4bb3e81 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,10 @@ class ApplicationController < ActionController::Base before_filter :user_login_filter before_filter :add_scripts + #before_filter :localize + + filter_parameter_logging :password protected def secure_user?() true end def secure_cust?() false end @@ -35,20 +38,25 @@ class ApplicationController < ActionController::Base end def localize + logger.info "LOCALIZEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" # We will use instance vars for the locale so we can make use of them in # the templates. @charset = 'utf-8' + logger.info "Paso 1" headers['Content-Type'] = "text/html; charset=#{@charset}" # Here is a very simplified approach to extract the prefered language # from the request. If all fails, just use 'en_EN' as the default. temp = if request.env['HTTP_ACCEPT_LANGUAGE'].nil? + logger.info "Paso 2" [] else + logger.info "Paso 3" request.env['HTTP_ACCEPT_LANGUAGE'].split(',').first.split('-') rescue [] end language = temp.slice(0) dialect = temp.slice(1) @language = language.nil? ? 'en' : language.downcase # default is en + logger.info @language # If there is no dialect use the language code ('en' becomes 'en_EN'). @dialect = dialect.nil? ? @language.upcase : dialect # The complete locale string consists of diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index c1a87e0..d5e7db4 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -58,7 +58,7 @@ class ContactsController < ApplicationController def add_from_mail cstr = params['cstr'] retmsg = params['retmsg'] - @session["return_to"] = url_for(:controller=>'/webmail/webmail', + session["return_to"] = url_for(:controller=>'/webmail/webmail', :action=>'folders', :msg_id=>retmsg) # parse string @@ -106,7 +106,7 @@ class ContactsController < ApplicationController @groups[g.id] = 0 } end - render :action => "add" + render :action => "new" end def import_preview diff --git a/app/views/contacts/index.html.erb b/app/views/contacts/index.html.erb index ecfb375..ae1f735 100644 --- a/app/views/contacts/index.html.erb +++ b/app/views/contacts/index.html.erb @@ -73,8 +73,8 @@ <% elsif @mode == "groups"%> - <%= _('Name')%> - <%= _('E-mail')%> + <%= t(:name)%> + <%= t(:email)%> <% for contact in @contacts %> @@ -94,8 +94,8 @@ <% else %> - <%= _('Name')%> - <%= _('E-mail')%> + <%= t(:name)%> + <%= t(:email)%>   <% for contact in @contacts %> diff --git a/app/views/contacts/new.html.erb b/app/views/contacts/new.html.erb index fa36be4..0b73341 100644 --- a/app/views/contacts/new.html.erb +++ b/app/views/contacts/new.html.erb @@ -1,4 +1,4 @@ -

<%=_('Edit/Create contact')%>

+

<%=t(:edit_create_contact)%>