Merged
Conversation
Add language column to user_settings table - Add language TEXT column with default 'en' - Add check constraint for valid language codes (en, es, pt, fr, de) - Backfill existing records with default language
Update UserSettings type and add language persistence - Add language field to UserSettings type - Include language in default settings creation - Create updateLanguage mutation for database persistence - Add language sync effect with user authentication check - Export updateLanguage, isUpdatingLanguage, and updateLanguageError
Implement language persistence in settings page - Update handleLanguageChange to persist language to database - Add optimistic UI update for immediate feedback - Add loading states to language selector buttons - Disable buttons during language update operation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR implements persistent language preference storage in the database, allowing users' language selections to be saved and automatically restored across sessions and devices. Previously, language selection was only temporary and stored in localStorage, which meant users had to re-select their preferred language after logging in from different devices.
🔗 Related Issue
Closes #[issue-number] - Persist User Language Preference
🏷️ Type of Change
🔄 Changes Made
Database Layer
languagecolumn touser_settingstable'en'en,es,pt,fr,deBackend/Hook Layer
useUserSettings.ts: Enhanced user settings hookUserSettingstype to includelanguagefieldlanguageto default settings creationupdateLanguagemutation for database persistenceupdateLanguage,isUpdatingLanguage, andupdateLanguageErrorfor UI integrationFrontend Layer
LanguageSync.tsx: New component for automatic language restorationProviders.tsx: IntegratedLanguageSynccomponentThemeSyncpage.tsx(Settings): Updated language selection UIhandleLanguageChangeto persist language to database🧪 Testing
Manual Testing Steps
user_settings.languageshows'es'✅ Checklist
📸 Screenshots (if applicable)
Screenshots showing language selection UI and persistence behavior would be helpful here.
📌 Additional Notes
Database Migration
After merging this PR, the database migration must be applied:
Then regenerate TypeScript types:
Language Detection Priority
The app now has the following language detection priority:
i18next-browser-languagedetectorFuture Improvements
LanguageSynccomponent