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

web: fix locale loading being skipped #9301

Merged
merged 1 commit into from
Apr 16, 2024
Merged

Conversation

Gunsmithy
Copy link
Contributor

Details

Hey there,

I noticed on authentik that no matter what browser locale I had set or what locale I passed to the query string, the locale would always be loaded as 'en'.

After looking at the code, I attributed a potential fix to the one line I reference in this PR. I did a Chrome local override and this fixed the issue with the query string being ignored, but it still doesn't seem to consider the browser headers.

The lack of consideration for browser headers may be due to an issue with autoDetectLanguage where it never defaults requestedCode to TOMBSTONE because requestedCode is always set to en from DEFAULT_LOCALE so it's not really an optional.

I'm at work so I didn't have sufficient time to determine if this is an acceptable fix for at least the query string issue, nor run any local tests, so this PR is more meant to serve as an Issue for review/discussion.

I'll see if I can explore it more in the future if I can find some time to set up a proper local dev environment.

Let me know if I can provide any more additional info.

Thanks,

Dylan


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@Gunsmithy Gunsmithy requested a review from a team as a code owner April 16, 2024 19:39
Copy link

netlify bot commented Apr 16, 2024

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 8a4f374
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/661ed40c5aa1d600081ac94e
😎 Deploy Preview https://deploy-preview-9301--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 16, 2024

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit 8a4f374
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/661ed40c3368500008105fba

@rissson rissson changed the title Fix locale loading being skipped. web: fix locale loading being skipped Apr 16, 2024
Copy link
Contributor

@kensternberg-authentik kensternberg-authentik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, and thanks, @Gunsmithy.

Copy link

codecov bot commented Apr 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.38%. Comparing base (ba36855) to head (8a4f374).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9301      +/-   ##
==========================================
- Coverage   92.38%   92.38%   -0.01%     
==========================================
  Files         665      665              
  Lines       32609    32609              
==========================================
- Hits        30126    30125       -1     
- Misses       2483     2484       +1     
Flag Coverage Δ
e2e 50.68% <ø> (ø)
integration 26.01% <ø> (ø)
unit 89.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@BeryJu BeryJu merged commit 4544f47 into goauthentik:main Apr 16, 2024
60 of 64 checks passed
kensternberg-authentik added a commit that referenced this pull request Apr 18, 2024
* main: (23 commits)
  web: bump API Client version (#9316)
  release: 2024.2.3
  website/docs: 2024.2.3 release notes (#9313)
  web/admin: fix log viewer empty state (#9315)
  website/docs: fix formatting for stage changes (#9314)
  core: bump github.com/go-ldap/ldap/v3 from 3.4.7 to 3.4.8 (#9310)
  core: bump goauthentik.io/api/v3 from 3.2024022.11 to 3.2024022.12 (#9311)
  web: bump core-js from 3.36.1 to 3.37.0 in /web (#9309)
  core: bump gunicorn from 21.2.0 to 22.0.0 (#9308)
  core, web: update translations (#9307)
  website/docs: system settings: add default token duration and length (#9306)
  web/flows: update flow background (#9305)
  web: fix locale loading being skipped (#9301)
  translate: Updates for file web/xliff/en.xlf in fr (#9304)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in fr (#9303)
  core: replace authentik_signals_ignored_fields with audit_ignore (#9291)
  web/flow: fix form input rendering issue (#9297)
  events: fix incorrect user logged when using API token authentication (#9302)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in zh_CN (#9293)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in zh-Hans (#9295)
  ...
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.

3 participants