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: save user preferences for language #60

Merged
merged 2 commits into from
Nov 14, 2024
Merged

Conversation

ajohn25
Copy link
Collaborator

@ajohn25 ajohn25 commented Nov 12, 2024

Description

This PR allows Spoke users to:

  1. Enter their language preference at signup (defaulting to English)
  2. Edit their language preference from the user menu
  3. See translated copy in their chosen language

Motivation and Context

Part of tackling #47

How Has This Been Tested?

This has been tested locally to confirm:

  1. i18n language is only set on login/refresh (not when navigating between pages normally)
  2. User language preferences are saved correctly during user signup or user edit
  3. i18n maps selected languages to the correct translations

Screenshots (if appropriate):

Documentation Changes

Checklist:

  • My change requires a change to the documentation.
  • I have included updates for the documentation accordingly.

@ajohn25 ajohn25 requested a review from wtr-support November 12, 2024 21:04
@boba1007
Copy link

The code looks good @ajohn25 , but I ran into this error when running locally: GraphQL error: Cannot return null for non-nullable field User.language - just logged in with an existing account.

@ajohn25
Copy link
Collaborator Author

ajohn25 commented Nov 13, 2024

The code looks good @ajohn25 , but I ran into this error when running locally: GraphQL error: Cannot return null for non-nullable field User.language - just logged in with an existing account.

Thanks for checking @boba1007 ! Any difference if you run migrations before trying to log in? yarn knex migrate:latest should do that

@boba1007
Copy link

Thanks for checking @boba1007 ! Any difference if you run migrations before trying to log in? yarn knex migrate:latest should do that

Ah, that does the trick! Retested and the language toggle works as expected on refresh or login for me. Thanks!

@ajohn25
Copy link
Collaborator Author

ajohn25 commented Nov 13, 2024

Thanks for checking @boba1007 ! Any difference if you run migrations before trying to log in? yarn knex migrate:latest should do that

Ah, that does the trick! Retested and the language toggle works as expected on refresh or login for me. Thanks!

Awesome! Migrations run automatically when we deploy to production but have to run manually on dev. Which reminds me i need to update the schema dump as well 😅

@ajohn25 ajohn25 merged commit 571edc8 into feat-i18-texter Nov 14, 2024
4 checks passed
@ajohn25 ajohn25 deleted the feat-lang-select branch November 14, 2024 04:37
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