basic support for rails i18n

master-old
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"]

View File

@ -118,7 +118,7 @@ module ApplicationHelper
end
def link_main
link_to(_('Contacts'), contacts_path)
link_to( t(:contacts), contacts_path)
end
def alternator

View File

@ -4,15 +4,15 @@ module NavigationHelper
end
def link_send_mail
link_to(_('Compose'), :controller=>"webmail", :action=>"compose")
link_to( t(:compose), :controller=>"webmail", :action=>"compose")
end
def link_mail_prefs
link_to(_('Preferences'), :controller=>"webmail", :action=>"prefs")
link_to( t(:preferences), :controller=>"webmail", :action=>"prefs")
end
def link_mail_filters
link_to(_('Filters'), :controller=>"webmail", :action=>"filters")
link_to( t(:filters), :controller=>"webmail", :action=>"filters")
end
def folder_manage_link(folder)
@ -33,11 +33,11 @@ module NavigationHelper
end
def link_contact_add_one
link_to(_('Add one contact'), new_contact_path)
link_to(t(:add_one_contact), new_contact_path)
end
def link_contact_add_multiple
link_to(_('Add multiple'), :controller => "/contacts/contact", :action => "add_multiple")
link_to(t(:add_multiple), :controller => "/contacts/contact", :action => "add_multiple")
end
def link_contact_group_list
@ -45,21 +45,9 @@ module NavigationHelper
end
def link_folders
link_to(_('Folders'), :controller=>"/webmail", :action=>"messages")
link_to( t(:folders), :controller=>"/webmail", :action=>"messages")
end
def link_send_mail
link_to(_('Compose'), :controller=>"/webmail", :action=>"compose")
end
def link_mail_prefs
link_to(_('Preferences'), :controller=>"/webmail", :action=>"prefs")
end
def link_mail_filters
link_to(_('Filters'), :controller=>"/webmail", :action=>"filters")
end
private
def short_fn(folder)

View File

@ -3,16 +3,12 @@ require 'mail2screen'
module WebmailHelper
include Mail2Screen
def link_folders
link_to(_('Folders'), :controller=>"webmail", :action=>"messages")
end
def link_compose_new
link_to(_('Compose new mail'), :controller=>"webmail", :action=>"compose")
link_to(t(:compose_txt), :controller=>"webmail", :action=>"compose")
end
def link_refresh
link_to(_('Refresh'), :controller=>"webmail", :action=>"refresh")
link_to(t(:refresh), :controller=>"webmail", :action=>"refresh")
end
def link_message_list
@ -20,23 +16,23 @@ module WebmailHelper
end
def link_reply_to_sender(msg_id)
link_to(_('Reply'), :controller=>"webmail", :action=>"reply", :params=>{"msg_id"=>msg_id})
link_to(t(:reply), :controller=>"webmail", :action=>"reply", :params=>{"msg_id"=>msg_id})
end
def link_forward_message(msg_id)
link_to(_('Forward'), :controller=>"webmail", :action=>"forward", :params=>{"msg_id"=>msg_id})
link_to(t(:forward), :controller=>"webmail", :action=>"forward", :params=>{"msg_id"=>msg_id})
end
def link_flag_for_deletion(msg_id)
link_to(_('Delete'), :controller=>"webmail", :action=>"delete", :params=>{"msg_id"=>msg_id})
link_to(t(:delete), :controller=>"webmail", :action=>"delete", :params=>{"msg_id"=>msg_id})
end
def link_view_source(msg_id)
link_to(_('View source'), {:controller=>"webmail", :action=>"view_source", :params=>{"msg_id"=>msg_id}}, {'target'=>"_blank"})
link_to(t(:view_source), {:controller=>"webmail", :action=>"view_source", :params=>{"msg_id"=>msg_id}}, {'target'=>"_blank"})
end
def link_filter_add
link_to(_('Add filter'), :controller=>'webmail', :action=>'filter_add')
link_to(t(:add_filter), :controller=>'webmail', :action=>'filter_add')
end
def folder_link(folder)
@ -103,7 +99,7 @@ module WebmailHelper
def page_navigation_webmail(pages)
nav = "<p class='paginator'><small>"
nav << "(#{pages.length} #{_('Pages')}) &nbsp; "
nav << "(#{pages.length} #{t :pages}) &nbsp; "
window_pages = pages.current.window.pages
nav << "..." unless window_pages[0].first?
@ -117,10 +113,10 @@ module WebmailHelper
nav << "..." unless window_pages[-1].last?
nav << " &nbsp; "
nav << link_to(_('First'), :controller=>"webmail", :action=>'messages', :page=>@pages.first.number) << " | " unless @pages.current.first?
nav << link_to(_('Prev'), :controller=>"webmail", :action=>'messages', :page=>@pages.current.previous.number) << " | " if @pages.current.previous
nav << link_to(_('Next'), :controller=>"webmail", :action=>'messages', :page=>@pages.current.next.number) << " | " if @pages.current.next
nav << link_to(_('Last'), :controller=>"webmail", :action=>'messages', :page=>@pages.last.number) << " | " unless @pages.current.last?
nav << link_to(t(:first), :controller=>"webmail", :action=>'messages', :page=>@pages.first.number) << " | " unless @pages.current.first?
nav << link_to(t(:prev), :controller=>"webmail", :action=>'messages', :page=>@pages.current.previous.number) << " | " if @pages.current.previous
nav << link_to(t(:next), :controller=>"webmail", :action=>'messages', :page=>@pages.current.next.number) << " | " if @pages.current.next
nav << link_to(t(:last), :controller=>"webmail", :action=>'messages', :page=>@pages.last.number) << " | " unless @pages.current.last?
nav << "</small></p>"
@ -161,7 +157,7 @@ module WebmailHelper
private
def empty_trash_link(folder_name)
link_to(_('(Empty)'),
link_to( "(#{t :empty})",
{ :controller => "webmail", :action => "empty", :params=>{"folder_name"=>folder_name}},
:confirm => _('Do you really want to empty trash?'))
end

View File

@ -1,16 +1,16 @@
<h1><%= _('Contacts')%></h1>
<h1><%= t :contacts %></h1>
<div id="header">
<ul id="primary">
<li><%=link_folders%></li>
<li><%=link_send_mail%></li>
<li><%=link_mail_prefs%></li>
<li><%=link_mail_filters%></li>
<li><span><%= _('Contacts') %></span>
<li><span><%= t :contacts %></span>
<ul id="secondary">
<li><%=link_contact_add_one%></li>
<li><%=link_contact_add_multiple%></li>
<% if ret = session["return_to"] %>
<li><%=link_to(_('Back to message'), ret) %></li>
<li><%=link_to(t(:back_to_message), ret) %></li>
<% end %>
</ul>
</li>
@ -33,7 +33,7 @@
<%= link_to letter, contacts_path(:letter => letter) %>
<% end %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to _('Show all'), contacts_path %>
<%= link_to t(:show_all), contacts_path %>
</td>
</tr>
<tr>
@ -41,9 +41,9 @@
</tr>
<% if @mode == "choose" %>
<tr>
<th><%= _('To&nbsp;CC&nbsp;BCC')%></th>
<th><%= _('Name')%></th>
<th><%= _('E-mail')%></th>
<th><%= "#{t :to}&nbsp;#{t :cc}&nbsp;#{t :bcc}" %></th>
<th><%= t :name %></th>
<th><%= t :email %></th>
</tr>
<% for contact in @contacts %>
<tr class="<%= alternator %>">

View File

@ -5,11 +5,11 @@
<li><%=link_send_mail%></li>
<li><%=link_mail_prefs%></li>
<li><%=link_mail_filters%></li>
<li><span><%= _('Contacts') %></span>
<li><span><%= t :contacts %></span>
<ul id="secondary">
<li><%=link_contact_list%></li>
<% if ret = session["return_to"] %>
<li><%=link_to(_('Back to message'), ret) %></li>
<li><%=link_to(t(:back_to_message), ret) %></li>
<% end %>
</ul>
</li>
@ -25,9 +25,9 @@
<%= form_input(:hidden_field, 'contact', 'customer_id') %>
<table>
<%= form_input(:text_field, 'contact', 'fname', _('First name'), 'class'=>'two_columns') %>
<%= form_input(:text_field, 'contact', 'lname', _('Last name'), 'class'=>'two_columns') %>
<%= form_input((@contact.new_record? ? :text_field : :read_only_field), 'contact', 'email', _('E-mail'), 'class'=>'two_columns')%>
<%= form_input(:text_field, 'contact', 'fname', t(:first_name), 'class'=>'two_columns') %>
<%= form_input(:text_field, 'contact', 'lname', t(:last_name), 'class'=>'two_columns') %>
<%= form_input((@contact.new_record? ? :text_field : :read_only_field), 'contact', 'email', t(:email), 'class'=>'two_columns')%>
</table>
<% for group in @contactgroups %>

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= @htmllang %>" lang="<%= @htmllang %>">
<head>
<title><%=@title%></title>
<meta http-equiv="content-type" content="text/html; charset=<%= @charset %>" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/javascripts/global.js"></script>
<link rel="stylesheet" href="/stylesheets/admin.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/stylesheets/tabs.css" type="text/css" media="screen" />

View File

@ -2,8 +2,8 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= @htmllang %>" lang="<%= @htmllang %>">
<head>
<title><%=_('Mailr')%></title>
<meta http-equiv="content-type" content="text/html; charset=<%= @charset %>" />
<title><%= t :mailr %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/stylesheets/admin.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/stylesheets/tabs.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/stylesheets/mailr.css" type="text/css" media="screen" />

View File

@ -18,16 +18,16 @@
<form action="<%=url_for(:controller => 'login', :action => 'authenticate')%>" method="post">
<table class="form_layout">
<tr>
<th><label for="<%=_('Email')%>"><%=_('Email')%>:</label></th>
<th><label for="email"><%= t :email %>:</label></th>
<td><%= text_field "login_user", "email" %></td>
</tr>
<tr>
<th><label for="<%=_('Password')%>"><%=_('Password')%>:</label></th>
<th><label for="password"><%= t :password %>:</label></th>
<td><%= password_field "login_user", "password" %></td>
</tr>
<tr>
<td colspan="2" class="form_actions">
<input type="submit" name="submit" value="<%= _('Log In') %>"/>
<input type="submit" name="submit" value="<%= t :log_in %>"/>
</td>
</tr>
</table>

View File

@ -1,5 +1,5 @@
<div id="folders">
<h4><%=_('Folders')%><br/><%= link_to 'add/edit', folders_path %></h4>
<h4><%=t :folders %><br/><%= link_to 'add/edit', folders_path %></h4>
<hr/>
<ul>
<% @folders.each do |folder| -%>
@ -8,5 +8,5 @@
</ul>
</div>
<div style="text-align: center; padding: 10px;">
<input type="button" value="<%= _('Logout')%>" onclick="window.location='/login/logout'">
<input type="button" value="<%= t :logout %>" onclick="window.location='/login/logout'">
</div>

View File

@ -1,13 +1,13 @@
<a href='#' onclick='toggle_msg_search(true);'>
<%=_('Search')%><img id='img_msg_search' alt='open' src='/images/list_<%=@srch_img_src%>.gif'/>
<%= t :search%><img id='img_msg_search' alt='open' src='/images/list_<%=@srch_img_src%>.gif'/>
</a>
<div id="msg_search" class='<%=@srch_class%>'>
<%=_('Search in message field')%>&nbsp;
<%= t :search_txt %>&nbsp;
<select name="search_field">
<%= options_for_select(CDF::CONFIG[:mail_search_fields], @search_field)%>
</select>&nbsp;
<label for="search_value"><%=_('for')%></label>&nbsp;
<label for="search_value"><%= t :for %></label>&nbsp;
<input type="text" name="search_value" value="<%=@search_value%>" size='16' id='search_value'/>&nbsp;
<%= submit_tag(_('Search'), :name=>'op')%>&nbsp;
<%= submit_tag(_('Show all'), :name=>'op')%>
<%= submit_tag(t(:search), :name=>'op')%>&nbsp;
<%= submit_tag(t(:show_all), :name=>'op')%>
</div>

View File

@ -2,16 +2,16 @@
<%= render :partial => 'shared/folders' %>
<% } %>
<h1><%=_('Mailbox')%></h1>
<h1><%= t :mailbox%></h1>
<form name="composeMail" id='composeMail' action="/webmail/compose" enctype="multipart/form-data" method="post">
<div id="header">
<ul id="primary">
<li><%=link_folders%></li>
<li><span><%= _('Compose') %></span>
<li><%= link_folders %></li>
<li><span><%= t :compose %></span>
<ul id="secondary">
<li><%=link_compose_new%></li>
<li><a href='#' onclick="getFormField('composeMail').submit();"><%=_('Send')%></a></li>
<li><a href="#" onclick="chooseContacts();"><%= _('Choose addresses from contacts') %></a></li>
<li><%= link_compose_new %></li>
<li><a href='#' onclick="getFormField('composeMail').submit();"><%= t :send %></a></li>
<li><a href="#" onclick="chooseContacts();"><%= t :choose_address %></a></li>
</ul>
</li>
<li><%=link_mail_prefs%></li>
@ -24,13 +24,13 @@
<div id="msg-compose">
<input type="hidden" id="mail_toc" name="mail[toc]" value="<%=@mail.toc%>"/>
<input type="hidden" id="mail_op" name="op" value="<%=_('Send')%>"/>
<input type="hidden" id="mail_op" name="op" value="<%= t :send %>"/>
<div id="msghdr">
<table>
<tr><td><label for=''><%=_('To')%></label></td><td><%= text_field_with_auto_complete(:mail, :to, {"size"=>65}, :skip_style => true, :tokens=> ",") %></td></tr>
<tr><td><label for=''><%=_('CC')%></label></td><td><%= text_field_with_auto_complete(:mail, :cc, {"size"=>65}, :skip_style => true, :tokens=> ",") %></td></tr>
<tr><td><label for=''><%=_('BCC')%></label></td><td><%= text_field_with_auto_complete(:mail, :bcc, {"size"=>65}, :skip_style => true, :tokens=> ",") %></td></tr>
<tr><td><label for=''><%=_('Subject')%></label></td><td><%= text_field('mail', 'subject', {"size"=>65}) %></td></tr>
<tr><td><label for=''><%= t :to %></label></td><td><%= text_field_with_auto_complete(:mail, :to, {"size"=>65}, :skip_style => true, :tokens=> ",") %></td></tr>
<tr><td><label for=''><%= t :cc %></label></td><td><%= text_field_with_auto_complete(:mail, :cc, {"size"=>65}, :skip_style => true, :tokens=> ",") %></td></tr>
<tr><td><label for=''><%= t :bcc %></label></td><td><%= text_field_with_auto_complete(:mail, :bcc, {"size"=>65}, :skip_style => true, :tokens=> ",") %></td></tr>
<tr><td><label for=''><%= t :subject %></label></td><td><%= text_field('mail', 'subject', {"size"=>65}) %></td></tr>
</table>
<%= hidden_field('mail', 'from') %>
<%= hidden_field('mail', 'content_type') %>
@ -51,9 +51,9 @@
</table>
<% end %>
<hr/>
<label for="attachment"><%=_('Attachment')%>:</label><%=%><input type="file" name="attachment"/>
<input type="button" name="mail_add_attachement" value="<%=_('Add')%>"
onclick="getFormField('mail_op').value='<%=_('Add')%>';getFormField('composeMail').submit();">
<label for="attachment"><%= t :attachment %>:</label><%=%><input type="file" name="attachment"/>
<input type="button" name="mail_add_attachement" value="<%= t :add %>"
onclick="getFormField('mail_op').value='<%= t :add %>';getFormField('composeMail').submit();">
</div>
</div>
</div></div>

View File

@ -4,7 +4,7 @@
<li><%=link_folders%></li>
<li><%=link_send_mail%></li>
<li><%=link_mail_prefs%></li>
<li><span><%= _('Filters') %></span></li>
<li><span><%= t :filters %></span></li>
<li><%=link_main%></li>
</ul>
</div>

View File

@ -7,7 +7,7 @@
<li><%=link_folders%></li>
<li><%=link_send_mail%></li>
<li><%=link_mail_prefs%></li>
<li><span><%= _('Filters') %></span>
<li><span><%= t :filters %></span>
<ul id="secondary">
<li><%=link_filter_add%></li>
</ul>

View File

@ -1,7 +1,7 @@
<h1><%=_('Mailbox')%></h1>
<h1><%=t :mailbox %></h1>
<div id="header">
<ul id="primary">
<li><span><%= _('Folders') %></span>
<li><span><%= t :folders %></span>
<ul id="secondary">
<li><%=link_refresh%></li>
</ul>
@ -24,7 +24,7 @@
<div id="topmenu">
<ul class="actionmenu">
<li>
<%= link_to(_("&#171; Back to list"), :controller=>"webmail", :action=>"messages") %>
<%= link_to("&#171; #{t :back_to_list}", :controller=>"webmail", :action=>"messages") %>
</li>
<li><%=link_reply_to_sender(@msg_id)%></li>
<li><%=link_forward_message(@msg_id)%></li>

View File

@ -1,7 +1,7 @@
<h1><%=_('Mailbox')%></h1>
<h1><%= t :mailbox %></h1>
<div id="header">
<ul id="primary">
<li><span><%= _('Folders') %></span>
<li><span><%= t :folders %></span>
<ul id="secondary">
<li><%=link_refresh%></li>
</ul>
@ -23,24 +23,24 @@
<div id="msglist">
<h2><%= @folder_name %></h2>
<%= form_tag({:controller=>'webmail', :action=>'messages'})%>
<div class='notviscode'><input type="submit" name="op" value="<%=_('Search')%>" /></div>
<div class='notviscode'><input type="submit" name="op" value="<%= t :search %>" /></div>
<input type="hidden" name="page" value="<%=@page%>"/>
<a href='#' onclick='toggle_msg_operations(true);'>
<%=_('Operations')%><img id='img_msgops' alt='open' src='/images/list_<%=@ops_img_src%>.gif'/>
<%=t :operations%><img id='img_msgops' alt='open' src='/images/list_<%=@ops_img_src%>.gif'/>
</a>
<div id="msgops" class='<%=@ops_class%>'>
<h4><%=_('Operations on marked messages')%></h4>
<h4><%= t :operations_txt %></h4>
<span id="opch">
<%= submit_tag(_('delete'), :name=>'op')%>
<%= submit_tag(_('copy'), :name=> 'op')%>
<%= submit_tag(_('move'), :name=>'op')%>
<%= submit_tag(_('mark read'), :name=>'op')%>
<%= submit_tag(_('mark unread'), :name=>'op')%>
<%= submit_tag(t(:delete), :name=>'op')%>
<%= submit_tag(t(:copy), :name=> 'op')%>
<%= submit_tag(t(:move), :name=>'op')%>
<%= submit_tag(t(:mark_read), :name=>'op')%>
<%= submit_tag(t(:mark_unread), :name=>'op')%>
</span><br/>
<span id="destp">
<%=_('Destination for move and copy operations')%>&nbsp;
<%= t :destination_txt %>&nbsp;
<select name="cpdest" size="1">
<% for folder in @folders %>
<option value="<%=folder.name%>"><%=folder.name%></option>
@ -55,13 +55,13 @@
<tr>
<th width="1%"><input type="checkbox" name="allbox" onclick="checkAll(this.form)" style="margin: 0 0 0 4px" /></th>
<% if @folder_name == CDF::CONFIG[:mail_sent] %>
<th width="20%"><%= link_to(_('To'), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'to_flat')%></th>
<th width="20%"><%= link_to(t(:to), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'to_flat')%></th>
<% else %>
<th width="20%"><%= link_to(_('From'), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'from_flat')%></th>
<th width="20%"><%= link_to(t(:from), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'from_flat')%></th>
<% end%>
<th width='60%'><%= link_to(_('Subject'), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'subject')%></th>
<th><%= link_to(_('Date'), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'date')%></th>
<th><%= link_to(_('Size'), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'size')%></th>
<th width='60%'><%= link_to(t(:subject), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'subject')%></th>
<th><%= link_to(t(:date), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'date')%></th>
<th><%= link_to(t(:size), :controller=>'/webmail/webmail', :action=>'messages', :op=>'SORT', :page=>@page, :scc=>'size')%></th>
<th>&nbsp;</th>
</tr>
</thead>

View File

@ -1,12 +1,12 @@
<% content_for('sidebar') { %>
<%= render :partial => 'shared/folders' %>
<% } %>
<h1><%=_('Mailbox')%></h1>
<h1><%= t :mailbox %></h1>
<div id="header">
<ul id="primary">
<li><%=link_folders%></li>
<li><%=link_send_mail%></li>
<li><span><%= _('Preferences') %></span></li>
<li><span><%= t :preferences %></span></li>
<li><%=link_mail_filters%></li>
<li><%=link_main%></li>
</ul>
@ -18,34 +18,34 @@
<%= hidden_field "mailpref", "id" %>
<%= hidden_field "mailpref", "customer_id" %>
<table class="edit">
<%= form_input(:text_field, 'customer', 'fname', _('First name'), 'class'=>'two_columns') %>
<%= form_input(:text_field, 'customer', 'lname', _('Last name'), 'class'=>'two_columns') %>
<%= form_input(:text_field, 'customer', 'fname', t(:first_name), 'class'=>'two_columns') %>
<%= form_input(:text_field, 'customer', 'lname', t(:last_name), 'class'=>'two_columns') %>
<tr class="two_rows">
<td><label><%=_('Send type message')%></label></td>
<td><label><%= t :send_type %></label></td>
<td><select name="mailpref[mail_type]">
<%= options_for_select(CDF::CONFIG[:mail_send_types], @mailpref.mail_type)%>
</select></td>
</tr>
<tr class="two_rows">
<td><label><%=_('Messages per page')%></label></td>
<td><label><%= t :messages_per_page %></label></td>
<td><select name="mailpref[wm_rows]">
<%= options_for_select(CDF::CONFIG[:mail_message_rows], @mailpref.wm_rows)%>
</select></td>
</tr>
<tr class="two_rows">
<td><label for="mailpref_check_external_mail"><%=_('Check external mail?')%></label></td>
<td><label for="mailpref_check_external_mail"><%=t :check_external_mail %></label></td>
<td>
<%=check_box('mailpref', 'check_external_mail')%>
<%=_('Note that by selecting this option webmail system will try to log you using your original email on a local server.')%>
<%= t :check_external_mail_txt %>
</td>
</tr>
<tr class="two_rows">
<td colspan='2' class="buttonBar">
<input type="submit" name="op" value="<%=_('Save')%>"/>
<input type="button" value="<%=_('Cancel')%>" onclick="window.location='/webmail/webmail/folders'"/>
<input type="submit" name="op" value="<%= t :save %>"/>
<input type="button" value="<%= t :cancel %>" onclick="window.location='/webmail/webmail/folders'"/>
</td>
</tr>
</table>

View File

@ -64,7 +64,6 @@ rescue LoadError
end
require 'tmail_patch'
require 'gettext_extension'
$KCODE = 'u'
require 'jcode'

62
config/locales/en.yml Normal file
View File

@ -0,0 +1,62 @@
en:
mailr: Mailr
email: Email
password: Password
log_in: Log In
wrong_email_or_password: Wrong email or password specified.
mailbox: Mailbox
folders: Folders
empty: Empty
logout: Logout
compose: Compose
preferences: Preferences
filters: Filters
contacts: Contacts
search: Search
search_txt: Search in message field
refresh: Refresh
operations: Operations
operations_txt: Operations on marked messages
delete: delete
copy: copy
move: move
mark_read: mark read
mark_unread: mark unread
destination_txt: Destination for move and copy operations
for: for
to: To
subject: Subject
date: Date
size: Size
from: From
show_all: Show all
pages: Pages
first: First
prev: Prev
next: Next
last: Last
back_to_list: Back to list
back_to_message: Back to message
reply: Reply
forward: Forward
delete: Delete
view_source: View source
add_filter: Add filter
cc: CC
bcc: BCC
send: Send
choose_address: Choose addresses from contacts
compose_txt: Compose new mail
attachment: Attachment
add: Add
first_name: First name
last_name: Last name
send_type: Send type message
messages_per_page: Messages per page
check_external_mail: Check external mail?
check_external_mail_txt: Note that by selecting this option webmail system will try to log you using your original email on a local server.
save: Save
cancel: Cancel
add_one_contact: Add one contact
add_multiple: Add multiple
name: name

View File

@ -1,11 +0,0 @@
require 'gettext'
include GetText # we want to be able to translate everywhere
module GetText
# GetText has this behaviour that it saves the binding to the mo file
# on a file by file basis. Every ruby file gets its own binding. We have to
# override this behaviour because it doesn't make any sense for a web
# application. We want one message catalog for all our files.
module_function
def callersrc; '*' end
end

View File

@ -6,16 +6,16 @@ module Mail2Screen
ret = "<table class='messageheader' border='0' cellpadding='0' cellspacing='0' >\n"
ret << "<tbody>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{_('From')}:</td><td>#{address(mail.from_addrs, @msg_id)}</td></tr>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{_('To')}:</td><td>#{address(mail.to_addrs, @msg_id)}</td></tr>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{t :from}:</td><td>#{address(mail.from_addrs, @msg_id)}</td></tr>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{t :to}:</td><td>#{address(mail.to_addrs, @msg_id)}</td></tr>\n"
if @mail.cc_addrs
ret << " <tr><td class='label' nowrap='nowrap'>#{_('CC')}:</td><td>#{address(mail.cc_addrs, @msg_id)}</td></tr>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{t :cc}:</td><td>#{address(mail.cc_addrs, @msg_id)}</td></tr>\n"
end
if @mail.bcc_addrs
ret << " <tr><td class='label' nowrap='nowrap'>#{_('BCC')}:</td><td>#{address(mail.bcc_addrs, @msg_id)}</td></tr>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{t :bcc}:</td><td>#{address(mail.bcc_addrs, @msg_id)}</td></tr>\n"
end
ret << " <tr><td class='label' nowrap='nowrap'>#{_('Subject')}:</td><td>#{h(mime_encoded?(mail.subject) ? mime_decode(mail.subject) : mail.subject)}</dd>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{_('Date')}:</td><td>#{h message_date(mail.date)}</td></tr>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{t :subject}:</td><td>#{h(mime_encoded?(mail.subject) ? mime_decode(mail.subject) : mail.subject)}</dd>\n"
ret << " <tr><td class='label' nowrap='nowrap'>#{t :date}:</td><td>#{h message_date(mail.date)}</td></tr>\n"
if footer != ''
ret << " <tr><td class='label' nowrap='nowrap'>#{image_tag('attachment.png')}</td><td>#{footer}</td></tr>\n"
end