keys.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. package i18n
  2. // Message keys for i18n translations
  3. // Use these constants instead of hardcoded strings
  4. // Common error messages
  5. const (
  6. MsgInvalidParams = "common.invalid_params"
  7. MsgDatabaseError = "common.database_error"
  8. MsgRetryLater = "common.retry_later"
  9. MsgGenerateFailed = "common.generate_failed"
  10. MsgNotFound = "common.not_found"
  11. MsgUnauthorized = "common.unauthorized"
  12. MsgForbidden = "common.forbidden"
  13. MsgInvalidId = "common.invalid_id"
  14. MsgIdEmpty = "common.id_empty"
  15. MsgFeatureDisabled = "common.feature_disabled"
  16. MsgOperationSuccess = "common.operation_success"
  17. MsgOperationFailed = "common.operation_failed"
  18. MsgUpdateSuccess = "common.update_success"
  19. MsgUpdateFailed = "common.update_failed"
  20. MsgCreateSuccess = "common.create_success"
  21. MsgCreateFailed = "common.create_failed"
  22. MsgDeleteSuccess = "common.delete_success"
  23. MsgDeleteFailed = "common.delete_failed"
  24. MsgAlreadyExists = "common.already_exists"
  25. MsgNameCannotBeEmpty = "common.name_cannot_be_empty"
  26. )
  27. // Token related messages
  28. const (
  29. MsgTokenNameTooLong = "token.name_too_long"
  30. MsgTokenQuotaNegative = "token.quota_negative"
  31. MsgTokenQuotaExceedMax = "token.quota_exceed_max"
  32. MsgTokenGenerateFailed = "token.generate_failed"
  33. MsgTokenGetInfoFailed = "token.get_info_failed"
  34. MsgTokenExpiredCannotEnable = "token.expired_cannot_enable"
  35. MsgTokenExhaustedCannotEable = "token.exhausted_cannot_enable"
  36. MsgTokenInvalid = "token.invalid"
  37. MsgTokenNotProvided = "token.not_provided"
  38. MsgTokenExpired = "token.expired"
  39. MsgTokenExhausted = "token.exhausted"
  40. MsgTokenStatusUnavailable = "token.status_unavailable"
  41. MsgTokenDbError = "token.db_error"
  42. )
  43. // Redemption related messages
  44. const (
  45. MsgRedemptionNameLength = "redemption.name_length"
  46. MsgRedemptionCountPositive = "redemption.count_positive"
  47. MsgRedemptionCountMax = "redemption.count_max"
  48. MsgRedemptionCreateFailed = "redemption.create_failed"
  49. MsgRedemptionInvalid = "redemption.invalid"
  50. MsgRedemptionUsed = "redemption.used"
  51. MsgRedemptionExpired = "redemption.expired"
  52. MsgRedemptionFailed = "redemption.failed"
  53. MsgRedemptionNotProvided = "redemption.not_provided"
  54. MsgRedemptionExpireTimeInvalid = "redemption.expire_time_invalid"
  55. )
  56. // User related messages
  57. const (
  58. MsgUserPasswordLoginDisabled = "user.password_login_disabled"
  59. MsgUserRegisterDisabled = "user.register_disabled"
  60. MsgUserPasswordRegisterDisabled = "user.password_register_disabled"
  61. MsgUserUsernameOrPasswordEmpty = "user.username_or_password_empty"
  62. MsgUserUsernameOrPasswordError = "user.username_or_password_error"
  63. MsgUserEmailOrPasswordEmpty = "user.email_or_password_empty"
  64. MsgUserExists = "user.exists"
  65. MsgUserNotExists = "user.not_exists"
  66. MsgUserDisabled = "user.disabled"
  67. MsgUserSessionSaveFailed = "user.session_save_failed"
  68. MsgUserRequire2FA = "user.require_2fa"
  69. MsgUserEmailVerificationRequired = "user.email_verification_required"
  70. MsgUserVerificationCodeError = "user.verification_code_error"
  71. MsgUserInputInvalid = "user.input_invalid"
  72. MsgUserNoPermissionSameLevel = "user.no_permission_same_level"
  73. MsgUserNoPermissionHigherLevel = "user.no_permission_higher_level"
  74. MsgUserCannotCreateHigherLevel = "user.cannot_create_higher_level"
  75. MsgUserCannotDeleteRootUser = "user.cannot_delete_root_user"
  76. MsgUserCannotDisableRootUser = "user.cannot_disable_root_user"
  77. MsgUserCannotDemoteRootUser = "user.cannot_demote_root_user"
  78. MsgUserAlreadyAdmin = "user.already_admin"
  79. MsgUserAlreadyCommon = "user.already_common"
  80. MsgUserAdminCannotPromote = "user.admin_cannot_promote"
  81. MsgUserOriginalPasswordError = "user.original_password_error"
  82. MsgUserInviteQuotaInsufficient = "user.invite_quota_insufficient"
  83. MsgUserTransferQuotaMinimum = "user.transfer_quota_minimum"
  84. MsgUserTransferSuccess = "user.transfer_success"
  85. MsgUserTransferFailed = "user.transfer_failed"
  86. MsgUserTopUpProcessing = "user.topup_processing"
  87. MsgUserRegisterFailed = "user.register_failed"
  88. MsgUserDefaultTokenFailed = "user.default_token_failed"
  89. MsgUserAffCodeEmpty = "user.aff_code_empty"
  90. MsgUserEmailEmpty = "user.email_empty"
  91. MsgUserGitHubIdEmpty = "user.github_id_empty"
  92. MsgUserDiscordIdEmpty = "user.discord_id_empty"
  93. MsgUserOidcIdEmpty = "user.oidc_id_empty"
  94. MsgUserWeChatIdEmpty = "user.wechat_id_empty"
  95. MsgUserTelegramIdEmpty = "user.telegram_id_empty"
  96. MsgUserTelegramNotBound = "user.telegram_not_bound"
  97. MsgUserLinuxDOIdEmpty = "user.linux_do_id_empty"
  98. )
  99. // Quota related messages
  100. const (
  101. MsgQuotaNegative = "quota.negative"
  102. MsgQuotaExceedMax = "quota.exceed_max"
  103. MsgQuotaInsufficient = "quota.insufficient"
  104. MsgQuotaWarningInvalid = "quota.warning_invalid"
  105. MsgQuotaThresholdGtZero = "quota.threshold_gt_zero"
  106. )
  107. // Subscription related messages
  108. const (
  109. MsgSubscriptionNotEnabled = "subscription.not_enabled"
  110. MsgSubscriptionTitleEmpty = "subscription.title_empty"
  111. MsgSubscriptionPriceNegative = "subscription.price_negative"
  112. MsgSubscriptionPriceMax = "subscription.price_max"
  113. MsgSubscriptionPurchaseLimitNeg = "subscription.purchase_limit_negative"
  114. MsgSubscriptionQuotaNegative = "subscription.quota_negative"
  115. MsgSubscriptionGroupNotExists = "subscription.group_not_exists"
  116. MsgSubscriptionResetCycleGtZero = "subscription.reset_cycle_gt_zero"
  117. MsgSubscriptionPurchaseMax = "subscription.purchase_max"
  118. MsgSubscriptionInvalidId = "subscription.invalid_id"
  119. MsgSubscriptionInvalidUserId = "subscription.invalid_user_id"
  120. )
  121. // Payment related messages
  122. const (
  123. MsgPaymentNotConfigured = "payment.not_configured"
  124. MsgPaymentMethodNotExists = "payment.method_not_exists"
  125. MsgPaymentCallbackError = "payment.callback_error"
  126. MsgPaymentCreateFailed = "payment.create_failed"
  127. MsgPaymentStartFailed = "payment.start_failed"
  128. MsgPaymentAmountTooLow = "payment.amount_too_low"
  129. MsgPaymentStripeNotConfig = "payment.stripe_not_configured"
  130. MsgPaymentWebhookNotConfig = "payment.webhook_not_configured"
  131. MsgPaymentPriceIdNotConfig = "payment.price_id_not_configured"
  132. MsgPaymentCreemNotConfig = "payment.creem_not_configured"
  133. )
  134. // Topup related messages
  135. const (
  136. MsgTopupNotProvided = "topup.not_provided"
  137. MsgTopupOrderNotExists = "topup.order_not_exists"
  138. MsgTopupOrderStatus = "topup.order_status"
  139. MsgTopupFailed = "topup.failed"
  140. MsgTopupInvalidQuota = "topup.invalid_quota"
  141. )
  142. // Channel related messages
  143. const (
  144. MsgChannelNotExists = "channel.not_exists"
  145. MsgChannelIdFormatError = "channel.id_format_error"
  146. MsgChannelNoAvailableKey = "channel.no_available_key"
  147. MsgChannelGetListFailed = "channel.get_list_failed"
  148. MsgChannelGetTagsFailed = "channel.get_tags_failed"
  149. MsgChannelGetKeyFailed = "channel.get_key_failed"
  150. MsgChannelGetOllamaFailed = "channel.get_ollama_failed"
  151. MsgChannelQueryFailed = "channel.query_failed"
  152. MsgChannelNoValidUpstream = "channel.no_valid_upstream"
  153. MsgChannelUpstreamSaturated = "channel.upstream_saturated"
  154. MsgChannelGetAvailableFailed = "channel.get_available_failed"
  155. )
  156. // Model related messages
  157. const (
  158. MsgModelNameEmpty = "model.name_empty"
  159. MsgModelNameExists = "model.name_exists"
  160. MsgModelIdMissing = "model.id_missing"
  161. MsgModelGetListFailed = "model.get_list_failed"
  162. MsgModelGetFailed = "model.get_failed"
  163. MsgModelResetSuccess = "model.reset_success"
  164. )
  165. // Vendor related messages
  166. const (
  167. MsgVendorNameEmpty = "vendor.name_empty"
  168. MsgVendorNameExists = "vendor.name_exists"
  169. MsgVendorIdMissing = "vendor.id_missing"
  170. )
  171. // Group related messages
  172. const (
  173. MsgGroupNameTypeEmpty = "group.name_type_empty"
  174. MsgGroupNameExists = "group.name_exists"
  175. MsgGroupIdMissing = "group.id_missing"
  176. )
  177. // Checkin related messages
  178. const (
  179. MsgCheckinDisabled = "checkin.disabled"
  180. MsgCheckinAlreadyToday = "checkin.already_today"
  181. MsgCheckinFailed = "checkin.failed"
  182. MsgCheckinQuotaFailed = "checkin.quota_failed"
  183. )
  184. // Passkey related messages
  185. const (
  186. MsgPasskeyCreateFailed = "passkey.create_failed"
  187. MsgPasskeyLoginAbnormal = "passkey.login_abnormal"
  188. MsgPasskeyUpdateFailed = "passkey.update_failed"
  189. MsgPasskeyInvalidUserId = "passkey.invalid_user_id"
  190. MsgPasskeyVerifyFailed = "passkey.verify_failed"
  191. )
  192. // 2FA related messages
  193. const (
  194. MsgTwoFANotEnabled = "twofa.not_enabled"
  195. MsgTwoFAUserIdEmpty = "twofa.user_id_empty"
  196. MsgTwoFAAlreadyExists = "twofa.already_exists"
  197. MsgTwoFARecordIdEmpty = "twofa.record_id_empty"
  198. MsgTwoFACodeInvalid = "twofa.code_invalid"
  199. )
  200. // Rate limit related messages
  201. const (
  202. MsgRateLimitReached = "rate_limit.reached"
  203. MsgRateLimitTotalReached = "rate_limit.total_reached"
  204. )
  205. // Setting related messages
  206. const (
  207. MsgSettingInvalidType = "setting.invalid_type"
  208. MsgSettingWebhookEmpty = "setting.webhook_empty"
  209. MsgSettingWebhookInvalid = "setting.webhook_invalid"
  210. MsgSettingEmailInvalid = "setting.email_invalid"
  211. MsgSettingBarkUrlEmpty = "setting.bark_url_empty"
  212. MsgSettingBarkUrlInvalid = "setting.bark_url_invalid"
  213. MsgSettingGotifyUrlEmpty = "setting.gotify_url_empty"
  214. MsgSettingGotifyTokenEmpty = "setting.gotify_token_empty"
  215. MsgSettingGotifyUrlInvalid = "setting.gotify_url_invalid"
  216. MsgSettingUrlMustHttp = "setting.url_must_http"
  217. MsgSettingSaved = "setting.saved"
  218. )
  219. // Deployment related messages (io.net)
  220. const (
  221. MsgDeploymentNotEnabled = "deployment.not_enabled"
  222. MsgDeploymentIdRequired = "deployment.id_required"
  223. MsgDeploymentContainerIdReq = "deployment.container_id_required"
  224. MsgDeploymentNameEmpty = "deployment.name_empty"
  225. MsgDeploymentNameTaken = "deployment.name_taken"
  226. MsgDeploymentHardwareIdReq = "deployment.hardware_id_required"
  227. MsgDeploymentHardwareInvId = "deployment.hardware_invalid_id"
  228. MsgDeploymentApiKeyRequired = "deployment.api_key_required"
  229. MsgDeploymentInvalidPayload = "deployment.invalid_payload"
  230. MsgDeploymentNotFound = "deployment.not_found"
  231. )
  232. // Performance related messages
  233. const (
  234. MsgPerfDiskCacheCleared = "performance.disk_cache_cleared"
  235. MsgPerfStatsReset = "performance.stats_reset"
  236. MsgPerfGcExecuted = "performance.gc_executed"
  237. )
  238. // Ability related messages
  239. const (
  240. MsgAbilityDbCorrupted = "ability.db_corrupted"
  241. MsgAbilityRepairRunning = "ability.repair_running"
  242. )
  243. // OAuth related messages
  244. const (
  245. MsgOAuthInvalidCode = "oauth.invalid_code"
  246. MsgOAuthGetUserErr = "oauth.get_user_error"
  247. MsgOAuthAccountUsed = "oauth.account_used"
  248. MsgOAuthUnknownProvider = "oauth.unknown_provider"
  249. MsgOAuthStateInvalid = "oauth.state_invalid"
  250. MsgOAuthNotEnabled = "oauth.not_enabled"
  251. MsgOAuthUserDeleted = "oauth.user_deleted"
  252. MsgOAuthUserBanned = "oauth.user_banned"
  253. MsgOAuthBindSuccess = "oauth.bind_success"
  254. MsgOAuthAlreadyBound = "oauth.already_bound"
  255. MsgOAuthConnectFailed = "oauth.connect_failed"
  256. MsgOAuthTokenFailed = "oauth.token_failed"
  257. MsgOAuthUserInfoEmpty = "oauth.user_info_empty"
  258. MsgOAuthTrustLevelLow = "oauth.trust_level_low"
  259. )
  260. // Model layer error messages (for translation in controller)
  261. const (
  262. MsgRedeemFailed = "redeem.failed"
  263. MsgCreateDefaultTokenErr = "user.create_default_token_error"
  264. MsgUuidDuplicate = "common.uuid_duplicate"
  265. MsgInvalidInput = "common.invalid_input"
  266. )
  267. // Custom OAuth provider related messages
  268. const (
  269. MsgCustomOAuthNotFound = "custom_oauth.not_found"
  270. MsgCustomOAuthSlugEmpty = "custom_oauth.slug_empty"
  271. MsgCustomOAuthSlugExists = "custom_oauth.slug_exists"
  272. MsgCustomOAuthNameEmpty = "custom_oauth.name_empty"
  273. MsgCustomOAuthHasBindings = "custom_oauth.has_bindings"
  274. MsgCustomOAuthBindingNotFound = "custom_oauth.binding_not_found"
  275. MsgCustomOAuthProviderIdInvalid = "custom_oauth.provider_id_field_invalid"
  276. )