Skip to content

fix(i18n): add English messages for three backend error reasons - #1672

Merged
LinkinStars merged 1 commit into
apache:devfrom
farisbasha:fix-missing-backend-error-messages
Nov 19, 2026
Merged

LinkinStars merged 1 commit into
apache:devfrom
farisbasha:fix-missing-backend-error-messages

Conversation

@farisbasha

@farisbasha farisbasha commented Nov 18, 2026 •

Copy link
Copy Markdown

Proposed Changes

  • Add backend.error.answer.restrict_answer, backend.error.upload.source_unsupported and backend.error.feature.disabled to i18n/en_US.yaml.
  • These keys are used by reason.AnswerRestrictAnswer (returned by AnswerController.Add in internal/controller/answer_controller.go when "restrict answer" is on and the user already has an answer on the question), reason.UploadFileSourceUnsupported (internal/controller/upload_controller.go) and reason.ErrFeatureDisabled (FeatureToggleService.EnsureEnabled). They are not in en_US.yaml (or zh_CN.yaml), so translator.Tr falls back to the key and the response message is the raw key, e.g. error.answer.restrict_answer.
  • Only the English source file is changed; other languages come from Crowdin.

How I checked: compared every string constant in internal/base/reason/reason.go with the backend section of en_US.yaml; these three were the only ones missing. The edited file parses as YAML and the three keys resolve. I did not run the server locally.

Prepared with the help of an AI assistant.

reason.AnswerRestrictAnswer, reason.UploadFileSourceUnsupported and
reason.ErrFeatureDisabled point to keys that are missing from
i18n/en_US.yaml, so the API returned the raw key as the error message.
@LinkinStars

Copy link
Copy Markdown
Member

Thanks for the fix!

@LinkinStars
LinkinStars merged commit 61e8741 into apache:dev Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants