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

Support changing locale #6657

Closed

Conversation

JohnNiang
Copy link
Member

What type of PR is this?

/kind feature
/area core
/milestone 2.20.x

What this PR does / why we need it:

This PR adds support for changing locale by submitting a post request to /locale endpoint. A header Set-Cookie with name language will be returned, then subsequent requests will carry the Cookie on and server will response content with corresponding language.

Please see the result below:

http -f POST http://localhost:8090/locale language=zh-CN Cookie:XSRF-TOKEN=xyz x-xsrf-token:xyz Referer:/login\?error -p HBh
POST /locale HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 14
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Cookie: XSRF-TOKEN=xyz
Host: localhost:8090
Referer: /login?error
User-Agent: HTTPie/3.2.3
x-xsrf-token: xyz

language=zh-CN


HTTP/1.1 302 Found
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Expires: 0
Location: /login?error
Pragma: no-cache
Referrer-Policy: strict-origin-when-cross-origin
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
content-length: 0
set-cookie: language=zh-CN; Max-Age=31536000; Expires=Sat, 13 Sep 2025 09:37:45 GMT; Path=/

Does this PR introduce a user-facing change?

为主题端切换地区语言提供支持

Signed-off-by: JohnNiang <johnniang@foxmail.com>
@f2c-ci-robot f2c-ci-robot bot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 13, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.20.x milestone Sep 13, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from ruibaby and wan92hen September 13, 2024 09:40
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Sep 13, 2024
Copy link

f2c-ci-robot bot commented Sep 13, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from johnniang. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.08%. Comparing base (6cd8dc8) to head (f1a5c73).
Report is 69 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6657      +/-   ##
============================================
- Coverage     58.18%   58.08%   -0.11%     
- Complexity     3774     3928     +154     
============================================
  Files           651      673      +22     
  Lines         22125    23061     +936     
  Branches       1538     1573      +35     
============================================
+ Hits          12873    13394     +521     
- Misses         8641     9048     +407     
- Partials        611      619       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JohnNiang
Copy link
Member Author

I'm going to close this PR due to a better solution found.

/close

@f2c-ci-robot f2c-ci-robot bot closed this Sep 13, 2024
Copy link

f2c-ci-robot bot commented Sep 13, 2024

@JohnNiang: Closed this PR.

In response to this:

I'm going to close this PR due to a better solution found.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@JohnNiang JohnNiang deleted the feat/support-change-locale branch September 13, 2024 10:03
@ruibaby ruibaby modified the milestones: 2.20.x, 2.20.0 LTS Sep 14, 2024
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. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants