diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2019-03-27 16:52:52 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-03-27 16:52:52 +0000 |
commit | 5660690787b6afcf3274af4135d474645d13b671 (patch) | |
tree | 740ad2a1d105c33f464c81bb70fc2e815d692d07 /app/controllers/import | |
parent | 98824f3e97e24a5d6cb0688167bc8411a74739fc (diff) | |
download | gitlab-ce-5660690787b6afcf3274af4135d474645d13b671.tar.gz |
Externalize strings in projects controllers
- concerns
- dashboard
- groups
- import
Diffstat (limited to 'app/controllers/import')
-rw-r--r-- | app/controllers/import/bitbucket_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/import/fogbugz_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/import/gitea_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/import/gitlab_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/import/gitlab_projects_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/import/google_code_controller.rb | 12 |
7 files changed, 20 insertions, 20 deletions
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index 2b1395f364f..293d76ea765 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -62,7 +62,7 @@ class Import::BitbucketController < Import::BaseController render json: { errors: project_save_error(project) }, status: :unprocessable_entity end else - render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity + render json: { errors: _('This namespace has already been taken! Please choose another one.') }, status: :unprocessable_entity end end diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index f333e43b892..643a3bfed1f 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -25,7 +25,7 @@ class Import::BitbucketServerController < Import::BaseController repo = bitbucket_client.repo(@project_key, @repo_slug) unless repo - return render json: { errors: "Project #{@project_key}/#{@repo_slug} could not be found" }, status: :unprocessable_entity + return render json: { errors: _("Project %{project_repo} could not be found") % { project_repo: "#{@project_key}/#{@repo_slug}" } }, status: :unprocessable_entity end project_name = params[:new_name].presence || repo.name @@ -41,10 +41,10 @@ class Import::BitbucketServerController < Import::BaseController render json: { errors: project_save_error(project) }, status: :unprocessable_entity end else - render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity + render json: { errors: _('This namespace has already been taken! Please choose another one.') }, status: :unprocessable_entity end - rescue BitbucketServer::Connection::ConnectionError => e - render json: { errors: "Unable to connect to server: #{e}" }, status: :unprocessable_entity + rescue BitbucketServer::Connection::ConnectionError => error + render json: { errors: _("Unable to connect to server: %{error}") % { error: error } }, status: :unprocessable_entity end def configure @@ -65,8 +65,8 @@ class Import::BitbucketServerController < Import::BaseController already_added_projects_names = @already_added_projects.pluck(:import_source) @repos.reject! { |repo| already_added_projects_names.include?(repo.browse_url) } - rescue BitbucketServer::Connection::ConnectionError => e - flash[:alert] = "Unable to connect to server: #{e}" + rescue BitbucketServer::Connection::ConnectionError => error + flash[:alert] = _("Unable to connect to server: %{error}") % { error: error } clear_session_data redirect_to new_import_bitbucket_server_path end diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb index 5a439e6de78..a37ba682b91 100644 --- a/app/controllers/import/fogbugz_controller.rb +++ b/app/controllers/import/fogbugz_controller.rb @@ -14,7 +14,7 @@ class Import::FogbugzController < Import::BaseController res = Gitlab::FogbugzImport::Client.new(import_params.symbolize_keys) rescue # If the URI is invalid various errors can occur - return redirect_to new_import_fogbugz_path, alert: 'Could not connect to FogBugz, check your URL' + return redirect_to new_import_fogbugz_path, alert: _('Could not connect to FogBugz, check your URL') end session[:fogbugz_token] = res.get_token session[:fogbugz_uri] = params[:uri] @@ -29,14 +29,14 @@ class Import::FogbugzController < Import::BaseController user_map = params[:users] unless user_map.is_a?(Hash) && user_map.all? { |k, v| !v[:name].blank? } - flash.now[:alert] = 'All users must have a name.' + flash.now[:alert] = _('All users must have a name.') return render 'new_user_map' end session[:fogbugz_user_map] = user_map - flash[:notice] = 'The user map has been saved. Continue by selecting the projects you want to import.' + flash[:notice] = _('The user map has been saved. Continue by selecting the projects you want to import.') redirect_to status_import_fogbugz_path end diff --git a/app/controllers/import/gitea_controller.rb b/app/controllers/import/gitea_controller.rb index 68ad8650dba..a23b2f8139e 100644 --- a/app/controllers/import/gitea_controller.rb +++ b/app/controllers/import/gitea_controller.rb @@ -46,7 +46,7 @@ class Import::GiteaController < Import::GithubController def provider_auth if session[access_token_key].blank? || provider_url.blank? redirect_to new_import_gitea_url, - alert: 'You need to specify both an Access Token and a Host URL.' + alert: _('You need to specify both an Access Token and a Host URL.') end end diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb index 498de0b07b8..5ec8e9e6fc5 100644 --- a/app/controllers/import/gitlab_controller.rb +++ b/app/controllers/import/gitlab_controller.rb @@ -42,7 +42,7 @@ class Import::GitlabController < Import::BaseController render json: { errors: project_save_error(project) }, status: :unprocessable_entity end else - render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity + render json: { errors: _('This namespace has already been taken! Please choose another one.') }, status: :unprocessable_entity end end diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb index 354fba5d204..89889141be6 100644 --- a/app/controllers/import/gitlab_projects_controller.rb +++ b/app/controllers/import/gitlab_projects_controller.rb @@ -13,7 +13,7 @@ class Import::GitlabProjectsController < Import::BaseController def create unless file_is_valid? - return redirect_back_or_default(options: { alert: "You need to upload a GitLab project export archive (ending in .gz)." }) + return redirect_back_or_default(options: { alert: _("You need to upload a GitLab project export archive (ending in .gz).") }) end @project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute @@ -21,7 +21,7 @@ class Import::GitlabProjectsController < Import::BaseController if @project.saved? redirect_to( project_path(@project), - notice: "Project '#{@project.name}' is being imported." + notice: _("Project '%{project_name}' is being imported.") % { project_name: @project.name } ) else redirect_back_or_default(options: { alert: "Project could not be imported: #{@project.errors.full_messages.join(', ')}" }) diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index 331f06c3dd6..4dddfbcd20d 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -11,18 +11,18 @@ class Import::GoogleCodeController < Import::BaseController dump_file = params[:dump_file] unless dump_file.respond_to?(:read) - return redirect_back_or_default(options: { alert: "You need to upload a Google Takeout archive." }) + return redirect_back_or_default(options: { alert: _("You need to upload a Google Takeout archive.") }) end begin dump = JSON.parse(dump_file.read) rescue - return redirect_back_or_default(options: { alert: "The uploaded file is not a valid Google Takeout archive." }) + return redirect_back_or_default(options: { alert: _("The uploaded file is not a valid Google Takeout archive.") }) end client = Gitlab::GoogleCodeImport::Client.new(dump) unless client.valid? - return redirect_back_or_default(options: { alert: "The uploaded file is not a valid Google Takeout archive." }) + return redirect_back_or_default(options: { alert: _("The uploaded file is not a valid Google Takeout archive.") }) end session[:google_code_dump] = dump @@ -44,13 +44,13 @@ class Import::GoogleCodeController < Import::BaseController begin user_map = JSON.parse(user_map_json) rescue - flash.now[:alert] = "The entered user map is not a valid JSON user map." + flash.now[:alert] = _("The entered user map is not a valid JSON user map.") return render "new_user_map" end unless user_map.is_a?(Hash) && user_map.all? { |k, v| k.is_a?(String) && v.is_a?(String) } - flash.now[:alert] = "The entered user map is not a valid JSON user map." + flash.now[:alert] = _("The entered user map is not a valid JSON user map.") return render "new_user_map" end @@ -62,7 +62,7 @@ class Import::GoogleCodeController < Import::BaseController session[:google_code_user_map] = user_map - flash[:notice] = "The user map has been saved. Continue by selecting the projects you want to import." + flash[:notice] = _("The user map has been saved. Continue by selecting the projects you want to import.") redirect_to status_import_google_code_path end |