Commit 40d65648 authored by Clement Ho's avatar Clement Ho

Merge branch '4929-internationalize-lock-files' into 'master'

Internationalize Locked files page

Closes #4929

See merge request gitlab-org/gitlab-ee!4620
parents b084f3a3 f366c5f9
......@@ -4,14 +4,14 @@ module Lfs
def execute
unless can?(current_user, :push_code, project)
raise Gitlab::GitAccess::UnauthorizedError, 'You have no permissions'
raise Gitlab::GitAccess::UnauthorizedError, _('You have no permissions')
end
unlock_file
rescue Gitlab::GitAccess::UnauthorizedError => ex
error(ex.message, 403)
rescue ActiveRecord::RecordNotFound
error('Lock not found', 404)
error(_('Lock not found'), 404)
rescue => ex
error(ex.message, 500)
end
......@@ -26,9 +26,9 @@ module Lfs
success(lock: lock, http_status: :ok)
elsif forced
error('You must have master access to force delete a lock', 403)
error(_('You must have master access to force delete a lock'), 403)
else
error("#{lock.path} is locked by GitLab User #{lock.user_id}", 403)
error(_("%{lock_path} is locked by GitLab User %{lock_user_id}") % { lock_path: lock.path, lock_user_id: lock.user_id }, 403)
end
end
......
---
title: Translate Locked files page
merge_request:
author:
type: other
......@@ -49,7 +49,7 @@ class Projects::PathLocksController < Projects::ApplicationController
def check_license
unless @project.feature_available?(:file_locks)
flash[:alert] = 'You need a different license to enable FileLocks feature'
flash[:alert] = _('You need a different license to enable FileLocks feature')
redirect_to admin_license_path
end
end
......
......@@ -33,9 +33,9 @@ class PathLock < ActiveRecord::Base
return unless existed_lock
if existed_lock.downstream?(path)
errors.add(:path, 'is invalid because there is downstream lock')
errors.add(:path, _('is invalid because there is downstream lock'))
elsif existed_lock.upstream?(path)
errors.add(:path, 'is invalid because there is upstream lock')
errors.add(:path, _('is invalid because there is upstream lock'))
end
end
end
......@@ -5,7 +5,7 @@ module PathLocks
include PathLocksHelper
def execute(path_lock)
raise AccessDenied, 'You have no permissions' unless can_unlock?(path_lock)
raise AccessDenied, _('You have no permissions') unless can_unlock?(path_lock)
path_lock.destroy
end
......
......@@ -6,7 +6,7 @@
.controls
- if can_unlock?(path_lock)
= link_to project_path_lock_path(@project, path_lock), class: 'btn btn-grouped btn-xs btn-remove remove-row has-tooltip', title: "Unlock", method: :delete, data: { confirm: "Are you sure you want to unlock #{path_lock.path}?", container: 'body' }, remote: true do
= link_to project_path_lock_path(@project, path_lock), class: 'btn btn-grouped btn-xs btn-remove remove-row has-tooltip', title: _("Unlock"), method: :delete, data: { confirm: _("Are you sure you want to unlock %{path_lock_path}?") % { path_lock_path: path_lock.path }, container: 'body' }, remote: true do
= icon("trash-o")
locked by #{path_lock.user.name} #{time_ago_with_tooltip(path_lock.created_at)}
= _("locked by %{path_lock_user_name} %{created_at}") % { path_lock_user_name: path_lock.user.name, created_at: time_ago_with_tooltip(path_lock.created_at) }
- @no_container = true
- page_title "File Locks"
- page_title _("Locked Files")
%div{ class: (container_class) }
.top-area
.nav-text
Locks give the ability to lock specific file or folder.
= _("Locks give the ability to lock specific file or folder.")
.locks
- if @path_locks.any?
......@@ -14,4 +14,4 @@
= paginate @path_locks, theme: 'gitlab'
- else
.nothing-here-block
Repository has no locks.
= _("Repository has no locks.")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment