-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Feat: language picker #6716
base: master
Are you sure you want to change the base?
Feat: language picker #6716
Conversation
ArtifactsThese changes are published for testing on Buildkite, DockerHub and GitHub Container Registry. Docker Container
|
Important Auto Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent updates focus on enhancing language support and configuration across the application. Key changes include adding support for TypeScript template files, refining language sorting based on locale criteria, removing default locale constants, and extending timeout durations for service readiness checks. Additionally, new functionalities for handling locales, including a language selector component and utilities for language information retrieval and storage management, have been introduced to improve the user experience in language selection and application internationalization. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (6)
- .editorconfig (1 hunks)
- cmd/authelia-gen/templates/web_i18n_index.ts.tmpl (1 hunks)
- internal/suites/environment.go (4 hunks)
- web/src/components/LanguageSelector.tsx (1 hunks)
- web/src/i18n/index.ts (1 hunks)
- web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx (3 hunks)
Files skipped from review due to trivial changes (1)
- .editorconfig
Additional comments: 7
cmd/authelia-gen/templates/web_i18n_index.ts.tmpl (1)
- 59-63: The addition of the
supportedLngsNames
constant array is correctly implemented and aligns with the PR's objectives to enhance language selection functionality. The syntax and structure are consistent with the file's purpose as a template for generating TypeScript code.internal/suites/environment.go (4)
- 44-44: The increase in timeout duration from 90 seconds to 120 seconds for the
waitUntilAutheliaBackendIsReady
function is correctly implemented and aligns with the PR's objectives to improve the reliability of service readiness checks.- 53-53: The increase in timeout duration from 90 seconds to 120 seconds for the
waitUntilAutheliaFrontendIsReady
function is correctly implemented and aligns with the PR's objectives to improve the reliability of service readiness checks.- 62-62: The increase in timeout duration from 90 seconds to 120 seconds for the
waitUntilK3DIsReady
function is correctly implemented and aligns with the PR's objectives to improve the reliability of service readiness checks.- 71-71: The increase in timeout duration from 90 seconds to 120 seconds for the
waitUntilSambaIsReady
function is correctly implemented and aligns with the PR's objectives to improve the reliability of service readiness checks.web/src/i18n/index.ts (1)
- 120-156: The addition of the
supportedLngsNames
constant array is correctly implemented and aligns with the PR's objectives to enhance language selection functionality. The syntax, structure, and comprehensive list of languages are consistent with the file's purpose and the overall goal of providing a flexible language selection feature.web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx (1)
- 48-54: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [11-110]
The integration of the
LanguageSelector
component into theFirstFactorForm
is correctly implemented and aligns with the PR's objectives to enhance user experience by allowing language selection at the login stage. The use of React hooks for state management and the strategic placement of the component for visibility and accessibility are well-executed.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6716 +/- ##
==========================================
- Coverage 73.65% 73.60% -0.06%
==========================================
Files 346 349 +3
Lines 29973 30258 +285
Branches 839 857 +18
==========================================
+ Hits 22078 22272 +194
- Misses 7022 7096 +74
- Partials 873 890 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
|
✅ Deploy Preview for authelia-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
docs/data/languages.json
is excluded by:!**/*.json
Files selected for processing (8)
- cmd/authelia-gen/cmd_locales.go (2 hunks)
- cmd/authelia-gen/templates/web_i18n_index.ts.tmpl (1 hunks)
- cmd/authelia-gen/types.go (1 hunks)
- web/src/components/LanguageSelector.tsx (1 hunks)
- web/src/i18n/detectors/localStorageCustom.ts (1 hunks)
- web/src/i18n/index.ts (1 hunks)
- web/src/utils/localStorage.ts (1 hunks)
- web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (4)
- cmd/authelia-gen/templates/web_i18n_index.ts.tmpl
- web/src/components/LanguageSelector.tsx
- web/src/i18n/index.ts
- web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx
Additional comments: 5
web/src/i18n/detectors/localStorageCustom.ts (1)
- 3-3: The import of
localStorageAvailable
from@utils/localStorage
is correctly implemented. Ensure that the utility function behaves as expected across different environments, especially considering scenarios where local storage might be restricted or unavailable.web/src/utils/localStorage.ts (1)
- 5-19: The
localStorageAvailable
function is well-implemented, correctly checking for both the presence and usability of local storage. This approach effectively mitigates potential exceptions in environments where local storage is restricted.cmd/authelia-gen/cmd_locales.go (2)
- 173-173: The addition of
languages.RealLng
and its subsequent sorting is a thoughtful enhancement, improving the organization of language options for users. This change positively impacts user experience by ensuring a logical and consistent presentation of language choices.- 220-222: The sorting logic applied to
languages.RealLng
is correctly implemented, ensuring that the default language is prioritized and other languages are sorted alphabetically. This approach enhances the user experience by providing a more intuitive selection process.cmd/authelia-gen/types.go (1)
- 100-100: The addition of the
RealLng
field to theLanguages
struct is a necessary and well-implemented change to support improved language organization and selection. This change aligns with the project's objectives of enhancing user experience through more intuitive language options.
I'll take a look at this once the conflicting changes are merged. I suspect we'll want something within the settings area too. Looks mostly good however, would like to allow some additional things in general. |
Co-authored-by: James Elliott <james-d-elliott@users.noreply.github.com> Signed-off-by: Manuel Nuñez <10672208+mind-ar@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- cmd/authelia-gen/types.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- cmd/authelia-gen/types.go
@nightah something like this? |
ase enter the commit message for your changes. Lines starting
Added an option to the component to switch between two modes, so it can be used as part of a form: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
docs/data/languages.json
is excluded by:!**/*.json
Files selected for processing (4)
- cmd/authelia-gen/cmd_locales.go (4 hunks)
- web/src/components/LanguageSelector.tsx (1 hunks)
- web/src/i18n/index.ts (1 hunks)
- web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (4)
- cmd/authelia-gen/cmd_locales.go
- web/src/components/LanguageSelector.tsx
- web/src/i18n/index.ts
- web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx
Yea I ran into this issue too at some point, can't recall how I handled it. My recollection is there are actually 3 total. |
Yeah this is what I meant here, I'm fine with whatever path we take here. We just have to ensure that the cases for browsers only advertising macrolanguages You can experiment with the language matching using most browsers to change the requested language. As long as the automatic functionality remains intact and the list makes logical sense then I'm fine with it. We can as I said make fixes later if it's not quite right, and when we get the second language add logic to handle this from the frontend. Regarding caching, we can use the ETag / If-None-Match process to ensure the request is only processed when the values change. If we do this when/if we add logic to handle fs changes (i.e. locales added) then we can determine there is an update to be sent to clients. Though this can be added later too. |
Done
Done (etag) Feel free to ask to do any change |
43017c1
to
821e7d1
Compare
… into feat-i18n-picker
Signed-off-by: Manuel Nuñez <10672208+mind-ar@users.noreply.github.com>
Hi! @james-d-elliott and @nightah here's a functional version with custom locales support. I'll let this as draft for now, I still need to do a general review/refactor and write some tests |
this PR allows the end user to manually select the UI language
tasks:
portal.json
Summary by CodeRabbit
Summary of changes