Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to provide i18n error response #3020

Closed
JohnNiang opened this issue Dec 21, 2022 · 1 comment · Fixed by #3042
Closed

Request to provide i18n error response #3020

JohnNiang opened this issue Dec 21, 2022 · 1 comment · Fixed by #3042
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@JohnNiang
Copy link
Member

Your current Halo version

2.1.0-SNAPSHOT

Describe this feature

Halo now responds with error message in multiple languages, which is very confusing. If we do a good of i18n of error message, it may be better.

/kind feature
/area core
/milestone 2.1.x

Additional information

@f2c-ci-robot f2c-ci-robot bot added this to the 2.1.x milestone Dec 21, 2022
@f2c-ci-robot f2c-ci-robot bot added kind/feature Categorizes issue or PR as related to a new feature. area/core Issues or PRs related to the Halo Core labels Dec 21, 2022
@JohnNiang
Copy link
Member Author

/assign

f2c-ci-robot bot pushed a commit that referenced this issue Dec 26, 2022
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/milestone 2.1.x

#### What this PR does / why we need it:

- Configuring message source location and name enables i18n message resolution.
- Simple global error handler.
- Refactor some exceptions with `ResponseStatusException` to control what HTTP status and problem detail need to be returned.

**TODO**

- [x] Add more UTs.
#### Which issue(s) this PR fixes:

Fixes #3020

#### Special notes for your reviewer:

Steps to test:

1. Try to refine `src/main/resources/config/i18n/messages_zh.properties` and switch Browser language with Chinese.
2. Delibrately make a mistake as you wish and see the error tips in console.
3. Try to access one page which doesn't exist and see the rendered result.

#### Does this PR introduce a user-facing change?

```release-note
完成系统异常的国际化
```
@ruibaby ruibaby modified the milestones: 2.1.x, 2.1.0 Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants