session-desktop icon indicating copy to clipboard operation
session-desktop copied to clipboard

[Feature request] Option to change the UI's language.

Open fightuntilwedie opened this issue 4 years ago • 9 comments

I am using Debian 11 and an unofficial LineageOS. Session App on both devices doesn't offer an option to change the UI's language. Would be great if it was implemented in future versions.

fightuntilwedie avatar Aug 20 '21 10:08 fightuntilwedie

Hey, on linux you can start the app with LANGUAGE=FR_fr yarn start-prod.

Bilb avatar Aug 23 '21 00:08 Bilb

Could you give me more information? I've got the AppImage in a folder on the desktop and a shortcut/starter in the shortcut bar.

fightuntilwedie avatar Aug 23 '21 06:08 fightuntilwedie

@fightuntilwedie sorry for the delay You would need to edit your shortcut to launch a script instead of the appimage directly.

Something like that should work

sudo gedit /usr/local/bin/session-desktop-localized.sh

Copy paste what's following in the opening window

#!/bin/bash

LANGUAGE=ru ~/Downloads/session-desktop-linux-x86_64-1.7.1.AppImage

In this same window edit the path to the appimage (here I used ~/Downloads/ but that's probably not your case) In this same window edit the language you want to start the app in (here I used ru for russian)

Then, allow execution for this script:

sudo chmod +x /usr/local/bin/session-desktop-localized.sh

Finally, edit the shortcut you have in your shortcut bar to start this script directly by giving its fullpath like so /usr/local/bin/session-desktop-localized.sh What would be the language you want the app in?

Bilb avatar Sep 15 '21 03:09 Bilb

Hi and thank you for your answer. In the meantime I solved the issue by simply switching the whole system's language to English US. Hence, Session did the same! ;))

fightuntilwedie avatar Sep 15 '21 07:09 fightuntilwedie

I think it would be great to have a language setting under settings -> appearance, to force Session language to be different from the system language

KeeJef avatar Feb 03 '23 03:02 KeeJef

We could do that quite easily, but that would require a restart to take effect (localized strings are loaded on startup and not refresh after that)

Bilb avatar Feb 14 '23 23:02 Bilb

Just waiting on UI designs to attach to this issue before this can be picked up

KeeJef avatar Feb 15 '23 04:02 KeeJef

Just waiting on UI designs to attach to this issue before this can be picked up

Does this looks good enough?

telegram-cloud-photo-size-2-5285362973679933974-y telegram-cloud-photo-size-2-5285362973679933982-y telegram-cloud-photo-size-2-5285362973679933983-x telegram-cloud-photo-size-2-5285362973679933984-x telegram-cloud-photo-size-2-5285362973679933985-x

I used native <select>, removed default arrow by setting background image to none, added my own arrow built with 0px border hack which has var(--input-border-color) as color. Added transitions to ensure colors are animated during theme change.

From the technical side, I wanted to use window.get/setSettingValue but it wasn't available on startup in main_node.ts, so I used userConfig instead with ipc events to sync between frontend and backend. It stores current language code in config and falls back the same way app falls back (process.env.LANGUAGE || app.getLocale() || 'en'). Languages are stored as part before _ character i.e. directory names in /_locales. Additionally, I'm using app.relaunch(); and app.exit(); to restart electron after changing language.

Languages in <select> are hardcoded and static, which means you have to edit this list each time new language is added or removed, because you need to write a language name anytime it's added anyway and I didn't want to spend time passing directory names into frontend, but I can patch this quickly if needed.

I can't create pull requests though, because I already forked this repository some time ago for https://github.com/VityaSchel/session-nodejs-bot and now it won't let me fork it second time 😅 I already submitted ticket to GitHub support, hopefully they'll be able to detach my bot framework into standalone repository tomorrow and then I'll create PR for review.

VityaSchel avatar Apr 25 '24 22:04 VityaSchel

GitHub still does not let me fork this repository, so I'll put patch file here with changes and then I'll create PR as soon as I'm able to fork.

0001-feat-add-option-to-change-UI-language.patch

VityaSchel avatar Apr 27 '24 14:04 VityaSchel