ValidateAndFill now checks the DB query result and returns sentinel errors (ErrDatabase, ErrInvalidCredentials, ErrUserEmptyCredentials) instead of hardcoded Chinese strings. The controller maps each sentinel to the appropriate i18n message, so users see "please contact admin" on DB errors instead of a misleading "wrong password" message. Non-DB errors still return a unified vague response to avoid leaking user existence.
268 lines
14 KiB
YAML
268 lines
14 KiB
YAML
# English translations
|
|
|
|
# Common messages
|
|
common.invalid_params: "Invalid parameters"
|
|
common.database_error: "Database error, please contact the administrator"
|
|
common.retry_later: "Please try again later"
|
|
common.generate_failed: "Generation failed"
|
|
common.not_found: "Not found"
|
|
common.unauthorized: "Unauthorized"
|
|
common.forbidden: "Forbidden"
|
|
common.invalid_id: "Invalid ID"
|
|
common.id_empty: "ID is empty!"
|
|
common.feature_disabled: "This feature is not enabled"
|
|
common.operation_success: "Operation successful"
|
|
common.operation_failed: "Operation failed"
|
|
common.update_success: "Update successful"
|
|
common.update_failed: "Update failed"
|
|
common.create_success: "Creation successful"
|
|
common.create_failed: "Creation failed"
|
|
common.delete_success: "Deletion successful"
|
|
common.delete_failed: "Deletion failed"
|
|
common.already_exists: "Already exists"
|
|
common.name_cannot_be_empty: "Name cannot be empty"
|
|
common.batch_too_many: "Too many items in batch request, maximum is {{.Max}}"
|
|
|
|
# Token messages
|
|
token.name_too_long: "Token name is too long"
|
|
token.quota_negative: "Quota value cannot be negative"
|
|
token.quota_exceed_max: "Quota value exceeds valid range, maximum is {{.Max}}"
|
|
token.generate_failed: "Failed to generate token"
|
|
token.get_info_failed: "Failed to get token info, please try again later"
|
|
token.expired_cannot_enable: "Token has expired and cannot be enabled. Please modify the expiration time or set it to never expire"
|
|
token.exhausted_cannot_enable: "Token quota is exhausted and cannot be enabled. Please modify the remaining quota or set it to unlimited"
|
|
token.invalid: "Invalid token"
|
|
token.not_provided: "Token not provided"
|
|
token.expired: "This token has expired"
|
|
token.exhausted: "This token quota is exhausted TokenStatusExhausted[sk-{{.Prefix}}***{{.Suffix}}]"
|
|
token.status_unavailable: "This token status is unavailable"
|
|
token.db_error: "Invalid token, database query error, please contact administrator"
|
|
|
|
# Redemption messages
|
|
redemption.name_length: "Redemption code name length must be between 1-20"
|
|
redemption.count_positive: "Redemption code count must be greater than 0"
|
|
redemption.count_max: "Maximum 100 redemption codes can be generated at once"
|
|
redemption.create_failed: "Failed to create redemption code, please try again later"
|
|
redemption.invalid: "Invalid redemption code"
|
|
redemption.used: "This redemption code has been used"
|
|
redemption.expired: "This redemption code has expired"
|
|
redemption.failed: "Redemption failed, please try again later"
|
|
redemption.not_provided: "Redemption code not provided"
|
|
redemption.expire_time_invalid: "Expiration time cannot be earlier than current time"
|
|
|
|
# User messages
|
|
user.password_login_disabled: "Password login has been disabled by administrator"
|
|
user.register_disabled: "New user registration has been disabled by administrator"
|
|
user.password_register_disabled: "Password registration has been disabled by administrator, please use third-party account verification"
|
|
user.username_or_password_empty: "Username or password is empty"
|
|
user.username_or_password_error: "Username or password is incorrect, or user has been banned"
|
|
user.email_or_password_empty: "Email or password is empty!"
|
|
user.exists: "Username already exists or has been deleted"
|
|
user.not_exists: "User does not exist"
|
|
user.disabled: "This user has been disabled"
|
|
user.session_save_failed: "Failed to save session, please try again"
|
|
user.require_2fa: "Please enter two-factor authentication code"
|
|
user.email_verification_required: "Email verification is enabled, please enter email address and verification code"
|
|
user.verification_code_error: "Verification code is incorrect or has expired"
|
|
user.input_invalid: "Invalid input {{.Error}}"
|
|
user.no_permission_same_level: "No permission to access users of same or higher level"
|
|
user.no_permission_higher_level: "No permission to update users of same or higher permission level"
|
|
user.cannot_create_higher_level: "Cannot create users with permission level equal to or higher than yourself"
|
|
user.cannot_delete_root_user: "Cannot delete super administrator account"
|
|
user.cannot_disable_root_user: "Cannot disable super administrator user"
|
|
user.cannot_demote_root_user: "Cannot demote super administrator user"
|
|
user.already_admin: "This user is already an administrator"
|
|
user.already_common: "This user is already a common user"
|
|
user.admin_cannot_promote: "Regular administrators cannot promote other users to administrator"
|
|
user.original_password_error: "Original password is incorrect"
|
|
user.invite_quota_insufficient: "Invitation quota is insufficient!"
|
|
user.transfer_quota_minimum: "Minimum transfer quota is {{.Min}}!"
|
|
user.transfer_success: "Transfer successful"
|
|
user.transfer_failed: "Transfer failed {{.Error}}"
|
|
user.topup_processing: "Top-up is processing, please try again later"
|
|
user.register_failed: "User registration failed or user ID retrieval failed"
|
|
user.default_token_failed: "Failed to generate default token"
|
|
user.aff_code_empty: "Affiliate code is empty!"
|
|
user.email_empty: "Email is empty!"
|
|
user.github_id_empty: "GitHub ID is empty!"
|
|
user.discord_id_empty: "Discord ID is empty!"
|
|
user.oidc_id_empty: "OIDC ID is empty!"
|
|
user.wechat_id_empty: "WeChat ID is empty!"
|
|
user.telegram_id_empty: "Telegram ID is empty!"
|
|
user.telegram_not_bound: "This Telegram account is not bound"
|
|
user.linux_do_id_empty: "Linux DO ID is empty!"
|
|
user.quota_change_zero: "Quota change amount cannot be zero"
|
|
|
|
# Quota messages
|
|
quota.negative: "Quota cannot be negative!"
|
|
quota.exceed_max: "Quota value exceeds valid range"
|
|
quota.insufficient: "Insufficient quota"
|
|
quota.warning_invalid: "Invalid warning type"
|
|
quota.threshold_gt_zero: "Warning threshold must be greater than 0"
|
|
|
|
# Subscription messages
|
|
subscription.not_enabled: "Subscription plan is not enabled"
|
|
subscription.title_empty: "Subscription plan title cannot be empty"
|
|
subscription.price_negative: "Price cannot be negative"
|
|
subscription.price_max: "Price cannot exceed 9999"
|
|
subscription.purchase_limit_negative: "Purchase limit cannot be negative"
|
|
subscription.quota_negative: "Total quota cannot be negative"
|
|
subscription.group_not_exists: "Upgrade group does not exist"
|
|
subscription.reset_cycle_gt_zero: "Custom reset cycle must be greater than 0 seconds"
|
|
subscription.purchase_max: "Purchase limit for this plan has been reached"
|
|
subscription.invalid_id: "Invalid subscription ID"
|
|
subscription.invalid_user_id: "Invalid user ID"
|
|
|
|
# Payment messages
|
|
payment.not_configured: "Payment information has not been configured by administrator"
|
|
payment.method_not_exists: "Payment method does not exist"
|
|
payment.callback_error: "Callback URL configuration error"
|
|
payment.create_failed: "Failed to create order"
|
|
payment.start_failed: "Failed to start payment"
|
|
payment.amount_too_low: "Plan amount is too low"
|
|
payment.stripe_not_configured: "Stripe is not configured or key is invalid"
|
|
payment.webhook_not_configured: "Webhook is not configured"
|
|
payment.price_id_not_configured: "StripePriceId is not configured for this plan"
|
|
payment.creem_not_configured: "CreemProductId is not configured for this plan"
|
|
|
|
# Topup messages
|
|
topup.not_provided: "Payment order number not provided"
|
|
topup.order_not_exists: "Top-up order does not exist"
|
|
topup.order_status: "Top-up order status error"
|
|
topup.failed: "Top-up failed, please try again later"
|
|
topup.invalid_quota: "Invalid top-up quota"
|
|
|
|
# Channel messages
|
|
channel.not_exists: "Channel does not exist"
|
|
channel.id_format_error: "Channel ID format error"
|
|
channel.no_available_key: "No available channel keys"
|
|
channel.get_list_failed: "Failed to get channel list, please try again later"
|
|
channel.get_tags_failed: "Failed to get tags, please try again later"
|
|
channel.get_key_failed: "Failed to get channel key"
|
|
channel.get_ollama_failed: "Failed to get Ollama models"
|
|
channel.query_failed: "Failed to query channel"
|
|
channel.no_valid_upstream: "No valid upstream channel"
|
|
channel.upstream_saturated: "Current group upstream load is saturated, please try again later"
|
|
channel.get_available_failed: "Failed to get available channels for model {{.Model}} under group {{.Group}}"
|
|
|
|
# Model messages
|
|
model.name_empty: "Model name cannot be empty"
|
|
model.name_exists: "Model name already exists"
|
|
model.id_missing: "Model ID is missing"
|
|
model.get_list_failed: "Failed to get model list, please try again later"
|
|
model.get_failed: "Failed to get upstream models"
|
|
model.reset_success: "Model ratio reset successful"
|
|
|
|
# Vendor messages
|
|
vendor.name_empty: "Vendor name cannot be empty"
|
|
vendor.name_exists: "Vendor name already exists"
|
|
vendor.id_missing: "Vendor ID is missing"
|
|
|
|
# Group messages
|
|
group.name_type_empty: "Group name and type cannot be empty"
|
|
group.name_exists: "Group name already exists"
|
|
group.id_missing: "Group ID is missing"
|
|
|
|
# Checkin messages
|
|
checkin.disabled: "Check-in feature is not enabled"
|
|
checkin.already_today: "Already checked in today"
|
|
checkin.failed: "Check-in failed, please try again later"
|
|
checkin.quota_failed: "Check-in failed: quota update error"
|
|
|
|
# Passkey messages
|
|
passkey.create_failed: "Unable to create Passkey credential"
|
|
passkey.login_abnormal: "Passkey login status is abnormal"
|
|
passkey.update_failed: "Passkey credential update failed"
|
|
passkey.invalid_user_id: "Invalid user ID"
|
|
passkey.verify_failed: "Passkey verification failed, please try again or contact administrator"
|
|
|
|
# 2FA messages
|
|
twofa.not_enabled: "User has not enabled 2FA"
|
|
twofa.user_id_empty: "User ID cannot be empty"
|
|
twofa.already_exists: "User already has 2FA configured"
|
|
twofa.record_id_empty: "2FA record ID cannot be empty"
|
|
twofa.code_invalid: "Verification code or backup code is incorrect"
|
|
|
|
# Rate limit messages
|
|
rate_limit.reached: "You have reached the request limit: maximum {{.Max}} requests in {{.Minutes}} minutes"
|
|
rate_limit.total_reached: "You have reached the total request limit: maximum {{.Max}} requests in {{.Minutes}} minutes, including failed attempts"
|
|
|
|
# Setting messages
|
|
setting.invalid_type: "Invalid warning type"
|
|
setting.webhook_empty: "Webhook URL cannot be empty"
|
|
setting.webhook_invalid: "Invalid Webhook URL"
|
|
setting.email_invalid: "Invalid email address"
|
|
setting.bark_url_empty: "Bark push URL cannot be empty"
|
|
setting.bark_url_invalid: "Invalid Bark push URL"
|
|
setting.gotify_url_empty: "Gotify server URL cannot be empty"
|
|
setting.gotify_token_empty: "Gotify token cannot be empty"
|
|
setting.gotify_url_invalid: "Invalid Gotify server URL"
|
|
setting.url_must_http: "URL must start with http:// or https://"
|
|
setting.saved: "Settings updated"
|
|
|
|
# Deployment messages (io.net)
|
|
deployment.not_enabled: "io.net model deployment is not enabled or API key is missing"
|
|
deployment.id_required: "Deployment ID is required"
|
|
deployment.container_id_required: "Container ID is required"
|
|
deployment.name_empty: "Deployment name cannot be empty"
|
|
deployment.name_taken: "Deployment name is not available, please choose a different name"
|
|
deployment.hardware_id_required: "hardware_id parameter is required"
|
|
deployment.hardware_invalid_id: "Invalid hardware_id parameter"
|
|
deployment.api_key_required: "api_key is required"
|
|
deployment.invalid_payload: "Invalid request payload"
|
|
deployment.not_found: "Container details not found"
|
|
|
|
# Performance messages
|
|
performance.disk_cache_cleared: "Inactive disk cache has been cleared"
|
|
performance.stats_reset: "Statistics have been reset"
|
|
performance.gc_executed: "GC has been executed"
|
|
|
|
# Ability messages
|
|
ability.db_corrupted: "Database consistency has been compromised"
|
|
ability.repair_running: "A repair task is already running, please try again later"
|
|
|
|
# OAuth messages
|
|
oauth.invalid_code: "Invalid authorization code"
|
|
oauth.get_user_error: "Failed to get user information"
|
|
oauth.account_used: "This account has been bound to another user"
|
|
oauth.unknown_provider: "Unknown OAuth provider"
|
|
oauth.state_invalid: "State parameter is empty or mismatched"
|
|
oauth.not_enabled: "{{.Provider}} login and registration has not been enabled by administrator"
|
|
oauth.user_deleted: "User has been deleted"
|
|
oauth.user_banned: "User has been banned"
|
|
oauth.bind_success: "Binding successful"
|
|
oauth.already_bound: "This {{.Provider}} account has already been bound"
|
|
oauth.connect_failed: "Unable to connect to {{.Provider}} server, please try again later"
|
|
oauth.token_failed: "Failed to get token from {{.Provider}}, please check settings"
|
|
oauth.user_info_empty: "{{.Provider}} returned empty user info, please check settings"
|
|
oauth.trust_level_low: "Linux DO trust level does not meet the minimum required by administrator"
|
|
|
|
# Model layer error messages
|
|
redeem.failed: "Redemption failed, please try again later"
|
|
user.create_default_token_error: "Failed to create default token"
|
|
common.uuid_duplicate: "Please retry, the system generated a duplicate UUID!"
|
|
common.invalid_input: "Invalid input"
|
|
|
|
# Distributor messages
|
|
distributor.invalid_request: "Invalid request: {{.Error}}"
|
|
distributor.invalid_channel_id: "Invalid channel ID"
|
|
distributor.channel_disabled: "This channel has been disabled"
|
|
distributor.token_no_model_access: "This token has no access to any models"
|
|
distributor.token_model_forbidden: "This token has no access to model {{.Model}}"
|
|
distributor.model_name_required: "Model name not specified, model name cannot be empty"
|
|
distributor.invalid_playground_request: "Invalid playground request: {{.Error}}"
|
|
distributor.group_access_denied: "No permission to access this group"
|
|
distributor.get_channel_failed: "Failed to get available channel for model {{.Model}} under group {{.Group}} (distributor): {{.Error}}"
|
|
distributor.no_available_channel: "No available channel for model {{.Model}} under group {{.Group}} (distributor)"
|
|
distributor.invalid_midjourney_request: "Invalid Midjourney request: {{.Error}}"
|
|
distributor.invalid_request_parse_model: "Invalid request, unable to parse model"
|
|
|
|
# Custom OAuth provider messages
|
|
custom_oauth.not_found: "Custom OAuth provider not found"
|
|
custom_oauth.slug_empty: "Slug cannot be empty"
|
|
custom_oauth.slug_exists: "Slug already exists"
|
|
custom_oauth.name_empty: "Provider name cannot be empty"
|
|
custom_oauth.has_bindings: "Cannot delete provider with existing user bindings"
|
|
custom_oauth.binding_not_found: "OAuth binding not found"
|
|
custom_oauth.provider_id_field_invalid: "Could not extract user ID from provider response"
|