* work on Issue 9: localization of controlers texts possible

git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@24 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
vit.jonas@gmail.com 2011-05-09 09:39:56 +00:00
parent e6fbbab6a0
commit 807a454df4
11 changed files with 205 additions and 40 deletions

View File

@ -211,7 +211,7 @@ class DmsfController < ApplicationController
def check_project(entry)
if !entry.nil? && entry.project != @project
raise DmsfAccessError, "Entry project doesn't match current project"
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
end
end

View File

@ -28,10 +28,10 @@ class DmsfDetailController < ApplicationController
def create_folder
@new_folder = DmsfFolder.create_from_params(@project, @folder, params[:dmsf_folder])
if @new_folder.valid?
flash[:notice] = "Folder created"
flash[:notice] = l(:notice_folder_created)
Rails.logger.info "#{Time.now} from #{request.remote_ip}/#{request.env["HTTP_X_FORWARDED_FOR"]}: #{User.current.login} created folder #{@project.identifier}://#{@new_folder.dmsf_path_str}"
else
flash[:error] = "Folder creation failed: Title must be entered"
flash[:error] = l(:error_folder_creation_failed) + ": " + l(:error_folder_title_must_be_entered)
end
redirect_to({:controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder})
@ -42,10 +42,10 @@ class DmsfDetailController < ApplicationController
if !@delete_folder.nil?
if @delete_folder.subfolders.empty? && @delete_folder.files.empty?
@delete_folder.destroy
flash[:notice] = "Folder deleted"
flash[:notice] = l(:notice_folder_deleted)
Rails.logger.info "#{Time.now} from #{request.remote_ip}/#{request.env["HTTP_X_FORWARDED_FOR"]}: #{User.current.login} deleted folder #{@project.identifier}://#{@delete_folder.dmsf_path_str}"
else
flash[:error] = "Folder is not empty"
flash[:error] = l(:error_folder_is_not_empty)
end
end
@ -61,7 +61,7 @@ class DmsfDetailController < ApplicationController
@folder.description = params[:description]
if params[:title].blank?
flash.now[:error] = "Title must be entered"
flash.now[:error] = l(:error_folder_title_must_be_entered)
render "folder_detail"
return
end
@ -69,14 +69,14 @@ class DmsfDetailController < ApplicationController
@folder.name = params[:title]
if !@folder.valid?
flash.now[:error] = "Title is already used"
flash.now[:error] = l(:error_folder_title_is_already_used)
render "folder_detail"
return
end
@folder.save!
Rails.logger.info "#{Time.now} from #{request.remote_ip}/#{request.env["HTTP_X_FORWARDED_FOR"]}: #{User.current.login} updated folder #{@project.identifier}://#{@folder.dmsf_path_str}"
flash[:notice] = "Folder details were saved"
flash[:notice] = l(:notice_folder_details_were_saved)
redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder
end
@ -87,12 +87,12 @@ class DmsfDetailController < ApplicationController
def delete_file
if !@file.nil?
if @file.locked_for_user?
flash[:error] = "File is locked"
flash[:error] = l(:error_file_is_locked)
else
@file.deleted = true
@file.deleted_by_user = User.current
@file.save
flash[:notice] = "File deleted"
flash[:notice] = l(:notice_file_deleted)
Rails.logger.info "#{Time.now} from #{request.remote_ip}/#{request.env["HTTP_X_FORWARDED_FOR"]}: #{User.current.login} deleted file #{@project.identifier}://#{@file.dmsf_path_str}"
DmsfMailer.deliver_files_deleted(User.current, [@file])
end
@ -104,16 +104,16 @@ class DmsfDetailController < ApplicationController
@revision = DmsfFileRevision.find(params[:revision_id])
check_project(@revision.file)
if @revision.file.locked_for_user?
flash[:error] = "File is locked"
flash[:error] = l(:error_file_is_locked)
else
if !@revision.nil? && !@revision.deleted
if @revision.file.revisions.size <= 1
flash[:error] = "At least one revision must be present"
flash[:error] = l(:error_at_least_one_revision_must_be_present)
else
@revision.deleted = true
@revision.deleted_by_user = User.current
@revision.save
flash[:notice] = "Revision deleted"
flash[:notice] = l(:notice_revision_deleted)
Rails.logger.info "#{Time.now} from #{request.remote_ip}/#{request.env["HTTP_X_FORWARDED_FOR"]}: #{User.current.login} deleted revision #{@project.identifier}://#{@revision.file.dmsf_path_str}/#{@revision.id}"
end
end
@ -162,7 +162,7 @@ class DmsfDetailController < ApplicationController
commited_files.each_value do |commited_file|
file = DmsfFile.from_commited_file(@project, @folder, commited_file)
if file.locked_for_user?
flash[:error] = "One of files locked"
flash[:warning] = l(:warning_one_of_files_locked)
else
revision = DmsfFileRevision.from_commited_file(file, commited_file)
file.unlock if file.locked?
@ -185,16 +185,16 @@ class DmsfDetailController < ApplicationController
#TODO: don't create revision if nothing change
def save_file
if @file.locked_for_user?
flash[:error] = "File locked"
flash[:error] = l(:error_file_is_locked)
else
saved_file = params[:file]
DmsfFileRevision.from_saved_file(@file, saved_file)
if @file.locked?
@file.unlock
flash[:notice] = "File unlocked, "
flash[:notice] = l(:notice_file_unlocked) + ", "
end
@file.reload
flash[:notice] = (flash[:notice].nil? ? "" : flash[:notice]) + "File revision created"
flash[:notice] = (flash[:notice].nil? ? "" : flash[:notice]) + l(:notice_file_revision_created)
Rails.logger.info "#{Time.now} from #{request.remote_ip}/#{request.env["HTTP_X_FORWARDED_FOR"]}: #{User.current.login} created new revision of file #{@project.identifier}://#{@file.dmsf_path_str}"
begin
DmsfMailer.deliver_files_updated(User.current, [@file])
@ -226,7 +226,7 @@ class DmsfDetailController < ApplicationController
def check_project(entry)
if !entry.nil? && entry.project != @project
raise DmsfAccessError, "Entry project doesn't match current project"
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
end
end

View File

@ -52,46 +52,46 @@ class DmsfStateController < ApplicationController
@user_pref = DmsfUserPref.for(@project, User.current)
@user_pref.email_notify = params[:email_notify];
@user_pref.save
flash[:notice] = "Your preferences was saved"
flash[:notice] = l(:notice_your_preferences_were_saved)
redirect_to URI.unescape(params[:current])
end
def folder_notify_activate
if @folder.notification
flash[:warning] = "Folder notifications already activated"
flash[:warning] = l(:warning_folder_notifications_already_activated)
else
@folder.notify_activate
flash[:notice] = "Folder notifications activated"
flash[:notice] = l(:notice_folder_notifications_activated)
end
redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder
end
def folder_notify_deactivate
if !@folder.notification
flash[:warning] = "Folder notifications already deactivated"
flash[:warning] = l(:warning_folder_notifications_already_deactivated)
else
@folder.notify_deactivate
flash[:notice] = "Folder notifications deactivated"
flash[:notice] = l(:notice_folder_notifications_deactivated)
end
redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder
end
def file_notify_activate
if @file.notification
flash[:warning] = "File notifications already activated"
flash[:warning] = l(:warning_file_notifications_already_activated)
else
@file.notify_activate
flash[:notice] = "File notifications activated"
flash[:notice] = l(:notice_file_notifications_activated)
end
redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder
end
def file_notify_deactivate
if !@file.notification
flash[:warning] = "File notifications already deactivated"
flash[:warning] = l(:warning_file_notifications_already_deactivated)
else
@file.notify_deactivate
flash[:notice] = "File notifications deactivated"
flash[:notice] = l(:notice_file_notifications_deactivated)
end
redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder
end
@ -117,7 +117,7 @@ class DmsfStateController < ApplicationController
def check_project(entry)
if !entry.nil? && entry.project != @project
raise DmsfAccessError, "Entry project doesn't match current project"
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
end
end

View File

@ -259,7 +259,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
runtimes : 'gears,html5,flash,html4',
url : '<%= url_for({:controller => "dmsf_detail", :action => "upload_file", :id => @project, :folder_id => @folder}) %>',
max_file_size : "100mb",
max_file_count: <%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i %>,
max_file_count: '<%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i %>',
multipart: true,
multipart_params : {authenticity_token : jQuery("input[name=authenticity_token]").val()},

View File

@ -12,4 +12,30 @@ cs:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"

View File

@ -1,5 +1,4 @@
# English strings go here for Rails i18n
en:
de:
:dmsf: "DMSF"
:label_dmsf_file_plural: "Dmsf files"
:warning_no_entries_selected: "No entries selected"
@ -13,4 +12,28 @@ en:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"

View File

@ -1,5 +1,4 @@
# English strings go here for Rails i18n
en:
en-GB:
:dmsf: "DMSF"
:label_dmsf_file_plural: "Dmsf files"
:warning_no_entries_selected: "No entries selected"
@ -13,4 +12,28 @@ en:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"

View File

@ -1,4 +1,3 @@
# English strings go here for Rails i18n
en:
:dmsf: "DMSF"
:label_dmsf_file_plural: "Dmsf files"
@ -13,4 +12,28 @@ en:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"

View File

@ -1,5 +1,4 @@
# English strings go here for Rails i18n
en:
es:
:dmsf: "DMSF"
:label_dmsf_file_plural: "Dmsf files"
:warning_no_entries_selected: "No entries selected"
@ -13,4 +12,28 @@ en:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"

View File

@ -1,5 +1,4 @@
# English strings go here for Rails i18n
en:
fr:
:dmsf: "DMSF"
:label_dmsf_file_plural: "Dmsf files"
:warning_no_entries_selected: "No entries selected"
@ -13,4 +12,28 @@ en:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"

View File

@ -1,5 +1,4 @@
# English strings go here for Rails i18n
en:
ru:
:dmsf: "DMSF"
:label_dmsf_file_plural: "Dmsf files"
:warning_no_entries_selected: "No entries selected"
@ -13,4 +12,29 @@ en:
:question_do_you_really_want_to_delete_this_entry: "Do you really want to delete this entry?"
:error_max_files_exceeded: "Limit for number of simultaneously downloadable files exceeded: "
:question_do_you_really_want_to_delete_this_revision: "Do you really want to delete this revision?"
:error_entry_project_does_not_match_current_project: "Entry project doesn't match current project"
:notice_folder_created: "Folder created"
:error_folder_creation_failed: "Folder creation failed"
:error_folder_title_must_be_entered: "Title must be entered"
:notice_folder_deleted: "Folder deleted"
:error_folder_is_not_empty: "Folder is not empty"
:error_folder_title_is_already_used: "Title is already used"
:notice_folder_details_were_saved: "Folder details were saved"
:error_file_is_locked: "File is locked"
:notice_file_deleted: "File deleted"
:error_at_least_one_revision_must_be_present: "At least one revision must be present"
:notice_revision_deleted: "Revision deleted"
:warning_one_of_files_locked: "One of files locked"
:notice_file_unlocked: "File unlocked"
:notice_file_revision_created: "File revision created"
:notice_your_preferences_were_saved: "Your preferences were saved"
:warning_folder_notifications_already_activated: "Folder notifications already activated"
:notice_folder_notifications_activated: "Folder notifications activated"
:warning_folder_notifications_already_deactivated: "Folder notifications already deactivated"
:notice_folder_notifications_deactivated: "Folder notifications deactivated"
:warning_file_notifications_already_activated: "File notifications already activated"
:notice_file_notifications_activated: "File notifications activated"
:warning_file_notifications_already_deactivated: "File notifications already deactivated"
:notice_file_notifications_deactivated: "File notifications deactivated"