basic support for rails i18n

This commit is contained in:
Eugene Korbut 2009-09-01 23:23:05 +11:00
parent ae789b1d84
commit 25d965d30a
23 changed files with 170 additions and 132 deletions

View file

@ -1,7 +1,6 @@
# The filters added to this controller will be run for all controllers in the application.
# Likewise will all the methods added be available for all controllers.
class ApplicationController < ActionController::Base
before_filter :localize
before_filter :user_login_filter
before_filter :add_scripts
@ -162,7 +161,12 @@ class ApplicationController < ActionController::Base
</script>'
tinymce
end
def _(text)
t text
end
helper_method :include_simple_tinymce
helper_method :include_simple_tinymce, :_
end

View file

@ -26,7 +26,7 @@ class LoginController < ApplicationController
end
else
@login_user = Customer.new
flash["error"] = _('Wrong email or password specified.')
flash["error"] = t :wrong_email_or_password
redirect_to :action => "index"
end
end

View file

@ -48,23 +48,23 @@ class WebmailController < ApplicationController
end
case operation_param
when _('copy') # copy
when t(:copy) # copy
msg_ids = []
messages_param.each { |msg_id, bool|
msg_ids << msg_id.to_i if bool == BOOL_ON and dst_folder != @folder_name } if messages_param
folder.copy_multiple(msg_ids, dst_folder) if msg_ids.size > 0
when _('move') # move
when t(:move) # move
msg_ids = []
messages_param.each { |msg_id, bool|
msg_ids << msg_id.to_i if bool == BOOL_ON and dst_folder != @folder_name } if messages_param
folder.move_multiple(msg_ids, dst_folder) if msg_ids.size > 0
when _('delete') # delete
when t(:delete) # delete
msg_ids = []
messages_param.each { |msg_id, bool| msg_ids << msg_id.to_i if bool == BOOL_ON } if messages_param
folder.delete_multiple(msg_ids) if msg_ids.size > 0
when _('mark read') # mark as read
when t(:mark_read) # mark as read
messages_param.each { |msg_id, bool| msg = folder.mark_read(msg_id.to_i) if bool == BOOL_ON } if messages_param
when _('mark unread') # mark as unread
when t(:mark_unread) # mark as unread
messages_param.each { |msg_id, bool| msg = folder.mark_unread(msg_id.to_i) if bool == BOOL_ON } if messages_param
when "SORT"
session['lsort'] = sort_query = params["scc"]