diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2019-04-16 13:32:05 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-04-16 13:32:05 +0300 |
commit | 9e753eeb9f9ba63a4e8ff50076f6c3e250ceb26c (patch) | |
tree | 23a928a6ead45ed34788f202bc40b03bdfd4dda6 /app | |
parent | a55dc72f1a1c04aa9ce099cb3ced2eaa485a1f2d (diff) |
Externalize several strings in
- app/services
- app/controllers
- app/presenters
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/jwt_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/ldap/omniauth_callbacks_controller.rb | 2 | ||||
-rw-r--r-- | app/presenters/merge_request_presenter.rb | 11 | ||||
-rw-r--r-- | app/services/clusters/applications/install_service.rb | 4 | ||||
-rw-r--r-- | app/services/clusters/applications/patch_service.rb | 4 | ||||
-rw-r--r-- | app/services/clusters/applications/upgrade_service.rb | 4 | ||||
-rw-r--r-- | app/services/files/update_service.rb | 2 |
7 files changed, 18 insertions, 15 deletions
diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb index 49d21456f8e..5ecf4f114cf 100644 --- a/app/controllers/jwt_controller.rb +++ b/app/controllers/jwt_controller.rb @@ -39,9 +39,9 @@ class JwtController < ApplicationController render json: { errors: [ { code: 'UNAUTHORIZED', - message: "HTTP Basic: Access denied\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}" } + message: _('HTTP Basic: Access denied\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}') % { profile_personal_access_tokens_url: profile_personal_access_tokens_url } } ] }, status: :unauthorized end diff --git a/app/controllers/ldap/omniauth_callbacks_controller.rb b/app/controllers/ldap/omniauth_callbacks_controller.rb index 5e872804448..9a5a45939e0 100644 --- a/app/controllers/ldap/omniauth_callbacks_controller.rb +++ b/app/controllers/ldap/omniauth_callbacks_controller.rb @@ -26,7 +26,7 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController override :fail_login 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 end diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index 284b1ad9b55..e4a62deda7a 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -50,7 +50,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated if user_can_fork_project? && cached_can_be_reverted? continue_params = { 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 } @@ -64,7 +64,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated if user_can_fork_project? && can_be_cherry_picked? continue_params = { 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 } @@ -156,8 +156,11 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ).assignable_issues path = assign_related_issues_project_merge_request_path(project, merge_request) if issues.present? - pluralize_this_issue = issues.count > 1 ? "these issues" : "this issue" - link_to "Assign yourself to #{pluralize_this_issue}", path, method: :post + if issues.count > 1 + link_to _('Assign yourself to these issues'), path, method: :post + else + link_to _('Assign yourself to this issue'), path, method: :post + end end # rubocop: enable CodeReuse/ServiceClass end diff --git a/app/services/clusters/applications/install_service.rb b/app/services/clusters/applications/install_service.rb index b37ac510ff4..dffb4ce65ab 100644 --- a/app/services/clusters/applications/install_service.rb +++ b/app/services/clusters/applications/install_service.rb @@ -22,10 +22,10 @@ module Clusters ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) rescue Kubeclient::HttpError => 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 log_error(e) - app.make_errored!('Failed to install.') + app.make_errored!(_('Failed to install.')) end end end diff --git a/app/services/clusters/applications/patch_service.rb b/app/services/clusters/applications/patch_service.rb index 977a5e91041..fbea18bae6b 100644 --- a/app/services/clusters/applications/patch_service.rb +++ b/app/services/clusters/applications/patch_service.rb @@ -22,10 +22,10 @@ module Clusters ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) rescue Kubeclient::HttpError => 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 log_error(e) - app.make_errored!('Failed to update.') + app.make_errored!(_('Failed to update.')) end end end diff --git a/app/services/clusters/applications/upgrade_service.rb b/app/services/clusters/applications/upgrade_service.rb index 813a9c4d071..ac68e64af38 100644 --- a/app/services/clusters/applications/upgrade_service.rb +++ b/app/services/clusters/applications/upgrade_service.rb @@ -24,10 +24,10 @@ module Clusters ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) rescue Kubeclient::HttpError => 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 log_error(e) - app.make_errored!('Failed to upgrade.') + app.make_errored!(_('Failed to upgrade.')) end end end diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index 2b3e96e6c53..54ab07da680 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -19,7 +19,7 @@ module Files super 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 |