From c7b9a77b4ab66039e8a1f0ad38cd1c4d0122184d Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Sun, 19 Mar 2023 21:47:49 +0800 Subject: [PATCH] Remove Go i18n duplicates --- controllers/account.go | 4 ++-- controllers/auth.go | 8 +++---- controllers/resource.go | 2 +- controllers/verification.go | 4 ++-- i18n/locales/de/data.json | 10 ++------ i18n/locales/en/data.json | 10 ++------ i18n/locales/es/data.json | 10 ++------ i18n/locales/fr/data.json | 10 ++------ i18n/locales/id/data.json | 10 ++------ i18n/locales/ja/data.json | 10 ++------ i18n/locales/ko/data.json | 10 ++------ i18n/locales/ru/data.json | 10 ++------ i18n/locales/vi/data.json | 10 ++------ i18n/locales/zh/data.json | 44 ++++++++++++++++-------------------- object/avatar.go | 6 ++--- object/storage.go | 8 +++---- web/src/Setting.js | 2 +- web/src/locales/id/data.json | 2 +- 18 files changed, 55 insertions(+), 115 deletions(-) diff --git a/controllers/account.go b/controllers/account.go index c73da03d..b4cb7508 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -103,7 +103,7 @@ type Captcha struct { // @router /signup [post] func (c *ApiController) Signup() { if c.GetSessionUsername() != "" { - c.ResponseError(c.T("account:Please sign out first before signing up"), c.GetSessionUsername()) + c.ResponseError(c.T("account:Please sign out first"), c.GetSessionUsername()) return } @@ -211,7 +211,7 @@ func (c *ApiController) Signup() { affected := object.AddUser(user) if !affected { - c.ResponseError(c.T("account:Invalid information"), util.StructToJson(user)) + c.ResponseError(c.T("account:Failed to add user"), util.StructToJson(user)) return } diff --git a/controllers/auth.go b/controllers/auth.go index 1a88dc1a..a7dc6823 100644 --- a/controllers/auth.go +++ b/controllers/auth.go @@ -237,7 +237,7 @@ func (c *ApiController) Login() { if form.Username != "" { if form.Type == ResponseTypeLogin { if c.GetSessionUsername() != "" { - c.ResponseError(c.T("account:Please sign out first before signing in"), c.GetSessionUsername()) + c.ResponseError(c.T("account:Please sign out first"), c.GetSessionUsername()) return } } @@ -308,7 +308,7 @@ func (c *ApiController) Login() { } if !isHuman { - c.ResponseError(c.T("auth:Turing test failed.")) + c.ResponseError(c.T("verification:Turing test failed.")) return } } @@ -368,7 +368,7 @@ func (c *ApiController) Login() { idProvider := idp.GetIdProvider(provider.Type, provider.SubType, clientId, clientSecret, provider.AppId, form.RedirectUri, provider.Domain, provider.CustomAuthUrl, provider.CustomTokenUrl, provider.CustomUserInfoUrl) if idProvider == nil { - c.ResponseError(fmt.Sprintf(c.T("auth:The provider type: %s is not supported"), provider.Type)) + c.ResponseError(fmt.Sprintf(c.T("storage:The provider type: %s is not supported"), provider.Type)) return } @@ -410,7 +410,7 @@ func (c *ApiController) Login() { // Sign in via OAuth (want to sign up but already have account) if user.IsForbidden { - c.ResponseError(c.T("auth:The user is forbidden to sign in, please contact the administrator")) + c.ResponseError(c.T("check:The user is forbidden to sign in, please contact the administrator")) } resp = c.HandleLoggedIn(application, user, &form) diff --git a/controllers/resource.go b/controllers/resource.go index e300f0f5..58db0523 100644 --- a/controllers/resource.go +++ b/controllers/resource.go @@ -195,7 +195,7 @@ func (c *ApiController) UploadResource() { } } - fileUrl, objectKey, err := object.UploadFileSafe(provider, fullFilePath, fileBuffer) + fileUrl, objectKey, err := object.UploadFileSafe(provider, fullFilePath, fileBuffer, c.GetAcceptLanguage()) if err != nil { c.ResponseError(err.Error()) return diff --git a/controllers/verification.go b/controllers/verification.go index 74b03367..f54767fe 100644 --- a/controllers/verification.go +++ b/controllers/verification.go @@ -96,7 +96,7 @@ func (c *ApiController) SendVerificationCode() { application := object.GetApplication(applicationId) organization := object.GetOrganization(util.GetId(application.Owner, application.Organization)) if organization == nil { - c.ResponseError(c.T("verification:Organization does not exist")) + c.ResponseError(c.T("check:Organization does not exist")) return } @@ -112,7 +112,7 @@ func (c *ApiController) SendVerificationCode() { switch destType { case "email": if !util.IsEmailValid(dest) { - c.ResponseError(c.T("verification:Email is invalid")) + c.ResponseError(c.T("check:Email is invalid")) return } diff --git a/i18n/locales/de/data.json b/i18n/locales/de/data.json index d55be150..f3955642 100644 --- a/i18n/locales/de/data.json +++ b/i18n/locales/de/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/en/data.json b/i18n/locales/en/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/en/data.json +++ b/i18n/locales/en/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/es/data.json b/i18n/locales/es/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/es/data.json +++ b/i18n/locales/es/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/fr/data.json b/i18n/locales/fr/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/fr/data.json +++ b/i18n/locales/fr/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/id/data.json b/i18n/locales/id/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/id/data.json +++ b/i18n/locales/id/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/ja/data.json b/i18n/locales/ja/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/ja/data.json +++ b/i18n/locales/ja/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/ko/data.json b/i18n/locales/ko/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/ko/data.json +++ b/i18n/locales/ko/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/ru/data.json b/i18n/locales/ru/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/ru/data.json +++ b/i18n/locales/ru/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/vi/data.json b/i18n/locales/vi/data.json index a1fd2d04..d53a9167 100644 --- a/i18n/locales/vi/data.json +++ b/i18n/locales/vi/data.json @@ -1,9 +1,8 @@ { "account": { + "Failed to add user": "Failed to add user", "Get init score failed, error: %w": "Get init score failed, error: %w", - "Invalid information": "Invalid information", - "Please sign out first before signing in": "Please sign out first before signing in", - "Please sign out first before signing up": "Please sign out first before signing up", + "Please sign out first": "Please sign out first", "The application does not allow to sign up new account": "The application does not allow to sign up new account" }, "auth": { @@ -17,10 +16,7 @@ "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)", "The application: %s does not exist": "The application: %s does not exist", "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", - "The provider type: %s is not supported": "The provider type: %s is not supported", "The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application", - "The user is forbidden to sign in, please contact the administrator": "The user is forbidden to sign in, please contact the administrator", - "Turing test failed.": "Turing test failed.", "Unauthorized operation": "Unauthorized operation", "Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s" }, @@ -126,9 +122,7 @@ }, "verification": { "Code has not been sent yet!": "Code has not been sent yet!", - "Email is invalid": "Email is invalid", "Invalid captcha provider.": "Invalid captcha provider.", - "Organization does not exist": "Organization does not exist", "Phone number is invalid in your region %s": "Phone number is invalid in your region %s", "Turing test failed.": "Turing test failed.", "Unable to get the email modify rule.": "Unable to get the email modify rule.", diff --git a/i18n/locales/zh/data.json b/i18n/locales/zh/data.json index 6697d745..356d4152 100644 --- a/i18n/locales/zh/data.json +++ b/i18n/locales/zh/data.json @@ -1,31 +1,27 @@ { "account": { + "Failed to add user": "添加用户失败", "Get init score failed, error: %w": "初始化分数失败: %w", - "Invalid information": "无效信息", - "Please sign out first before signing in": "请在登录前先退出登录", - "Please sign out first before signing up": "请在注册前先退出登录", + "Please sign out first": "请先退出登录", "The application does not allow to sign up new account": "该应用不允许注册新用户" }, "auth": { - "Challenge method should be S256": "Challenge 方法应该为 S256", + "Challenge method should be S256": "Challenge方法应该为S256", "Failed to create user, user information is invalid: %s": "创建用户失败,用户信息无效: %s", "Failed to login in: %s": "登录失败: %s", "Invalid token": "无效token", "State expected: %s, but got: %s": "期望状态为: %s, 实际状态为: %s", "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account via %%s, please use another way to sign up": "提供商账户: %s 与用户名: %s (%s) 不存在且 不允许通过 %s 注册新账户, 请使用其他方式注册", "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "提供商账户: %s 与用户名: %s (%s) 不存在且 不允许注册新账户, 请联系IT支持", - "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "提供商账户: %s 与用户名: %s (%s) 已经与其他账户绑定: %s (%s)", - "The application: %s does not exist": "应用 %s 不存在", + "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "提供商账户: %s与用户名: %s (%s)已经与其他账户绑定: %s (%s)", + "The application: %s does not exist": "应用%s不存在", "The login method: login with password is not enabled for the application": "该应用禁止采用密码登录方式", - "The provider type: %s is not supported": "不支持该类型的提供商: %s", - "The provider: %s is not enabled for the application": "该应用的提供商: %s 未被启用", - "The user is forbidden to sign in, please contact the administrator": "该用户被禁止登录,请联系管理员", - "Turing test failed.": "人机验证失败", + "The provider: %s is not enabled for the application": "该应用的提供商: %s未被启用", "Unauthorized operation": "未授权的操作", "Unknown authentication type (not password or provider), form = %s": "未知的认证类型(非密码或第三方提供商):%s" }, "cas": { - "Service %s and %s do not match": "服务 %s 与 %s 不匹配" + "Service %s and %s do not match": "服务%s与%s不匹配" }, "check": { "Affiliation cannot be blank": "工作单位不可为空", @@ -61,7 +57,7 @@ "general": { "Missing parameter": "缺少参数", "Please login first": "请先登录", - "The user: %s doesn't exist": "用户: %s 不存在", + "The user: %s doesn't exist": "用户: %s不存在", "don't support captchaProvider: ": "不支持验证码提供商: " }, "ldap": { @@ -76,13 +72,13 @@ "You can't unlink yourself, you are not a member of any application": "您无法自行解绑,您不是任何应用程序的成员" }, "organization": { - "Only admin can modify the %s.": "仅允许管理员可以修改 %s", - "The %s is immutable.": "%s 是不可变的", + "Only admin can modify the %s.": "仅允许管理员可以修改%s", + "The %s is immutable.": "%s是不可变的", "Unknown modify rule %s.": "未知的修改规则: %s" }, "provider": { "Invalid application id": "无效的应用ID", - "the provider: %s does not exist": "提供商: %s 不存在" + "the provider: %s does not exist": "提供商: %s不存在" }, "resource": { "User is nil for tag: avatar": "上传头像时用户为空", @@ -92,15 +88,15 @@ "Application %s not found": "未找到应用: %s" }, "saml_sp": { - "provider %s's category is not SAML": "提供商: %s 不是SAML类型" + "provider %s's category is not SAML": "提供商: %s不是SAML类型" }, "service": { "Empty parameters for emailForm: %v": "邮件参数为空: %v", - "Invalid Email receivers: %s": " 无效的邮箱收件人: %s", + "Invalid Email receivers: %s": "无效的邮箱收件人: %s", "Invalid phone receivers: %s": "无效的手机短信收信人: %s" }, "storage": { - "The objectKey: %s is not allowed": "objectKey: %s 被禁止", + "The objectKey: %s is not allowed": "objectKey: %s被禁止", "The provider type: %s is not supported": "不支持的提供商类型: %s" }, "token": { @@ -108,7 +104,7 @@ "Grant_type: %s is not supported in this application": "该应用不支持Grant_type: %s", "Invalid application or wrong clientSecret": "无效应用或错误的clientSecret", "Invalid client_id": "无效的ClientId", - "Redirect URI: %s doesn't exist in the allowed Redirect URI list": "重定向 URI:%s 在许可跳转列表中未找到", + "Redirect URI: %s doesn't exist in the allowed Redirect URI list": "重定向 URI:%s在许可跳转列表中未找到", "Token not found, invalid accessToken": "未查询到对应token, accessToken无效" }, "user": { @@ -120,15 +116,13 @@ "Failed to import users": "导入用户失败" }, "util": { - "No application is found for userId: %s": "未找到用户: %s 的应用", - "No provider for category: %s is found for application: %s": "未找到类别为: %s 的提供商来满足应用: %s", + "No application is found for userId: %s": "未找到用户: %s的应用", + "No provider for category: %s is found for application: %s": "未找到类别为: %s的提供商来满足应用: %s", "The provider: %s is not found": "未找到提供商: %s" }, "verification": { "Code has not been sent yet!": "验证码还未发送", - "Email is invalid": "非法的邮箱", "Invalid captcha provider.": "非法的验证码提供商", - "Organization does not exist": "组织不存在", "Phone number is invalid in your region %s": "您所在地区的电话号码无效 %s", "Turing test failed.": "验证码还未发送", "Unable to get the email modify rule.": "无法获取邮箱修改规则", @@ -140,7 +134,7 @@ "the user does not exist, please sign up first": "用户不存在,请先注册" }, "webauthn": { - "Found no credentials for this user": "该用户没有 WebAuthn 凭据", - "Please call WebAuthnSigninBegin first": "请先调用 WebAuthnSigninBegin" + "Found no credentials for this user": "该用户没有WebAuthn凭据", + "Please call WebAuthnSigninBegin first": "请先调用WebAuthnSigninBegin函数" } } diff --git a/object/avatar.go b/object/avatar.go index a5837406..c925239f 100644 --- a/object/avatar.go +++ b/object/avatar.go @@ -63,19 +63,19 @@ func getPermanentAvatarUrl(organization string, username string, url string, upl uploadedFileUrl, _ := GetUploadFileUrl(defaultStorageProvider, fullFilePath, false) if upload { - DownloadAndUpload(url, fullFilePath) + DownloadAndUpload(url, fullFilePath, "en") } return uploadedFileUrl } -func DownloadAndUpload(url string, fullFilePath string) { +func DownloadAndUpload(url string, fullFilePath string, lang string) { fileBuffer, err := downloadFile(url) if err != nil { panic(err) } - _, _, err = UploadFileSafe(defaultStorageProvider, fullFilePath, fileBuffer) + _, _, err = UploadFileSafe(defaultStorageProvider, fullFilePath, fileBuffer, lang) if err != nil { panic(err) } diff --git a/object/storage.go b/object/storage.go index c7d60122..1917457f 100644 --- a/object/storage.go +++ b/object/storage.go @@ -106,11 +106,11 @@ func GetUploadFileUrl(provider *Provider, fullFilePath string, hasTimestamp bool return fileUrl, objectKey } -func uploadFile(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer) (string, string, error) { +func uploadFile(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer, lang string) (string, string, error) { endpoint := getProviderEndpoint(provider) storageProvider := storage.GetStorageProvider(provider.Type, provider.ClientId, provider.ClientSecret, provider.RegionId, provider.Bucket, endpoint) if storageProvider == nil { - return "", "", fmt.Errorf("the provider type: %s is not supported", provider.Type) + return "", "", fmt.Errorf(i18n.Translate(lang, "storage:The provider type: %s is not supported"), provider.Type) } if provider.Domain == "" { @@ -128,7 +128,7 @@ func uploadFile(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffe return fileUrl, objectKey, nil } -func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer) (string, string, error) { +func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer, lang string) (string, string, error) { // check fullFilePath is there security issue if strings.Contains(fullFilePath, "..") { return "", "", fmt.Errorf("the fullFilePath: %s is not allowed", fullFilePath) @@ -139,7 +139,7 @@ func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.B var err error times := 0 for { - fileUrl, objectKey, err = uploadFile(provider, fullFilePath, fileBuffer) + fileUrl, objectKey, err = uploadFile(provider, fullFilePath, fileBuffer, lang) if err != nil { times += 1 if times >= 5 { diff --git a/web/src/Setting.js b/web/src/Setting.js index 7ab7bf3f..10424134 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -38,7 +38,7 @@ export const Countries = [{label: "English", key: "en", country: "US", alt: "Eng {label: "Español", key: "es", country: "ES", alt: "Español"}, {label: "Français", key: "fr", country: "FR", alt: "Français"}, {label: "Deutsch", key: "de", country: "DE", alt: "Deutsch"}, - {label: "Bahasa Indonesia", key: "id", country: "ID", alt: "Bahasa Indonesia"}, + {label: "Indonesia", key: "id", country: "ID", alt: "Indonesia"}, {label: "日本語", key: "ja", country: "JP", alt: "日本語"}, {label: "한국어", key: "ko", country: "KR", alt: "한국어"}, {label: "Русский", key: "ru", country: "RU", alt: "Русский"}, diff --git a/web/src/locales/id/data.json b/web/src/locales/id/data.json index 36d0c536..4d069582 100644 --- a/web/src/locales/id/data.json +++ b/web/src/locales/id/data.json @@ -633,7 +633,7 @@ "Casdoor column": "Kolom Casdoor", "Column name": "Nama kolom", "Column type": "Tipe kolom", - "Database": "Database (bahasa Indonesia)", + "Database": "Database", "Database - Tooltip": "Nama basis data asli", "Database type": "Tipe Basis Data", "Database type - Tooltip": "Jenis database, mendukung semua database yang didukung oleh XORM, seperti MySQL, PostgreSQL, SQL Server, Oracle, SQLite, dan lain-lain.",