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 feature to set application language. #902

Merged
merged 1 commit into from
Apr 22, 2020
Merged

Conversation

manavmehta
Copy link
Collaborator

What's this PR do?
Fixes: #855
Adds feature that lets user to change Zulip desktop client language without requiring to change the system language as was the case earlier

Any background context you want to provide?
Earlier, Zulip client used to fetch system locale thus setting default language to the client. Now we enable user to set custom language to the client.

Screenshots?
Screenshot 2020-03-21 at 12 04 20 PM

You have tested this PR on:
[✓ ] macOS Catalina 10.15.2

@manavmehta
Copy link
Collaborator Author

@akashnimare @timabbott @abhigyank Please review

app/renderer/js/pages/preference/general-section.ts Outdated Show resolved Hide resolved
app/renderer/js/pages/preference/general-section.ts Outdated Show resolved Hide resolved
app/renderer/js/pages/preference/general-section.ts Outdated Show resolved Hide resolved
app/renderer/css/preference.css Outdated Show resolved Hide resolved
app/renderer/css/preference.css Outdated Show resolved Hide resolved
app/renderer/js/pages/preference/general-section.ts Outdated Show resolved Hide resolved
@manavmehta
Copy link
Collaborator Author

@abhigyank thanks, refactored according to your review.

@abhigyank
Copy link
Collaborator

LGTM!
Just fix the commit messages. Checkout Zulip commit guidelines for detailed information on how to create coherent commits.

@akashnimare
Copy link
Member

A couple of doubts -

  • Electron also started supporting spellchecker in v8, can you check what's the status of that?
  • I see only a couple of options in the supported languages. Are we just supporting the web app languages or what?

@abhigyank
Copy link
Collaborator

@akashnimare This PR for the app language ( to be used in menus and settings mostly), not related to spellchecker.
I suppose the list of languages are the ones for which have translation available on the desktop app. @manavmehta can you confirm this?

@manavmehta
Copy link
Collaborator Author

manavmehta commented Mar 22, 2020

@abhigyank that's right
@akashnimare, As @abhigyank mentioned we use translations/'lang'.json for this
Initially we used to fetch system language which would be done manually here for end-user's convenience. Spellchecker comes into play in chats which was not the purpose hereby.
We may work on that separately forth.
2. We use all of the languages for which the translations are available in the desktop client. Further addition of supported languages in app can be appropriately done.

@akashnimare
Copy link
Member

A couple of changes -

  • The border looks weird on focus, can you update it?

image

  • Would it make sense to move this setting to just above the add custom CSS?

@manavmehta
Copy link
Collaborator Author

manavmehta commented Mar 23, 2020

@akashnimare updated the border color to transparent

Would it make sense to move this setting to just above the add custom CSS?

Yeah. I thought the user would use it often so kept it above but now it looks much coherent.

Have a look!

new

@akashnimare
Copy link
Member

@manavmehta can you fix the merge conflicts?

@akashnimare
Copy link
Member

Looks good. Left a few comments. @abhigyank GTG?

@abhigyank
Copy link
Collaborator

LGTM.

User can now select application language without changing the language in the operating system

Dynamically create locales object for dropdown
Method: Store supported locales on disk in /translations/supported-locales.json and read in general-section.ts
Why?: Avoids hardcoding of locales object and eases the process of adding next supported locales
@akashnimare akashnimare changed the title Add feature to set application language without changing system language Add feature to set application language. Apr 22, 2020
@akashnimare akashnimare merged commit b2f4af0 into zulip:master Apr 22, 2020
@akashnimare
Copy link
Member

Merged. Thanks, @manavmehta.

@manavmehta manavmehta deleted the lang branch April 22, 2020 12:41
@akashnimare
Copy link
Member

@manavmehta as a follow-up can you take care of the translation thing we talked about?

@manavmehta
Copy link
Collaborator Author

@akashnimare On it

Comment on lines +419 to +420
let langIndex = ConfigUtil.getConfigItem('languageIndex');
langIndex = (langIndex === null) ? 4 : langIndex;
Copy link
Member

@andersk andersk Apr 22, 2020

Choose a reason for hiding this comment

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

Storing this as an index is extremely fragile—it means we can never reorder, insert, or delete languages without disturbing other languages.

#939

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. Thanks @andersk :)

manavmehta added a commit to manavmehta/zulip-desktop that referenced this pull request May 6, 2020
…ip#909

The comment was created to document a piece of code in zulip#902 but zulip#909 addressed code quality
The comment is no longer essential and hence ought to be removed
andersk pushed a commit that referenced this pull request May 7, 2020
The comment was created to document a piece of code in #902 but #909 addressed code quality
The comment is no longer essential and hence ought to be removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change language desktop app
5 participants