Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translations #4

Merged
merged 12 commits into from
May 3, 2011
2 changes: 1 addition & 1 deletion app/controllers/admins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create
@user.is_admin = true

if @user.save
redirect_to new_session_url, :notice => 'The admin user was created successfully. You can now sign in.'
redirect_to new_session_url, :notice => t(:admin_user_created_successfully)
else
render :action => 'new'
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ def require_login
def require_existing_target_folder
@target_folder = Folder.find(params[:folder_id])
rescue ActiveRecord::RecordNotFound
redirect_to folder_url(Folder.root), :alert =>'Someone else deleted this folder. Your action was cancelled.'
redirect_to folder_url(Folder.root), :alert => t(:folder_already_deleted)
end

def require_create_permission
unless current_user.can_create(@target_folder)
redirect_to folder_url(@target_folder), :alert =>"You don't have create permissions for this folder."
redirect_to folder_url(@target_folder), :alert => t(:no_create_permissions)
end
end

['read', 'update', 'delete'].each do |method|
define_method "require_#{method}_permission" do
unless current_user.send("can_#{method}", @folder) || @folder.is_root?
redirect_to folder_url(@folder.parent), :alert =>"You don't have #{method} permissions for this folder."
redirect_to folder_url(@folder.parent), :alert => t(:no_permissions_for_this_folder, :method => method)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/clipboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ClipboardController < ApplicationController
# @item is set in require_existing_item
def create
clipboard.add(@item)
redirect_to folder_url(params[:folder_id]), :notice => 'Successfully added to clipboard.'
redirect_to folder_url(params[:folder_id]), :notice => t(:added_to_clipboard)
end

# @item is set in require_existing_item
Expand All @@ -30,7 +30,7 @@ def copy
clipboard.remove(@item)
redirect_to folder_url(params[:folder_id])
rescue ActiveRecord::RecordInvalid
redirect_to folder_url(params[:folder_id]), :alert => "Couldn't copy. A #{params[:type]} with the same name exists already."
redirect_to folder_url(params[:folder_id]), :alert => t(:could_not_copy, :type => params[:type])
end

# @item is set in require_existing_item
Expand All @@ -40,7 +40,7 @@ def move
clipboard.remove(@item)
redirect_to folder_url(params[:folder_id])
rescue ActiveRecord::RecordInvalid
redirect_to folder_url(params[:folder_id]), :alert => "Couldn't move. A #{params[:type]} with the same name exists already."
redirect_to folder_url(params[:folder_id]), :alert => t(:could_not_move, :type => params[:type])
end

private
Expand All @@ -53,21 +53,21 @@ def require_existing_item
@folder = @item.folder
end
rescue ActiveRecord::RecordNotFound
redirect_to folder_url(params[:folder_id]), :alert => "Someone else deleted this #{params[:type]}. Your action was cancelled."
redirect_to folder_url(params[:folder_id]), :alert => t(:could_not_delete, :type => params[:type])
end

def require_target_is_not_child
if params[:type] == 'folder'
if @folder == @target_folder || @folder.parent_of?(@target_folder)
redirect_to folder_url(params[:folder_id]), :alert => 'You cannot move a folder to its own sub-folder.'
redirect_to folder_url(params[:folder_id]), :alert => t(:cannot_move_to_own_subfolder)
end
end
end

['read', 'delete'].each do |method|
define_method "require_#{method}_permission" do
unless current_user.send("can_#{method}", @folder)
redirect_to folder_url(params[:folder_id]), :alert => "You don't have #{method} permissions for this #{params[:type]}."
redirect_to folder_url(params[:folder_id]), :alert => t(:no_permissions_for_this_type, :method => method, :type => params[:type])
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def edit
# @file and @folder are set in require_existing_file
def update
if @file.update_attributes(params[:user_file])
redirect_to edit_file_url(@file), :notice => 'Your changes were saved successfully.'
redirect_to edit_file_url(@file), :notice => t(:your_changes_were_saved)
else
render :action => 'edit'
end
Expand All @@ -53,6 +53,6 @@ def require_existing_file
@file = UserFile.find(params[:id])
@folder = @file.folder
rescue ActiveRecord::RecordNotFound
redirect_to folder_url(Folder.root), :alert =>'Someone else deleted this file. Your action was cancelled.'
redirect_to folder_url(Folder.root), :alert => t(:file_already_deleted)
end
end
10 changes: 5 additions & 5 deletions app/controllers/folders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def edit
# Note: @folder is set in require_existing_folder
def update
if @folder.update_attributes(params[:folder])
redirect_to edit_folder_url(@folder), :notice => 'Your changes were saved successfully.'
redirect_to edit_folder_url(@folder), :notice => t(:your_changes_were_saved)
else
render :action => 'edit'
end
Expand All @@ -57,19 +57,19 @@ def destroy
def require_existing_folder
@folder = Folder.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to folder_url(Folder.root), :alert => 'Someone else deleted this folder. Your action was cancelled.'
redirect_to folder_url(Folder.root), :alert => t(:folder_already_deleted)
end

