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 Language Switcher #72

Closed
wants to merge 13 commits into from
Closed

Add Language Switcher #72

wants to merge 13 commits into from

Conversation

derekblank
Copy link
Contributor

@derekblank derekblank commented May 1, 2024

Related to #25

Proposed Changes

(WIP) Adds Language Picker to User Settings modal to allow user to select Studio UI language

Screenshot 2024-05-01 at 2 48 29 pm

Testing Instructions

TBD

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@derekblank derekblank self-assigned this May 1, 2024
@derekblank derekblank changed the title Add Language Picker Add Language Switcher May 2, 2024
@derekblank
Copy link
Contributor Author

derekblank commented May 10, 2024

Updating with some notes, findings, and next steps:

  • 🎨 The <LanguagePicker /> onChange event will need to handle the locale change.
  • 💾 The updated preferred locale string should persist in some form of local storage across sessions.
  • 🔍 Investigate: <LanguagePicker /> events exist on the renderer thread, while localeData is loaded on the main thread (before renderer is invoked) -- therefore, localStorage can't be used to persist user locale changes (without modifying one or other other).
  • 🔍 Investigate: saveUserData may be the best place to save and load any user-preferred locale string changes.
  • 🔍 Investigate: Currently, the JSON translation files are loaded synchronously using require, and would need an app restart to load the new locale data. Potentially, the JSON translation files could be loaded async without the need to restart Studio to change the Studio UI language/locale.
  • 🏁 All of the above changes should only apply to the Studio app UI itself (and not any Studio-created sites), minimizing the footprint of changes.

await saveUserData( {
...userData,
userLocale,
} );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this approach will be a bit limiting until userData could be saved and loaded across both the main and renderer threads.

@nguyenquanghoang
Copy link

nguyenquanghoang commented Aug 1, 2024

@derekblank Amazing, This is a feature I have been looking forward to. 🙏 Hope Vietnamese available

@nguyenquanghoang
Copy link

@wojtekn This is awesome

Choose a reason for hiding this comment

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

Can you add Vietnamese language?

@sejas
Copy link
Member

sejas commented Aug 17, 2024

@sejas sejas closed this Aug 17, 2024
@sejas sejas deleted the feat/language-picker branch August 17, 2024 11:49
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