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

feat: Add ability to pick preferred locale for a user #187

Merged
merged 9 commits into from
Jan 17, 2025

Conversation

danjohnson95
Copy link
Contributor

This PR allows selecting the preferred locale for a user.

It also adds a middleware that sets the application locale to the user's preferred locale, or the system default (as specified by the browser in the Accept-Language header) if one isn't set.

I've specified the supported locales in the config file, and this will be used for:

  • The options which a user can pick from
  • Which locale to use when the browser sends multiple locale preferences

Changing the locale changes the language the user sees and the way in which dates and numbers are formatted in.

The application uses the fallback locale if a string doesn't have a translation defined for the given locale.

Going forward, if any new translation strings are added, the locale code should be added to the supported_locales config file.

This change only affects the Dashboard.

@jbrooksuk jbrooksuk merged commit 3fe7c89 into cachethq:main Jan 17, 2025
25 checks passed
@jbrooksuk
Copy link
Member

Thanks Dan, this is super cool!

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.

2 participants