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

Add locale picker to header #824

Merged
merged 7 commits into from
Apr 23, 2024
Merged

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Apr 22, 2024

Description

Adds a locale picker to the header of the page, next to the profile icon.

This is to make it easier to switch languages, without having to fiddle with browser settings.

Addressed Issue

N/A

Additional Details

Current version (don't ask me why the GIF quality is worse, no idea):

Kapture 2024-04-23 at 19 54 08

Original version:

Kapture 2024-04-22 at 22 44 58

Checklist

@nscuro nscuro added the enhancement New feature or request label Apr 22, 2024
@nscuro nscuro added this to the 4.11 milestone Apr 22, 2024
@nscuro
Copy link
Member Author

nscuro commented Apr 22, 2024

@fnxpt Fancy giving this a review?

Besides the code itself, please have a look at the new translations. For German, the auto-translate suggested "polieren" for "Polish" (as in polishing, the verb lol).

nscuro added 3 commits April 22, 2024 23:22
This is to make it easier to switch languages, without having to fiddle with browser settings.

Signed-off-by: nscuro <[email protected]>
Signed-off-by: nscuro <[email protected]>
Copy link
Contributor

@fnxpt fnxpt left a comment

Choose a reason for hiding this comment

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

As an additional comment, I would add flags instead of text, usually on these types of selectors its more common to see a flag

src/i18n/locales/pt.json Show resolved Hide resolved
src/i18n/locales/pt.json Outdated Show resolved Hide resolved
src/i18n/locales/pt-BR.json Outdated Show resolved Hide resolved
src/i18n/locales/pt-BR.json Show resolved Hide resolved
src/i18n/locales/es.json Outdated Show resolved Hide resolved
@nscuro
Copy link
Member Author

nscuro commented Apr 23, 2024

Thanks @fnxpt!

I would add flags instead of text, usually on these types of selectors its more common to see a flag

Good point. I briefly looked into that but couldn't be bothered to add yet another NPM package just for flag icons. I'll have another look, I agree that country codes might be sub-optimal.

@fnxpt
Copy link
Contributor

fnxpt commented Apr 23, 2024

Good point. I briefly looked into that but couldn't be bothered to add yet another NPM package just for flag icons. I'll have another look, I agree that country codes might be sub-optimal.

We can also add the images on the resources and just do {locale}.png, no need for an extra library

@nscuro
Copy link
Member Author

nscuro commented Apr 23, 2024

@fnxpt Any good source for flag icons you can recommend?

@nscuro
Copy link
Member Author

nscuro commented Apr 23, 2024

Languages are now displayed as country flag emojis instead of language codes, as per @fnxpt's suggestion:

image

Got feedback from @msymons that the picker should probably be located closer to the user profile. I'll see if I can add it to the dropdown that opens when clicking the user icon.

@nscuro
Copy link
Member Author

nscuro commented Apr 23, 2024

@fnxpt Suggestions applied. Updated the GIF in the PR description to show the current look&feel of the language picker. Can you have another look please?

@nscuro nscuro requested a review from fnxpt April 23, 2024 18:06
@fnxpt
Copy link
Contributor

fnxpt commented Apr 23, 2024

lgtm

@nscuro nscuro merged commit 69f9f5e into DependencyTrack:master Apr 23, 2024
11 checks passed
@nscuro nscuro deleted the locale-picker branch April 23, 2024 18:09
@nscuro nscuro added the i18n Issues and PRs related to localization label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request i18n Issues and PRs related to localization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants