studio icon indicating copy to clipboard operation
studio copied to clipboard

Add language switcher in user settings modal

Open sejas opened this issue 1 year ago • 9 comments

  • Closes https://github.com/Automattic/studio/issues/25

Proposed Changes

  • Add language picker in user settings, 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

https://github.com/user-attachments/assets/dc252326-8c0b-4a82-86b4-aed0f3619431

Pre-merge Checklist

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

sejas avatar Aug 17 '24 11:08 sejas

Amazing, Thanks for the update @sejas 🙏

nguyenquanghoang avatar Aug 17 '24 14:08 nguyenquanghoang

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

kozer avatar Aug 19 '24 09:08 kozer

@kozer How to test it?

nguyenquanghoang avatar Aug 19 '24 09:08 nguyenquanghoang

@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?

kozer avatar Aug 19 '24 09:08 kozer

@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

nguyenquanghoang avatar Aug 19 '24 09:08 nguyenquanghoang

@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!

kozer avatar Aug 19 '24 09:08 kozer

@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.

wojtekn avatar Aug 21 '24 08:08 wojtekn

Great feature, thank you :)

Mahjouba91 avatar Aug 21 '24 11:08 Mahjouba91

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 avatar Aug 21 '24 13:08 nguyenquanghoang

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

Here is the updated screencast:

https://github.com/user-attachments/assets/4a7896fc-ae5c-40cd-9057-fa0995a7bf05

sejas avatar Sep 02 '24 10:09 sejas

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 avatar Sep 02 '24 10:09 sejas

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

nguyenquanghoang avatar Sep 02 '24 14:09 nguyenquanghoang

Heads up that I've encountered some issues related to this PR: https://github.com/Automattic/studio/pull/502#pullrequestreview-2276754994

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.

fluiddot avatar Sep 03 '24 08:09 fluiddot