diff options
Diffstat (limited to 'app/controllers')
31 files changed, 122 insertions, 102 deletions
diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/appearances_controller.rb index 26cf74e4849..3599860c116 100644 --- a/app/controllers/admin/appearances_controller.rb +++ b/app/controllers/admin/appearances_controller.rb @@ -11,7 +11,7 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance = Appearance.new(appearance_params) if @appearance.save - redirect_to admin_appearances_path, notice: 'Appearance was successfully created.' + redirect_to admin_appearances_path, notice: '创建外观成功。' else render action: 'show' end @@ -19,7 +19,7 @@ class Admin::AppearancesController < Admin::ApplicationController def update if @appearance.update(appearance_params) - redirect_to admin_appearances_path, notice: 'Appearance was successfully updated.' + redirect_to admin_appearances_path, notice: '更新外观成功。' else render action: 'show' end @@ -30,14 +30,14 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance.save - redirect_to admin_appearances_path, notice: 'Logo was succesfully removed.' + redirect_to admin_appearances_path, notice: 'Logo 删除成功。' end def header_logos @appearance.remove_header_logo! @appearance.save - redirect_to admin_appearances_path, notice: 'Header logo was succesfully removed.' + redirect_to admin_appearances_path, notice: '头部 Logo 删除成功。' end private diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index ed9f6031389..0c244eb80e9 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::ApplicationSettingsController < Admin::ApplicationController before_action :set_application_setting @@ -7,7 +8,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController def update if @application_setting.update_attributes(application_setting_params) redirect_to admin_application_settings_path, - notice: 'Application settings saved successfully' + notice: '应用设置保存成功' else render :show end diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index 471d24934a0..7403dd4d9b2 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::ApplicationsController < Admin::ApplicationController before_action :set_application, only: [:show, :edit, :update, :destroy] @@ -28,7 +29,7 @@ class Admin::ApplicationsController < Admin::ApplicationController def update if @application.update(application_params) - redirect_to admin_application_path(@application), notice: 'Application was successfully updated.' + redirect_to admin_application_path(@application), notice: '应用更新成功。' else render :edit end @@ -36,7 +37,7 @@ class Admin::ApplicationsController < Admin::ApplicationController def destroy @application.destroy - redirect_to admin_applications_url, notice: 'Application was successfully destroyed.' + redirect_to admin_applications_url, notice: '应用销毁成功。' end private diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index fc342924987..3ea90a8d13e 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -13,7 +13,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController @broadcast_message = BroadcastMessage.new(broadcast_message_params) if @broadcast_message.save - redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully created.' + redirect_to admin_broadcast_messages_path, notice: '广播信息创建成功。' else render :index end diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 8e2a981be7c..4dafef43184 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::GroupsController < Admin::ApplicationController before_action :group, only: [:edit, :show, :update, :destroy, :project_update, :members_update] @@ -26,7 +27,7 @@ class Admin::GroupsController < Admin::ApplicationController if @group.save @group.add_owner(current_user) - redirect_to [:admin, @group], notice: 'Group was successfully created.' + redirect_to [:admin, @group], notice: '群组创建成功。' else render "new" end @@ -34,7 +35,7 @@ class Admin::GroupsController < Admin::ApplicationController def update if @group.update_attributes(group_params) - redirect_to [:admin, @group], notice: 'Group was successfully updated.' + redirect_to [:admin, @group], notice: '群组更新成功。' else render "edit" end @@ -43,13 +44,13 @@ class Admin::GroupsController < Admin::ApplicationController def members_update @group.add_users(params[:user_ids].split(','), params[:access_level], current_user) - redirect_to [:admin, @group], notice: 'Users were successfully added.' + redirect_to [:admin, @group], notice: '用户增加成功。' end def destroy DestroyGroupService.new(@group, current_user).execute - redirect_to admin_groups_path, notice: 'Group was successfully deleted.' + redirect_to admin_groups_path, notice: '群组删除成功。' end private diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb index 0bd19c49d8f..520d122d9e5 100644 --- a/app/controllers/admin/hooks_controller.rb +++ b/app/controllers/admin/hooks_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::HooksController < Admin::ApplicationController def index @hooks = SystemHook.all @@ -8,7 +9,7 @@ class Admin::HooksController < Admin::ApplicationController @hook = SystemHook.new(hook_params) if @hook.save - redirect_to admin_hooks_path, notice: 'Hook was successfully created.' + redirect_to admin_hooks_path, notice: '钩子创建成功。' else @hooks = SystemHook.all render :index diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb index cb33fdd9763..c4e3c59a402 100644 --- a/app/controllers/admin/keys_controller.rb +++ b/app/controllers/admin/keys_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::KeysController < Admin::ApplicationController before_action :user, only: [:show, :destroy] @@ -15,9 +16,9 @@ class Admin::KeysController < Admin::ApplicationController respond_to do |format| if key.destroy - format.html { redirect_to [:admin, user], notice: 'User key was successfully removed.' } + format.html { redirect_to [:admin, user], notice: '用户密钥删除成功。' } else - format.html { redirect_to [:admin, user], alert: 'Failed to remove user key.' } + format.html { redirect_to [:admin, user], alert: '用户密钥删除失败。' } end end end diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index 46133588332..39aefde7f7d 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::ServicesController < Admin::ApplicationController before_action :service, only: [:edit, :update] @@ -8,14 +9,14 @@ class Admin::ServicesController < Admin::ApplicationController def edit unless service.present? redirect_to admin_application_settings_services_path, - alert: "Service is unknown or it doesn't exist" + alert: "服务未知或不存在" end end def update if service.update_attributes(application_services_params[:service]) redirect_to admin_application_settings_services_path, - notice: 'Application settings saved successfully' + notice: '应用设置保存成功' else render :edit end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 9abf08d0e19..f084c38d248 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Admin::UsersController < Admin::ApplicationController before_action :user, except: [:index, :new, :create] @@ -33,42 +34,42 @@ class Admin::UsersController < Admin::ApplicationController def block if user.block - redirect_back_or_admin_user(notice: "Successfully blocked") + redirect_back_or_admin_user(notice: "禁用成功") else - redirect_back_or_admin_user(alert: "Error occurred. User was not blocked") + redirect_back_or_admin_user(alert: "发生错误。用户未被禁止") end end def unblock if user.ldap_blocked? - redirect_back_or_admin_user(alert: "This user cannot be unlocked manually from GitLab") + redirect_back_or_admin_user(alert: "此用户无法通过 GitLab 来启用") elsif user.activate - redirect_back_or_admin_user(notice: "Successfully unblocked") + redirect_back_or_admin_user(notice: "启用成功") else - redirect_back_or_admin_user(alert: "Error occurred. User was not unblocked") + redirect_back_or_admin_user(alert: "发生错误。用户未被启用") end end def unlock if user.unlock_access! - redirect_back_or_admin_user(alert: "Successfully unlocked") + redirect_back_or_admin_user(alert: "解除锁定成功") else - redirect_back_or_admin_user(alert: "Error occurred. User was not unlocked") + redirect_back_or_admin_user(alert: "发生错误。用户未被解除锁定") end end def confirm if user.confirm - redirect_back_or_admin_user(notice: "Successfully confirmed") + redirect_back_or_admin_user(notice: "确认成功") else - redirect_back_or_admin_user(alert: "Error occurred. User was not confirmed") + redirect_back_or_admin_user(alert: "发生错误。用户未被确认") end end def disable_two_factor user.disable_two_factor! redirect_to admin_user_path(user), - notice: 'Two-factor Authentication has been disabled for this user' + notice: '此用户已禁止两步验证' end def create @@ -85,7 +86,7 @@ class Admin::UsersController < Admin::ApplicationController respond_to do |format| if @user.save - format.html { redirect_to [:admin, @user], notice: 'User was successfully created.' } + format.html { redirect_to [:admin, @user], notice: '用户创建成功。' } format.json { render json: @user, status: :created, location: @user } else format.html { render "new" } @@ -107,7 +108,7 @@ class Admin::UsersController < Admin::ApplicationController respond_to do |format| user.skip_reconfirmation! if user.update_attributes(user_params_with_pass) - format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' } + format.html { redirect_to [:admin, user], notice: '用户更新成功。' } format.json { head :ok } else # restore username to keep form action url. @@ -134,7 +135,7 @@ class Admin::UsersController < Admin::ApplicationController user.update_secondary_emails! respond_to do |format| - format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") } + format.html { redirect_back_or_admin_user(notice: "删除电子邮箱成功。") } format.js { render nothing: true } end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3a0eb96a460..c5f224e855e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 require 'gon' require 'fogbugz' @@ -90,7 +91,7 @@ class ApplicationController < ActionController::Base def reject_blocked! if current_user && current_user.blocked? sign_out current_user - flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it." + flash[:alert] = "你的账号被禁用。请在管理员启用该账号后重试。" redirect_to new_user_session_path end end @@ -98,7 +99,7 @@ class ApplicationController < ActionController::Base def after_sign_in_path_for(resource) if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked? sign_out resource - flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it." + flash[:alert] = "你的账号被禁用。请在管理员启用该账号后重试。" new_user_session_path else stored_location_for(:redirect) || stored_location_for(resource) || root_path @@ -244,7 +245,7 @@ class ApplicationController < ActionController::Base def require_email if current_user && current_user.temp_oauth_email? - redirect_to profile_path, notice: 'Please complete your profile with email address' and return + redirect_to profile_path, notice: '请在个人资料中填写电子邮箱地址' and return end end diff --git a/app/controllers/ci/lints_controller.rb b/app/controllers/ci/lints_controller.rb index a7af3cb8345..936ff051bf1 100644 --- a/app/controllers/ci/lints_controller.rb +++ b/app/controllers/ci/lints_controller.rb @@ -10,7 +10,7 @@ module Ci if @content.blank? @status = false - @error = "Please provide content of .gitlab-ci.yml" + @error = "请提供 .gitlab-ci.yml 文件内容" else @config_processor = Ci::GitlabCiYamlProcessor.new(@content) @stages = @config_processor.stages @@ -21,7 +21,7 @@ module Ci @error = e.message @status = false rescue - @error = 'Undefined error' + @error = '未定义错误' @status = false ensure render :show diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index d5ef33888c6..992170b39cd 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -20,7 +20,7 @@ class Groups::GroupMembersController < Groups::ApplicationController def create @group.add_users(params[:user_ids].split(','), params[:access_level], current_user) - redirect_to group_group_members_path(@group), notice: 'Users were successfully added.' + redirect_to group_group_members_path(@group), notice: '用户增加成功。' end def update @@ -39,7 +39,7 @@ class Groups::GroupMembersController < Groups::ApplicationController @group_member.destroy respond_to do |format| - format.html { redirect_to group_group_members_path(@group), notice: 'User was successfully removed from group.' } + format.html { redirect_to group_group_members_path(@group), notice: '用户从群组删除成功。' } format.js { render nothing: true } end end @@ -52,9 +52,9 @@ class Groups::GroupMembersController < Groups::ApplicationController if @group_member.invite? @group_member.resend_invite - redirect_to redirect_path, notice: 'The invitation was successfully resent.' + redirect_to redirect_path, notice: '邀请重发成功。' else - redirect_to redirect_path, alert: 'The invitation has already been accepted.' + redirect_to redirect_path, alert: '邀请已经被接受。' end end @@ -64,10 +64,10 @@ class Groups::GroupMembersController < Groups::ApplicationController if can?(current_user, :destroy_group_member, @group_member) @group_member.destroy - redirect_to(dashboard_groups_path, notice: "You left #{group.name} group.") + redirect_to(dashboard_groups_path, notice: "已离开 #{group.name} 群组。") else if @group.last_owner?(current_user) - redirect_to(dashboard_groups_path, alert: "You can not leave #{group.name} group because you're the last owner. Transfer or delete the group.") + redirect_to(dashboard_groups_path, alert: "不能离开 #{group.name} 群组,因为你是最后一个群组所有者。请转移或删除群组。") else return render_403 end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 87efb0a8970..55a80d7643c 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -91,7 +91,7 @@ class GroupsController < Groups::ApplicationController def destroy DestroyGroupService.new(@group, current_user).execute - redirect_to root_path, alert: "Group '#{@group.name}' was successfully deleted." + redirect_to root_path, alert: "群组 '#{@group.name}' 被成功删除。" end protected diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index e0de31f2251..8e004556bef 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Import::GoogleCodeController < Import::BaseController before_action :verify_google_code_import_enabled before_action :user_map, only: [:new_user_map, :create_user_map] @@ -10,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: "需要上传 Google Takeout 存档。" }) 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: "上传的文件不是有效的 Google Takeout 存档。" }) 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: "上传的文件不是有效的 Google Takeout 存档。" }) end session[:google_code_dump] = dump @@ -44,13 +45,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] = "输入的用户映射表不是有效的 JSON 用户映射表。" render "new_user_map" and return 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] = "输入的用户映射表不是有效的 JSON 用户映射表。" render "new_user_map" and return end @@ -62,7 +63,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] = "用户映射表已保存。选择要导入的项目后继续。" redirect_to status_import_google_code_path end diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 94bb108c5f5..a214b439b22 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class InvitesController < ApplicationController before_action :member skip_before_action :authenticate_user!, only: :decline @@ -12,9 +13,9 @@ class InvitesController < ApplicationController if member.accept_invite!(current_user) label, path = source_info(member.source) - redirect_to path, notice: "You have been granted #{member.human_access} access to #{label}." + redirect_to path, notice: "已接受作为 #{member.human_access} 访问 #{label} 的邀请。" else - redirect_back_or_default(options: { alert: "The invitation could not be accepted." }) + redirect_back_or_default(options: { alert: "此邀请无法被接受。" }) end end @@ -29,9 +30,9 @@ class InvitesController < ApplicationController new_user_session_path end - redirect_to path, notice: "You have declined the invitation to join #{label}." + redirect_to path, notice: "已拒绝加入 #{label} 的邀请。" else - redirect_back_or_default(options: { alert: "The invitation could not be declined." }) + redirect_back_or_default(options: { alert: "此邀请无法被拒绝。" }) end end @@ -53,9 +54,9 @@ class InvitesController < ApplicationController def authenticate_user! return if current_user - notice = "To accept this invitation, sign in" - notice << " or create an account" if current_application_settings.signup_enabled? - notice << "." + notice = "要接受此邀请,请登入" + notice << "或者创建账号" if current_application_settings.signup_enabled? + notice << "。" store_location_for :user, request.fullpath redirect_to new_user_session_path, notice: notice @@ -65,14 +66,14 @@ class InvitesController < ApplicationController case source when Project project = member.source - label = "project #{project.name_with_namespace}" + label = "项目 #{project.name_with_namespace}" path = namespace_project_path(project.namespace, project) when Group group = member.source - label = "group #{group.name}" + label = "群组 #{group.name}" path = group_path(group) else - label = "who knows what" + label = "谁知道" path = dashboard_projects_path end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 21135f7d607..4f3aa66ff5c 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -37,7 +37,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController sign_in_and_redirect(@user) end else - flash[:alert] = "Access denied for your LDAP account." + flash[:alert] = "您的 LDAP 账号被禁止访问。" redirect_to new_user_session_path end end @@ -49,7 +49,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController identity = current_user.identities.find_by(extern_uid: oauth['uid'], provider: :saml) if identity.nil? current_user.identities.create(extern_uid: oauth['uid'], provider: :saml) - redirect_to profile_account_path, notice: 'Authentication method updated' + redirect_to profile_account_path, notice: '认证方法已更新' else redirect_to after_sign_in_path_for(current_user) end @@ -83,7 +83,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # Add new authentication method current_user.identities.find_or_create_by(extern_uid: oauth['uid'], provider: oauth['provider']) log_audit_event(current_user, with: oauth['provider']) - redirect_to profile_account_path, notice: 'Authentication method updated' + redirect_to profile_account_path, notice: '认证方法已更新' else oauth_user = Gitlab::OAuth::User.new(oauth) oauth_user.save @@ -93,10 +93,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end rescue Gitlab::OAuth::SignupDisabledError label = Gitlab::OAuth::Provider.label_for(oauth['provider']) - message = "Signing in using your #{label} account without a pre-existing GitLab account is not allowed." + message = "没有绑定 GitLab 账号前是无法使用 #{label} 账号登陆系统。" if current_application_settings.signup_enabled? - message << " Create a GitLab account first, and then connect it to your #{label} account." + message << " 请先创建一个 GitLab 账号,然后再绑定 #{label} 账号。" end flash[:notice] = message diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index a8575e037e4..7017a3c95b7 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class PasswordsController < Devise::PasswordsController before_action :resource_from_email, only: [:create] before_action :prevent_ldap_reset, only: [:create] @@ -17,7 +18,7 @@ class PasswordsController < Devise::PasswordsController ).first_or_initialize unless user.reset_password_period_valid? - flash[:alert] = 'Your password reset token has expired.' + flash[:alert] = '使用的密码重置授权已过期。' redirect_to(new_user_password_url(user_email: user['email'])) end end diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 1fd1d6882df..46d5badc1a3 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Profiles::NotificationsController < Profiles::ApplicationController def show @user = current_user @@ -24,9 +25,9 @@ class Profiles::NotificationsController < Profiles::ApplicationController respond_to do |format| format.html do if @saved - flash[:notice] = "Notification settings saved" + flash[:notice] = "通知设置已保存" else - flash[:alert] = "Failed to save new settings" + flash[:alert] = "保存新设置失败" end redirect_back_or_default(default: profile_notifications_path) diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb index c780e0983f9..fa40e954f49 100644 --- a/app/controllers/profiles/passwords_controller.rb +++ b/app/controllers/profiles/passwords_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Profiles::PasswordsController < Profiles::ApplicationController skip_before_action :check_password_expiration, only: [:new, :create] @@ -11,7 +12,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController def create unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) - redirect_to new_profile_password_path, alert: 'You must provide a valid current password' + redirect_to new_profile_password_path, alert: '必须提供一个有效的当前密码' return end @@ -26,7 +27,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController if result @user.update_attributes(password_expires_at: nil) - redirect_to root_path, notice: 'Password successfully changed' + redirect_to root_path, notice: '密码修改成功' else render :new end @@ -42,12 +43,12 @@ class Profiles::PasswordsController < Profiles::ApplicationController password_attributes[:password_automatically_set] = false unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) - redirect_to edit_profile_password_path, alert: 'You must provide a valid current password' + redirect_to edit_profile_password_path, alert: '必须提供一个有效的当前密码' return end if @user.update_attributes(password_attributes) - flash[:notice] = "Password was successfully updated. Please login with it" + flash[:notice] = "密码已成功更新。请使用新密码重新登录" redirect_to new_user_session_path else render 'edit' @@ -56,7 +57,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController def reset current_user.send_reset_password_instructions - redirect_to edit_profile_password_path, notice: 'We sent you an email with reset password instructions' + redirect_to edit_profile_password_path, notice: '已发送重置密码操作的电子邮件' end private diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index a9a06ecc808..1559a191ba2 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Profiles::PreferencesController < Profiles::ApplicationController before_action :user @@ -7,13 +8,13 @@ class Profiles::PreferencesController < Profiles::ApplicationController def update begin if @user.update_attributes(preferences_params) - flash[:notice] = 'Preferences saved.' + flash[:notice] = '偏好设置已保存。' else - flash[:alert] = 'Failed to save preferences.' + flash[:alert] = '保存偏好设置失败。' end rescue ArgumentError => e # Raised when `dashboard` is given an invalid value. - flash[:alert] = "Failed to save preferences (#{e.message})." + flash[:alert] = "保存偏好设置失败(#{e.message})。" end respond_to do |format| diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index 8f83fdd02bc..4f58033b659 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -14,10 +14,10 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController if two_factor_authentication_required? if two_factor_grace_period_expired? - flash.now[:alert] = 'You must enable Two-factor Authentication for your account.' + flash.now[:alert] = '您必须给您的账户启用两步验证。' else grace_period_deadline = current_user.otp_grace_period_started_at + two_factor_grace_period.hours - flash.now[:alert] = "You must enable Two-factor Authentication for your account before #{l(grace_period_deadline)}." + flash.now[:alert] = "您必须在 #{l(grace_period_deadline)} 之前给您的账户启用两步验证。" end end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 32fca6b838e..bcf7a296eae 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class ProfilesController < Profiles::ApplicationController include ActionView::Helpers::SanitizeHelper @@ -12,10 +13,10 @@ class ProfilesController < Profiles::ApplicationController user_params.except!(:email) if @user.ldap_user? if @user.update_attributes(user_params) - flash[:notice] = "Profile was successfully updated" + flash[:notice] = "个人资料已成功更新" else messages = @user.errors.full_messages.uniq.join('. ') - flash[:alert] = "Failed to update profile. #{messages}" + flash[:alert] = "更新个人资料失败。 #{messages}" end respond_to do |format| @@ -25,7 +26,7 @@ class ProfilesController < Profiles::ApplicationController def reset_private_token if current_user.reset_authentication_token! - flash[:notice] = "Token was successfully updated" + flash[:notice] = "令牌已成功更新" end redirect_to profile_account_path diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 657ee94cfd7..2cdf098cee6 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -75,7 +75,7 @@ class Projects::ApplicationController < ApplicationController unless @repository.branch_names.include?(@ref) redirect_to( namespace_project_tree_path(@project.namespace, @project, @ref), - notice: "This action is not allowed unless you are on a branch" + notice: "除在分支的顶层外不允许本操作" ) end end diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index cd8b2911674..75320453ced 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 # Controller for viewing a file's blame class Projects::BlobController < Projects::ApplicationController include ExtractsPath @@ -22,7 +23,7 @@ class Projects::BlobController < Projects::ApplicationController end def create - create_commit(Files::CreateService, success_notice: "The file has been successfully created.", + create_commit(Files::CreateService, success_notice: "文件已创建成功。", success_path: namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)), failure_view: :new, failure_path: namespace_project_new_blob_path(@project.namespace, @project, @ref)) @@ -62,7 +63,7 @@ class Projects::BlobController < Projects::ApplicationController end def destroy - create_commit(Files::DeleteService, success_notice: "The file has been successfully deleted.", + create_commit(Files::DeleteService, success_notice: "文件已删除成功。", success_path: namespace_project_tree_path(@project.namespace, @project, @target_branch), failure_view: :show, failure_path: namespace_project_blob_path(@project.namespace, @project, @id)) diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index a1b8632df98..faab7f19c18 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -48,7 +48,7 @@ class Projects::ForksController < Projects::ApplicationController if continue_params redirect_to continue_params[:to], notice: continue_params[:notice] else - redirect_to namespace_project_path(@forked_project.namespace, @forked_project), notice: "The project '#{@forked_project.name}' was successfully forked." + redirect_to namespace_project_path(@forked_project.namespace, @forked_project), notice: "项目 '#{@forked_project.name}' 项目成功。" end end else diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 5fd4f855dec..d781e7679a6 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Projects::HooksController < Projects::ApplicationController # Authorize before_action :authorize_admin_project! @@ -28,12 +29,12 @@ class Projects::HooksController < Projects::ApplicationController status, message = TestHookService.new.execute(hook, current_user) if status - flash[:notice] = 'Hook successfully executed.' + flash[:notice] = '钩子执行成功。' else - flash[:alert] = "Hook execution failed: #{message}" + flash[:alert] = "钩子执行失败:#{message}" end else - flash[:alert] = 'Hook execution failed. Ensure the project has commits.' + flash[:alert] = '钩子执行失败。确保项目已提交。' end redirect_back_or_default(default: { action: 'index' }) diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 5f471d405f5..66f07d7bd09 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -65,7 +65,7 @@ class Projects::LabelsController < Projects::ApplicationController respond_to do |format| format.html do redirect_to(namespace_project_labels_path(@project.namespace, @project), - notice: 'Label was removed') + notice: '标记已删除') end format.js end diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 8b2577aebe1..42416acd902 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class Projects::ServicesController < Projects::ApplicationController ALLOWED_PARAMS = [:title, :token, :type, :active, :api_key, :api_url, :api_version, :subdomain, :room, :recipients, :project_url, :webhook, @@ -37,7 +38,7 @@ class Projects::ServicesController < Projects::ApplicationController redirect_to( edit_namespace_project_service_path(@project.namespace, @project, @service.to_param, notice: - 'Successfully updated.') + '已更新成功。') ) else render 'edit' @@ -48,9 +49,9 @@ class Projects::ServicesController < Projects::ApplicationController data = Gitlab::PushDataBuilder.build_sample(project, current_user) outcome = @service.test(data) if outcome[:success] - message = { notice: 'We sent a request to the provided URL' } + message = { notice: '已发送请求到提供的链接' } else - error_message = "We tried to send a request to the provided URL but an error occurred" + error_message = "已发送请求到提供的链接,但收到一个错误回应" error_message << ": #{outcome[:result]}" if outcome[:result].present? message = { alert: error_message } end diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 88fccfed509..ed19ec2aa9f 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 require 'project_wiki' class Projects::WikisController < Projects::ApplicationController @@ -47,7 +48,7 @@ class Projects::WikisController < Projects::ApplicationController if @page.update(content, format, message) redirect_to( namespace_project_wiki_path(@project.namespace, @project, @page), - notice: 'Wiki was successfully updated.' + notice: '维基更新成功。' ) else render 'edit' @@ -60,7 +61,7 @@ class Projects::WikisController < Projects::ApplicationController if @page.create(wiki_params) redirect_to( namespace_project_wiki_path(@project.namespace, @project, @page), - notice: 'Wiki was successfully updated.' + notice: '维基更新成功。' ) else render action: "edit" @@ -73,7 +74,7 @@ class Projects::WikisController < Projects::ApplicationController unless @page redirect_to( namespace_project_wiki_path(@project.namespace, @project, :home), - notice: "Page not found" + notice: "页面不存在" ) end end @@ -84,7 +85,7 @@ class Projects::WikisController < Projects::ApplicationController redirect_to( namespace_project_wiki_path(@project.namespace, @project, :home), - notice: "Page was successfully deleted" + notice: "维基删除成功" ) end @@ -99,7 +100,7 @@ class Projects::WikisController < Projects::ApplicationController # Call #wiki to make sure the Wiki Repo is initialized @project_wiki.wiki rescue ProjectWiki::CouldNotCreateWikiError - flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." + flash[:notice] = "现在不能创建维基版本仓库。请稍后重试。" redirect_to project_path(@project) return false end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 928817ba811..fb90266476a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -30,7 +30,7 @@ class ProjectsController < Projects::ApplicationController if @project.saved? redirect_to( project_path(@project), - notice: "Project '#{@project.name}' was successfully created." + notice: "项目 '#{@project.name}' 创建成功。" ) else render 'new' @@ -42,11 +42,11 @@ class ProjectsController < Projects::ApplicationController respond_to do |format| if status - flash[:notice] = "Project '#{@project.name}' was successfully updated." + flash[:notice] = "项目 '#{@project.name}' 更新成功。" format.html do redirect_to( edit_project_path(@project), - notice: "Project '#{@project.name}' was successfully updated." + notice: "项目 '#{@project.name}' 更新成功。" ) end format.js @@ -72,7 +72,7 @@ class ProjectsController < Projects::ApplicationController return access_denied! unless can?(current_user, :remove_fork_project, @project) if @project.unlink_fork - flash[:notice] = 'The fork relationship has been removed.' + flash[:notice] = '派生关系被删除。' end end @@ -93,7 +93,7 @@ class ProjectsController < Projects::ApplicationController end if @project.pending_delete? - flash[:alert] = "Project queued for delete." + flash[:alert] = "项目正在排队删除。" end respond_to do |format| @@ -124,7 +124,7 @@ class ProjectsController < Projects::ApplicationController return access_denied! unless can?(current_user, :remove_project, @project) ::Projects::DestroyService.new(@project, current_user, {}).pending_delete! - flash[:alert] = "Project '#{@project.name}' will be deleted." + flash[:alert] = "项目 '#{@project.name}' 已被删除。" redirect_to dashboard_projects_path rescue Projects::DestroyService::DestroyError => ex diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index c48175a4c5a..ab0c9f7d8a1 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class RegistrationsController < Devise::RegistrationsController before_action :signup_enabled? include Recaptcha::Verify @@ -20,7 +21,7 @@ class RegistrationsController < Devise::RegistrationsController DeleteUserService.new(current_user).execute(current_user) respond_to do |format| - format.html { redirect_to new_user_session_path, notice: "Account successfully removed." } + format.html { redirect_to new_user_session_path, notice: "账号删除成功。" } end end |