halo-dev / halo

强大易用的开源建站工具。
https://www.halo.run
GNU General Public License v3.0
33.3k stars 9.61k forks source link

Simplify ThemeLocaleContextResolver #6651

Closed JohnNiang closed 1 week ago

JohnNiang commented 1 week ago

What type of PR is this?

/kind improvement /area theme /milestone 2.20.x

What this PR does / why we need it:

This PR simplifies ThemeLocaleContextResolver by removing unused attributes.

In another PR https://github.com/halo-dev/halo/pull/6647, fixed locale resolution for query parameter language. This PR fixes locale resolution for cookie language as well.

Please see the results below:

http https://www.halo.run/ Cookie:language=zh-CN -p h

HTTP/1.1 200 OK
Content-Language: und
http http://localhost:8090 Cookie:language=zh-CN -p h

HTTP/1.1 200 OK
Content-Language: zh-CN

Does this PR introduce a user-facing change?

None
sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 58.10%. Comparing base (6cd8dc8) to head (a23458d). Report is 68 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6651 +/- ## ============================================ - Coverage 58.18% 58.10% -0.08% - Complexity 3774 3923 +149 ============================================ Files 651 673 +22 Lines 22125 23038 +913 Branches 1538 1573 +35 ============================================ + Hits 12873 13386 +513 - Misses 8641 9035 +394 - Partials 611 617 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

f2c-ci-robot[bot] commented 1 week ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/halo-dev/halo/blob/main/OWNERS)~~ [guqing] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment