Externalize several strings in

- app/services
- app/controllers
- app/presenters
This commit is contained in:
Martin Wortschack 2019-04-16 10:32:05 +00:00 committed by Sean McGivern
parent a55dc72f1a
commit 9e753eeb9f
8 changed files with 48 additions and 15 deletions

View file

@ -39,9 +39,9 @@ class JwtController < ApplicationController
render json: { render json: {
errors: [ errors: [
{ code: 'UNAUTHORIZED', { code: 'UNAUTHORIZED',
message: "HTTP Basic: Access denied\n" \ message: _('HTTP Basic: Access denied\n' \
"You must use a personal access token with 'api' scope for Git over HTTP.\n" \ 'You must use a personal access token with \'api\' scope for Git over HTTP.\n' \
"You can generate one at #{profile_personal_access_tokens_url}" } 'You can generate one at %{profile_personal_access_tokens_url}') % { profile_personal_access_tokens_url: profile_personal_access_tokens_url } }
] ]
}, status: :unauthorized }, status: :unauthorized
end end

View file

@ -26,7 +26,7 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController
override :fail_login override :fail_login
def fail_login(user) def fail_login(user)
flash[:alert] = 'Access denied for your LDAP account.' flash[:alert] = _('Access denied for your LDAP account.')
redirect_to new_user_session_path redirect_to new_user_session_path
end end

View file

@ -50,7 +50,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
if user_can_fork_project? && cached_can_be_reverted? if user_can_fork_project? && cached_can_be_reverted?
continue_params = { continue_params = {
to: merge_request_path(merge_request), to: merge_request_path(merge_request),
notice: "#{edit_in_new_fork_notice} Try to cherry-pick this commit again.", notice: _('%{edit_in_new_fork_notice} Try to cherry-pick this commit again.') % { edit_in_new_fork_notice: edit_in_new_fork_notice },
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
@ -64,7 +64,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
if user_can_fork_project? && can_be_cherry_picked? if user_can_fork_project? && can_be_cherry_picked?
continue_params = { continue_params = {
to: merge_request_path(merge_request), to: merge_request_path(merge_request),
notice: "#{edit_in_new_fork_notice} Try to revert this commit again.", notice: _('%{edit_in_new_fork_notice} Try to revert this commit again.') % { edit_in_new_fork_notice: edit_in_new_fork_notice },
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
@ -156,8 +156,11 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
).assignable_issues ).assignable_issues
path = assign_related_issues_project_merge_request_path(project, merge_request) path = assign_related_issues_project_merge_request_path(project, merge_request)
if issues.present? if issues.present?
pluralize_this_issue = issues.count > 1 ? "these issues" : "this issue" if issues.count > 1
link_to "Assign yourself to #{pluralize_this_issue}", path, method: :post link_to _('Assign yourself to these issues'), path, method: :post
else
link_to _('Assign yourself to this issue'), path, method: :post
end
end end
# rubocop: enable CodeReuse/ServiceClass # rubocop: enable CodeReuse/ServiceClass
end end

View file

@ -22,10 +22,10 @@ module Clusters
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e rescue Kubeclient::HttpError => e
log_error(e) log_error(e)
app.make_errored!("Kubernetes error: #{e.error_code}") app.make_errored!(_('Kubernetes error: %{error_code}') % { error_code: e.error_code })
rescue StandardError => e rescue StandardError => e
log_error(e) log_error(e)
app.make_errored!('Failed to install.') app.make_errored!(_('Failed to install.'))
end end
end end
end end

View file

@ -22,10 +22,10 @@ module Clusters
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e rescue Kubeclient::HttpError => e
log_error(e) log_error(e)
app.make_errored!("Kubernetes error: #{e.error_code}") app.make_errored!(_('Kubernetes error: %{error_code}') % { error_code: e.error_code })
rescue StandardError => e rescue StandardError => e
log_error(e) log_error(e)
app.make_errored!('Failed to update.') app.make_errored!(_('Failed to update.'))
end end
end end
end end

View file

@ -24,10 +24,10 @@ module Clusters
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e rescue Kubeclient::HttpError => e
log_error(e) log_error(e)
app.make_errored!("Kubernetes error: #{e.error_code}") app.make_errored!(_('Kubernetes error: %{error_code}') % { error_code: e.error_code })
rescue StandardError => e rescue StandardError => e
log_error(e) log_error(e)
app.make_errored!('Failed to upgrade.') app.make_errored!(_('Failed to upgrade.'))
end end
end end
end end

View file

@ -19,7 +19,7 @@ module Files
super super
if file_has_changed?(@file_path, @last_commit_sha) if file_has_changed?(@file_path, @last_commit_sha)
raise FileChangedError, "You are attempting to update a file that has changed since you started editing it." raise FileChangedError, _('You are attempting to update a file that has changed since you started editing it.')
end end
end end
end end

View file

@ -114,6 +114,12 @@ msgid_plural "%{count} participants"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "%{edit_in_new_fork_notice} Try to cherry-pick this commit again."
msgstr ""
msgid "%{edit_in_new_fork_notice} Try to revert this commit again."
msgstr ""
msgid "%{filePath} deleted" msgid "%{filePath} deleted"
msgstr "" msgstr ""
@ -1056,6 +1062,12 @@ msgstr ""
msgid "Assign to" msgid "Assign to"
msgstr "" msgstr ""
msgid "Assign yourself to these issues"
msgstr ""
msgid "Assign yourself to this issue"
msgstr ""
msgid "Assigned Issues" msgid "Assigned Issues"
msgstr "" msgstr ""
@ -3940,6 +3952,9 @@ msgstr ""
msgid "Failed to deploy to" msgid "Failed to deploy to"
msgstr "" msgstr ""
msgid "Failed to install."
msgstr ""
msgid "Failed to load emoji list." msgid "Failed to load emoji list."
msgstr "" msgstr ""
@ -3976,6 +3991,12 @@ msgstr ""
msgid "Failed to update issues, please try again." msgid "Failed to update issues, please try again."
msgstr "" msgstr ""
msgid "Failed to update."
msgstr ""
msgid "Failed to upgrade."
msgstr ""
msgid "Failed to upload object map file" msgid "Failed to upload object map file"
msgstr "" msgstr ""
@ -4500,6 +4521,9 @@ msgstr ""
msgid "GroupsTree|Search by name" msgid "GroupsTree|Search by name"
msgstr "" msgstr ""
msgid "HTTP Basic: Access denied\\nYou must use a personal access token with 'api' scope for Git over HTTP.\\nYou can generate one at %{profile_personal_access_tokens_url}"
msgstr ""
msgid "Header logo was successfully removed." msgid "Header logo was successfully removed."
msgstr "" msgstr ""
@ -5117,6 +5141,9 @@ msgstr ""
msgid "Kubernetes configured" msgid "Kubernetes configured"
msgstr "" msgstr ""
msgid "Kubernetes error: %{error_code}"
msgstr ""
msgid "Kubernetes service integration has been deprecated. %{deprecated_message_content} your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page" msgid "Kubernetes service integration has been deprecated. %{deprecated_message_content} your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page"
msgstr "" msgstr ""
@ -10341,6 +10368,9 @@ msgstr ""
msgid "You are attempting to delete a file that has been previously updated." msgid "You are attempting to delete a file that has been previously updated."
msgstr "" msgstr ""
msgid "You are attempting to update a file that has changed since you started editing it."
msgstr ""
msgid "You are going to remove %{group_name}. Removed groups CANNOT be restored! Are you ABSOLUTELY sure?" msgid "You are going to remove %{group_name}. Removed groups CANNOT be restored! Are you ABSOLUTELY sure?"
msgstr "" msgstr ""