Commit f366c5f9 authored by André Luís's avatar André Luís Committed by Clement Ho

Internationalize Locked files page

parent b084f3a3
...@@ -4,14 +4,14 @@ module Lfs ...@@ -4,14 +4,14 @@ module Lfs
def execute def execute
unless can?(current_user, :push_code, project) unless can?(current_user, :push_code, project)
raise Gitlab::GitAccess::UnauthorizedError, 'You have no permissions' raise Gitlab::GitAccess::UnauthorizedError, _('You have no permissions')
end end
unlock_file unlock_file
rescue Gitlab::GitAccess::UnauthorizedError => ex rescue Gitlab::GitAccess::UnauthorizedError => ex
error(ex.message, 403) error(ex.message, 403)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
error('Lock not found', 404) error(_('Lock not found'), 404)
rescue => ex rescue => ex
error(ex.message, 500) error(ex.message, 500)
end end
...@@ -26,9 +26,9 @@ module Lfs ...@@ -26,9 +26,9 @@ module Lfs
success(lock: lock, http_status: :ok) success(lock: lock, http_status: :ok)
elsif forced 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 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
end end
......
---
title: Translate Locked files page
merge_request:
author:
type: other
...@@ -49,7 +49,7 @@ class Projects::PathLocksController < Projects::ApplicationController ...@@ -49,7 +49,7 @@ class Projects::PathLocksController < Projects::ApplicationController
def check_license def check_license
unless @project.feature_available?(:file_locks) 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 redirect_to admin_license_path
end end
end end
......
...@@ -33,9 +33,9 @@ class PathLock < ActiveRecord::Base ...@@ -33,9 +33,9 @@ class PathLock < ActiveRecord::Base
return unless existed_lock return unless existed_lock
if existed_lock.downstream?(path) 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) 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 end
end end
...@@ -5,7 +5,7 @@ module PathLocks ...@@ -5,7 +5,7 @@ module PathLocks
include PathLocksHelper include PathLocksHelper
def execute(path_lock) 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 path_lock.destroy
end end
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.controls .controls
- if can_unlock?(path_lock) - 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") = 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 - @no_container = true
- page_title "File Locks" - page_title _("Locked Files")
%div{ class: (container_class) } %div{ class: (container_class) }
.top-area .top-area
.nav-text .nav-text
Locks give the ability to lock specific file or folder. = _("Locks give the ability to lock specific file or folder.")
.locks .locks
- if @path_locks.any? - if @path_locks.any?
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
= paginate @path_locks, theme: 'gitlab' = paginate @path_locks, theme: 'gitlab'
- else - else
.nothing-here-block .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