def require_folder_isnt_root_folder
if @folder.is_root?
redirect_to folder_url(Folder.root), :alert => 'The root folder cannot be deleted or renamed.'
redirect_to folder_url(Folder.root), :alert => t(:cannot_delete_root_folder)
end
end

# Overrides require_delete_permission in ApplicationController
def require_delete_permission
unless current_user.can_delete(@folder) || @folder.is_root?
redirect_to folder_url(@folder.parent), :alert => "You don't have delete permissions for this folder."
redirect_to folder_url(@folder.parent), :alert => t(:no_delete_permissions_for_folder)
else
require_delete_permissions_for(@folder.children)
end
Expand All @@ -78,7 +78,7 @@ def require_delete_permission
def require_delete_permissions_for(folders)
folders.each do |folder|
unless current_user.can_delete(folder)
redirect_to folder_url(@folder.parent), :alert => "You don't have delete permissions for one of the subfolders."
redirect_to folder_url(@folder.parent), :alert => t(:no_delete_permissions_for_subfolder)
else
# Recursive...
require_delete_permissions_for(folder.children)
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def edit
# Note: @group is set in require_existing_group
def update
if @group.update_attributes(params[:group])
redirect_to edit_group_url(@group), :notice => 'Your changes were saved successfully.'
redirect_to edit_group_url(@group), :notice => t(:your_changes_were_saved)
else
render :action => 'edit'
end
Expand All @@ -45,12 +45,12 @@ def destroy
def require_existing_group
@group = Group.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to groups_url, :alert => 'Someone else deleted this group. Your action was cancelled.'
redirect_to groups_url, :alert => t(:group_already_deleted)
end

def require_group_isnt_admins_group
if @group.admins_group?
redirect_to groups_url, :alert => 'The admins group cannot be deleted or renamed.'
redirect_to groups_url, :alert => t(:admins_group_cannot_be_deleted)
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/permissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def update_multiple
update_children(folder.children, permissions) if params[:recursive] && folder.has_children?
redirect_to folder_url(folder)
rescue ActiveRecord::RecordNotFound # Folder was deleted, so permissions are gone too
redirect_to folder_url(Folder.root), :alert => 'Someone else deleted this folder. Your action was cancelled.'
redirect_to folder_url(Folder.root), :alert => t(:folder_already_deleted)
end

private
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/reset_password_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def create
unless user.nil?
user.refresh_reset_password_token
UserMailer.reset_password_email(user).deliver
flash[:notice] = 'Email with instructions sent successfully. Please check your email.'
flash[:notice] = t(:instruction_email_sent)
else
flash[:alert] = "There is no user with email address '#{params[:email]}'. Please try again."
flash[:alert] = t(:no_user_with_this_email, :email => params[:email]);
end

redirect_to new_reset_password_url
Expand All @@ -27,7 +27,7 @@ def edit
# @user is set in require_valid_token
def update
if @user.update_attributes(params[:user].merge({ :password_required => true }))
redirect_to new_session_url, :notice => 'Your password was reset successfully. You can now sign in.'
redirect_to new_session_url, :notice => t(:password_reset_successfully)
else
render :action => 'edit'
end
Expand All @@ -39,7 +39,7 @@ def require_valid_token
@user = User.find_by_reset_password_token(params[:id])

if @user.nil? || @user.reset_password_token_expires_at < Time.now
redirect_to new_reset_password_url, :alert => 'The URL for resetting your password expired. Please try again.'
redirect_to new_reset_password_url, :alert => t(:reset_url_expired)
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create
session[:return_to] = nil
else
log_failed_sign_in_attempt(Time.now, params[:username], request.remote_ip)
redirect_to new_session_url, :alert => 'Username and/or password were incorrect. Try again.'
redirect_to new_session_url, :alert => t(:credentials_incorrect)
end
end

Expand Down
10 changes: 5 additions & 5 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def edit
def update
if @user.update_attributes(params[:user].merge({ :password_required => false }))
set_groups
redirect_to edit_user_url(@user), :notice => 'Your changes were saved successfully.'
redirect_to edit_user_url(@user), :notice => t(:your_changes_were_saved)
else
render :action => 'edit'
end
Expand All @@ -46,19 +46,19 @@ def destroy

def require_existing_user
if current_user.member_of_admins? && params[:id] != current_user.id.to_s
@title = 'Edit user'
@title = t(:edit_user)
@user = User.find(params[:id])
else
@title = 'Account settings'
@title = t(:account_settings)
@user = current_user
end
rescue ActiveRecord::RecordNotFound
redirect_to users_url, :alert => 'Someone else deleted the user. Your action was cancelled.'
redirect_to users_url, :alert => t(:user_already_deleted)
end

def require_deleted_user_isnt_admin
if @user.is_admin
redirect_to users_url, :alert => 'The admin user cannot be deleted.'
redirect_to users_url, :alert => t(:admin_user_cannot_be_deleted)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UserMailer < ActionMailer::Base
def reset_password_email(user)
@user = user
mail(:to => user.email, :subject => '[Boxroom] Password reset instructions')
mail(:to => user.email, :subject => t(:password_reset_subject))
end
end
6 changes: 3 additions & 3 deletions app/views/admins/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<% content_for :title, 'Create admin' -%>
<% content_for :title, t(:create_admin) -%>

<h1><%= content_for :title %></h1>
<p>
Boxroom does not have an administrator yet. Create one here.
<%=t :no_administrator_yet %>
</p>
<%= form_for @user, :url => { :action => 'create' } do |f| %>
<%= f.error_messages %>
Expand All @@ -23,6 +23,6 @@
<%= f.password_field :password_confirmation, { :class => 'text_input' } %>
</p>
<p>
<%= f.submit 'Create admin account' %>
<%= f.submit <%=t :create_admin_account %>
</p>
<% end %>
3 changes: 3 additions & 0 deletions app/views/clipboard/_clipboard_empty.en.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The clipboard is empty. Go <%= link_to_function 'back', 'show_folder();' %> and use the
'Add to clipboard' button (<%= image_tag('clipboard_add.png', :alt => 'Add to clipboard') %>)
to add files or folders to the clipboard.
3 changes: 3 additions & 0 deletions app/views/clipboard/_clipboard_empty.nl.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Het plakbord is leeg. Ga <%= link_to_function 'terug', 'show_folder();' %> en gebruik de
'Toevoegen aan plakbord' knop (<%= image_tag('clipboard_add.png', :alt => 'Toevoegen aan plakbord') %>)
om bestanden en mappen toe te voegen aan het plakbord.
36 changes: 17 additions & 19 deletions app/views/clipboard/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
<p>
<span class="clipboard_empty">
<%= image_tag('information.png', :alt => 'Notice', :class => 'clipboard_info_image') %>
The clipboard is empty. Go <%= link_to_function 'back', 'show_folder();' %> and use the
'Add to clipboard' button (<%= image_tag('clipboard_add.png', :alt => 'Add to clipboard') %>)
to add files or folders to the clipboard.
<%= render :partial => 'clipboard/clipboard_empty' %>
</span>
</p>
<% else -%>
<table id="clipboard_table">
<tr>
<th></th>
<th>Name</th>
<th><%=t :name %></th>
<th></th>
</tr>
<% reset_cycle -%>
Expand All @@ -21,20 +19,20 @@
<td class="clipboard_item"><%= item.name %></td>
<td>
<% if current_user.can_create(@folder) -%>
<%= link_to image_tag('copy.png', :alt => 'Copy'),
<%= link_to image_tag('copy.png', :alt => t(:copy)),
{ :controller => :clipboard, :action => :copy, :id => item.id, :type => 'folder', :folder_id => @folder, :authenticity_token => form_authenticity_token },
:method => :post, :title => 'Copy folder'
:method => :post, :title => t(:copy_folder)
%>&nbsp;
<% end -%>
<% if current_user.can_create(@folder) && current_user.can_delete(item) -%>
<%= link_to image_tag('move.png', :alt => 'Move'),
<%= link_to image_tag('move.png', :alt => t(:move)),
{ :controller => :clipboard, :action => :move, :id => item.id, :type => 'folder', :folder_id => @folder, :authenticity_token => form_authenticity_token },
:method => :post, :title => 'Move folder', :confirm => 'Are you sure?'
:method => :post, :title => t(:move_folder), :confirm => t(:are_you_sure)
%>&nbsp;
<% end -%>
<%= link_to image_tag('delete.png', :alt => 'Delete'),
<%= link_to image_tag('delete.png', :alt => t(:delete)),
{ :controller => :clipboard, :action => :destroy, :id => item.id, :type => 'folder', :folder_id => @folder, :authenticity_token => form_authenticity_token },
:method => :delete, :title => 'Remove from clipboard'
:method => :delete, :title => t(:remove_from_clipboard)
%>
</td>
</tr>
Expand All @@ -45,32 +43,32 @@
<td class="clipboard_item"><%= item.attachment_file_name %></td>
<td>
<% if current_user.can_create(@folder) -%>
<%= link_to image_tag('copy.png', :alt => 'Copy'),
<%= link_to image_tag('copy.png', :alt => t(:copy)),
{ :controller => :clipboard, :action => :copy, :id => item.id, :type => 'file', :folder_id => @folder, :authenticity_token => form_authenticity_token },
:method => :post, :title => 'Copy file'
:method => :post, :title => t(:copy_file)
%>&nbsp;
<% end -%>
<% if current_user.can_create(@folder) && current_user.can_delete(item.folder) -%>
<%= link_to image_tag('move.png', :alt => 'Move'),
<%= link_to image_tag('move.png', :alt => t(:move)),
{ :controller => :clipboard, :action => :move, :id => item.id, :type => 'file', :folder_id => @folder, :authenticity_token => form_authenticity_token },
:method => :post, :title => 'Move file', :confirm => 'Are you sure?'
:method => :post, :title => t(:move_file), :confirm => t(:are_you_sure)
%>&nbsp;
<% end -%>
<%= link_to image_tag('delete.png', :alt => 'Delete'),
<%= link_to image_tag('delete.png', :alt => t(:delete)),
{ :controller => :clipboard, :action => :destroy, :id => item.id, :type => 'file', :folder_id => @folder, :authenticity_token => form_authenticity_token },
:method => :delete, :title => 'Remove from clipboard'
:method => :delete, :title => t(:remove_from_clipboard)
%>
</td>
</tr>
<% end -%>
</table>
<p>
<span class="back">
<%= button_to 'Clear clipboard',
<%= button_to t(:clear_clipboard),
{ :controller => :clipboard, :action => :reset, :folder_id => @folder, :authenticity_token => form_authenticity_token }, :method => :put
%>
&nbsp; &mdash; &nbsp;
<%= link_to_function 'Back', 'show_folder();' %>
<%= link_to_function t(:back), 'show_folder();' %>
</span>
</p>
<% end -%>
<% end -%>
6 changes: 3 additions & 3 deletions app/views/files/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% content_for :title, 'Rename file' -%>
<% content_for :title, t(:rename_file) -%>

<h1><%= content_for :title %></h1>
<% if flash[:notice] -%>
Expand All @@ -13,7 +13,7 @@
<%= f.text_field :attachment_file_name %>
</p>
<p>
<%= f.submit 'Save' %> &nbsp; &mdash; &nbsp;
<%= link_to 'Back', folder_url(@folder) %>
<%= f.submit t(:save) %> &nbsp; &mdash; &nbsp;
<%= link_to t(:back), folder_url(@folder) %>
</p>
<% end %>
Loading