keys.go 14 KB

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