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 in user settings modal #476

Merged
merged 16 commits into from
Sep 2, 2024
Merged

Conversation

sejas
Copy link
Member

@sejas sejas commented Aug 17, 2024

Proposed Changes

  • Add language picker in user settings for authenticated and non authenticated users, which allows changing the language on the fly.
  • Add language to AppData user data file
  • Remove locale from AppGlobals and refactor locale code

The only downside is that the user needs to be logged in to open the user settings.

Testing Instructions

  • Run npm start
  • Observe the App starts with the computer's language
  • Login to Studio with your WPcom account
  • Click in your profile picture in the left sidebar
  • Change the language to any language, even RTL
  • Observe the interface changes immediately
  • Close the app
  • Run npm start
  • Observe the App starts with the latest language you selected
  • Open the settings
  • Log out
  • Press cmd+. on Mac or use the menu bar to open the settings modal
  • Observe the language picker is still in place and works as expected.
u9Cv10.mp4

No Auth:

Screenshot 2024-09-02 at 11 43 58

Auth:

Screenshot 2024-09-02 at 11 43 35

Pre-merge Checklist

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

@sejas sejas self-assigned this Aug 17, 2024
@sejas sejas requested a review from a team August 17, 2024 11:47
@sejas sejas added the [Type] Feature Request A shiny new thing label Aug 17, 2024
@sejas sejas changed the title Add user language picker in settings Add language switcher in user settings modal Aug 17, 2024
@sejas sejas mentioned this pull request Aug 17, 2024
1 task
@nguyenquanghoang
Copy link

Amazing, Thanks for the update @sejas 🙏

@kozer
Copy link
Contributor

kozer commented Aug 19, 2024

Amazing work @sejas ! I tested it and works as expected!

Example 1 Example2
2024-08-19T12:37:47,198268061+03:00 2024-08-19T12:37:53,941867492+03:00

@nguyenquanghoang
Copy link

@kozer How to test it?

@kozer
Copy link
Contributor

kozer commented Aug 19, 2024

@kozer How to test it?

Hey @nguyenquanghoang !
What I did is the following:

  1. Clone the repo, and checkout that branch ( add/user-locale-settings )
  2. Run the project: npm start
  3. Follow the Testing instructions mentioned above.

Do you face any problems while trying to replicate those instructions?

@nguyenquanghoang
Copy link

@kozer I don't know how to do with the above instructions, Don't know what npm is? Sorry because I'm new, don't have much technical knowledge

@kozer
Copy link
Contributor

kozer commented Aug 19, 2024

@kozer I don't know how to do with the above instructions, Don't know what npm is? Sorry because I'm new, don't have much technical knowledge

Sure! It's ok!
First of all, you need to install nodejs. Navigate to that site, and click the Download button. Then you need to follow the instructions mentioned.
After that, open a terminal of your choice and run npm. You should wee an output similar to the below:
image

After that, you should be able to clone the repo, and run the npm instructions.
Make sure that after you clone the repo, and being in the root of the project, to run npm install first.
Feel free to ask for any help!

@wojtekn
Copy link
Contributor

wojtekn commented Aug 21, 2024

@sejas the feature works great, it's awesome that it reloads the whole UI as user changes the language.

The only downside is that the user needs to be logged in to open the user settings.

Let's display the language selector in settings for a logged-out user, too.

@Mahjouba91
Copy link

Great feature, thank you :)

@nguyenquanghoang
Copy link

nguyenquanghoang commented Aug 21, 2024

I am currently using Studio on Windows, Tried following the instructions but it didn't work. Hope it can be easier for newbies like me, just turn on Studio, log in to your WordPress .com account and select the language you want to use.

@sejas
Copy link
Member Author

sejas commented Sep 2, 2024

Let's display the language selector in settings for a logged-out user, too.
Done!

Here is the updated screencast:

4lZZsz.mp4

@sejas
Copy link
Member Author

sejas commented Sep 2, 2024

I am currently using Studio on Windows, Tried following the instructions but it didn't work. Hope it can be easier for newbies like me, just turn on Studio, log in to your WordPress .com account and select the language you want to use.

@nguyenquanghoang, Yes, once we merge this PR and create the next release it will be as easy as starting Studio with double click.

@sejas sejas merged commit 05333e3 into trunk Sep 2, 2024
12 checks passed
@sejas sejas deleted the add/user-locale-settings branch September 2, 2024 13:13
@nguyenquanghoang
Copy link

@sejas Yes, I have enjoyed Studio since its launch. Everything is easier for newbies like me, always fast and has the essentials. Great UI 🙏

@fluiddot fluiddot mentioned this pull request Sep 3, 2024
1 task
@fluiddot
Copy link
Contributor

fluiddot commented Sep 3, 2024

Heads up that I've encountered some issues related to this PR: #502 (review)

Regarding the menu items, since it's created when instantiating the main window, the strings won't be translated because the locale date is fetched after the creation.

I'll work on a fix to be included before the next release.

UPDATE: Here's the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Feature Request A shiny new thing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Language Switcher
6 participants