Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

fixed #553, adding setting to change UI language #813

Closed

Conversation

ChihChengLiang
Copy link
Contributor

@ChihChengLiang ChihChengLiang commented Jun 14, 2016

Dear developers,

Thanks for the awesome project. To address #553 , I added a menu item "settings" that users can change languages in the wallet screen easily.
Note that the language of the app menu can't be changed with this feature, at the moment I can't figure out yet. Hints would be appreciated.

Warm regards,
Chih-Cheng


update:
successfully changed the language of the app menu.

click: function(){
let mainWindow = Windows.getByType('main');
mainWindow.webContents.executeJavaScript(
`TAPi18n.setLanguage("${lang_code}");`
Copy link
Contributor

Choose a reason for hiding this comment

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

You would need to call ipc.send('backendAction_setLanguage', lang_code); after this line. This should change the menu language

Copy link
Contributor Author

@ChihChengLiang ChihChengLiang Jun 15, 2016

Choose a reason for hiding this comment

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

Thanks for the hint, @frozeman. However I failed calling ipc.send both in menuItem.js and in webpage.
First attempt:

        click: function(){
                let mainWindow = Windows.getByType('main');
                mainWindow.webContents.executeJavaScript(
                    `TAPi18n.setLanguage('${lang_code}');`
                );
                ipc.send('backendAction_setLanguage', lang_code);
            }

which gives

TypeError: ipc.send is not a function
    at menuItem.click (/home/chihchengliang/ether/mist/modules/menuItems.js:444:21)
    at MenuItem.click (/home/chihchengliang/npm-global/lib/node_modules/electron-prebuilt/dist/resources/electron.asar/browser/api/menu-item.js:81:16)
    at Function.delegate.executeCommand (/home/chihchengliang/npm-global/lib/node_modules/electron-prebuilt/dist/resources/electron.asar/browser/api/menu.js:119:40)

in electron console and crashed. Checked the doc, ipcMain has no function send. It seems I can't send from main process.
Seeing ipc.send can be called from popWindow, I also tried sending from the webpage:

                mainWindow.webContents.executeJavaScript(
                    `TAPi18n.setLanguage('${lang_code}');
                    ipc.send('backendAction_setLanguage', '${lang_code}');`
                );

which throws Uncaught ReferenceError: ipc is not defined in browser console.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since ipcMain is an eventsEmitter class, the event can be triggered via emit function from ipc instance. e.g.

ipc.emit('backendAction_setLanguage', {}, lang_code);

see doc for more detail.

@frozeman
Copy link
Contributor

Concerning the menu, i think view is better suitable for that. What you think @alexvandesande @hiddentao ?

@hiddentao
Copy link
Contributor

Yep, sounds good to me.

On 14 June 2016 at 18:37:07, Fabian Vogelsteller (notifications@github.com) wrote:

Concerning the menu, i think view is better suitable for that. What you think @alexvandesande @hiddentao ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@alexvandesande alexvandesande added this to the 0.8 milestone Jun 14, 2016
@hiddentao
Copy link
Contributor

Language switching works, though for some languages (e.g. kr) no change is seen in the wallet UI as far as I can see. This is likely due to missing translations.

@atomrigs
Copy link
Contributor

atomrigs commented Jun 16, 2016

@hiddentao It seems Korean the language code is "ko", not "kr",

@ChihChengLiang
Copy link
Contributor Author

ChihChengLiang commented Jun 16, 2016

hi @hiddentao ,
kr works perfectly for me.
nb and zh failed to change because wallet.nb.i18n.json and wallet.zh.i18n.json don't exist.
es failed to change too, though wallet.es.i18n.json is partially translated.
2016-06-16 10 11 05

@atomrigs
Copy link
Contributor

I made PR for changing Korean code from kr to ko
#835
ethereum/meteor-dapp-wallet#224

@alexvandesande
Copy link

One of my language codes is set at "Dev" which is not functional. Also there should be a first item called "auto" that reverts back to the default

@ChihChengLiang
Copy link
Contributor Author

hi @alexvandesande , the Dev item removed and a first item auto added as desired.
hi @frozeman , the language of the menu bar can be successfully changed now.
I also rebased this branch on develop so that @atomrigs 's modification of Korean i18n can be tested.
Thanks all you guys' support as well as @hiddentao 's review.
2016-06-18 18 58 44

@ChihChengLiang
Copy link
Contributor Author

hi, in case anyone get confused, the required feature in this PR is completely implemented and ready for review. Let me know if anything need to modified or improved. Thanks :)

@luclu
Copy link
Contributor

luclu commented Jun 25, 2016

Let me clean up the lang codes today. ;)

update: done - #889.
@ChihChengLiang I added some missing to project-tap.i18n.

It would be great to get rid of the wallet-requirement so this won't cause trouble with Mist-users - @alexvandesande {edit: "what do you think"}?

nb and zh failed to change because wallet.nb.i18n.json and wallet.zh.i18n.json don't exist.
es failed to change too, though wallet.es.i18n.json is partially translated.

@alexvandesande
Copy link

I've done some work on this PR too but couldn't have it uploaded due to the other urgent issues. Will upload the changes as soon as I can.

Btw: clicking on "auto" does nothing for me

On Jun 25, 2016, at 07:19, Luca Zeug notifications@github.com wrote:

Let me will clean up the lang codes today. ;)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@ChihChengLiang
Copy link
Contributor Author

hi,
@luclu Thanks!

@alexvandesande : the auto button works now. It'll use electron built-in app.getLocale to get system locale when triggered.

@alexvandesande
Copy link

I included these changes here: #896

alexvandesande pushed a commit that referenced this pull request Jul 11, 2016
* bump version to 0.7.6

* updated os timesync

* adding setting to change UI language (fixes #813) (#896)

* simple language setting menu

* use i18n label in menu

* simple language setting menu

* use i18n label in menu

* change language of menu bar by triggering 'backendAction_setLanguage'

* adds translations for language names

* remove duplicate 'gulp update-nodes' (#897)

* add i18n entry for OSX's 'Services' (#887)

* add i18n entry for OSX's 'Services'

* update missing osx menu strings

* update-popup-window: prevent maximize (#885)

* update-popup-window prevent maximize

* add resizable:false

* added shrinkwrap (#903)

* fixed webview tagd and updated electrong to 1.2.5 (#905)

* Fixes the node start IPC connection (#841)

* fixed eth start, but crash is not graceful

* better socket connection logic, remove master ps logic for eth

* fix splash screen display of state text for eth

* better gulp download plugin, remove master passwd stuff once and for all

* Adds Toggle password visibility to on boarding screen (#909)

* add password visibilty toggle to onboarding

* replaced 'showPassword' with 'passwordInputType'

* changed id into class

* 18n cleanup (former #889) (#910)

* Renamed Korean and Albanian to ISO standards
* Added menu items to set to Dutch,  Farsi, Albanian and Italian (these three are rather incomplete)

* changed log error to warn

* fixed ipcBackend notifications

* Fixing wallet tab insertion (#911)

* small cleanup

* added admin:true permission

* removed webview duplicate

* Fully automated UI testing (#788)


* got app launching via test

* work towards testing - private net integration

* change how we name options to pass directly to geth, so that test suite works

* refactor preloader scripts

* cleanly quitting the app at the end of tests

* trying to get electron working properly, upgrade to 1.2.2

* upgrade spectron

* work towards getting tests to work

* dont use NODE_ENV var as Meteor production uses it

* fixed eth start, but crash is not graceful

* better socket connection logic, remove master ps logic for eth

* fix splash screen display of state text for eth

* better gulp download plugin, remove master passwd stuff once and for all

* got basic test working

* update travis build

* trigger build

* update readme, travis

* fix gulp-download-stream use

* fix build command

* testing account creation

* added account creation test

* only do a shallow clone

* final deposit test

* should be able to find geth executable now

* adds the wallet as the default tab (#924)

* Text updates

Fix typos and make writing more clear and accurate

* Capitalization consistency

* adds the wallet as the default tab

* always upsert

* Update version to 0.8 (#930)

* update to 0.8

* fixes menu margin clipping

* remove comma

* fix ipcpath bug
alexvandesande pushed a commit that referenced this pull request Jul 17, 2016
* bump version to 0.7.6

* updated os timesync

* adding setting to change UI language (fixes #813) (#896)

* simple language setting menu

* use i18n label in menu

* simple language setting menu

* use i18n label in menu

* change language of menu bar by triggering 'backendAction_setLanguage'

* adds translations for language names

* remove duplicate 'gulp update-nodes' (#897)

* add i18n entry for OSX's 'Services' (#887)

* add i18n entry for OSX's 'Services'

* update missing osx menu strings

* update-popup-window: prevent maximize (#885)

* update-popup-window prevent maximize

* add resizable:false

* added shrinkwrap (#903)

* fixed webview tagd and updated electrong to 1.2.5 (#905)

* Fixes the node start IPC connection (#841)

* fixed eth start, but crash is not graceful

* better socket connection logic, remove master ps logic for eth

* fix splash screen display of state text for eth

* better gulp download plugin, remove master passwd stuff once and for all

* Adds Toggle password visibility to on boarding screen (#909)

* add password visibilty toggle to onboarding

* replaced 'showPassword' with 'passwordInputType'

* changed id into class

* 18n cleanup (former #889) (#910)

* Renamed Korean and Albanian to ISO standards
* Added menu items to set to Dutch,  Farsi, Albanian and Italian (these three are rather incomplete)

* changed log error to warn

* fixed ipcBackend notifications

* Fixing wallet tab insertion (#911)

* small cleanup

* added admin:true permission

* removed webview duplicate

* Fully automated UI testing (#788)


* got app launching via test

* work towards testing - private net integration

* change how we name options to pass directly to geth, so that test suite works

* refactor preloader scripts

* cleanly quitting the app at the end of tests

* trying to get electron working properly, upgrade to 1.2.2

* upgrade spectron

* work towards getting tests to work

* dont use NODE_ENV var as Meteor production uses it

* fixed eth start, but crash is not graceful

* better socket connection logic, remove master ps logic for eth

* fix splash screen display of state text for eth

* better gulp download plugin, remove master passwd stuff once and for all

* got basic test working

* update travis build

* trigger build

* update readme, travis

* fix gulp-download-stream use

* fix build command

* testing account creation

* added account creation test

* only do a shallow clone

* final deposit test

* should be able to find geth executable now

* adds the wallet as the default tab (#924)

* Text updates

Fix typos and make writing more clear and accurate

* Capitalization consistency

* adds the wallet as the default tab

* always upsert

* Update version to 0.8 (#930)

* update to 0.8

* fixes menu margin clipping

* remove comma

* work towards new minimonogo sync

* fix ipcpath bug

* got basic persistence working

* minor error

* refactor sendTransaction error alerts (#959)

* "Change language" translated in mist.nb.i18n.json (#953)

"Change language" translated in mist.nb.i18n.json

* timer delay on menu refreshing from tab updates

* rename 'passwordError' to 'wrongPassword' for consistency (#951)

* sync not specific to a window

* refactor to enable access to mongo sync from all windows

* update .meteor paths on .gitignore (#977)

* DAO fork support (#970)

* created DAO fork dummy code

* text update

* added node flags choice 

* changed DAO fork texts

* disable eth-node switch until hardfork is supported (#975)

* disable eth-node until hardfork is supported

* remove test function

* reworded the disclaimer link
alexvandesande pushed a commit that referenced this pull request Jul 23, 2016
Merging of Choose account popup #814

* Creating change account modals

* connect popup

* fixing typo

* connect account popup

* Straightens checkbox on connect account modal

* Connect account popup interface

* fixing scroll gradient on choose account popup

* Informing account names on connect popup

* Adding animations on account and dapp info

* Improvements on connect popup

* Tweaking URL breakdown to show arrows when necessary

* Fixing edgy cases on breadcrumb

* Removing browserBar interface

* Removing browser bar fold-down element

* Vertical flexbox - window stretches appropriately

* Popup updates

* change dapp style and icon (#1)

* more working code

* Reload permissions and code cleaning

* Website placeholder icon

* Cleaning code

* Unpin tab

* Not showing remove button on wallet tab

* Merge Hard Fork choice - Mist into master (#979)

* bump version to 0.7.6

* updated os timesync

* adding setting to change UI language (fixes #813) (#896)

* simple language setting menu

* use i18n label in menu

* simple language setting menu

* use i18n label in menu

* change language of menu bar by triggering 'backendAction_setLanguage'

* adds translations for language names

* remove duplicate 'gulp update-nodes' (#897)

* add i18n entry for OSX's 'Services' (#887)

* add i18n entry for OSX's 'Services'

* update missing osx menu strings

* update-popup-window: prevent maximize (#885)

* update-popup-window prevent maximize

* add resizable:false

* added shrinkwrap (#903)

* fixed webview tagd and updated electrong to 1.2.5 (#905)

* Fixes the node start IPC connection (#841)

* fixed eth start, but crash is not graceful

* better socket connection logic, remove master ps logic for eth

* fix splash screen display of state text for eth

* better gulp download plugin, remove master passwd stuff once and for all

* Adds Toggle password visibility to on boarding screen (#909)

* add password visibilty toggle to onboarding

* replaced 'showPassword' with 'passwordInputType'

* changed id into class

* 18n cleanup (former #889) (#910)

* Renamed Korean and Albanian to ISO standards
* Added menu items to set to Dutch,  Farsi, Albanian and Italian (these three are rather incomplete)

* changed log error to warn

* fixed ipcBackend notifications

* Fixing wallet tab insertion (#911)

* small cleanup

* added admin:true permission

* removed webview duplicate

* Fully automated UI testing (#788)


* got app launching via test

* work towards testing - private net integration

* change how we name options to pass directly to geth, so that test suite works

* refactor preloader scripts

* cleanly quitting the app at the end of tests

* trying to get electron working properly, upgrade to 1.2.2

* upgrade spectron

* work towards getting tests to work

* dont use NODE_ENV var as Meteor production uses it

* fixed eth start, but crash is not graceful

* better socket connection logic, remove master ps logic for eth

* fix splash screen display of state text for eth

* better gulp download plugin, remove master passwd stuff once and for all

* got basic test working

* update travis build

* trigger build

* update readme, travis

* fix gulp-download-stream use

* fix build command

* testing account creation

* added account creation test

* only do a shallow clone

* final deposit test

* should be able to find geth executable now

* adds the wallet as the default tab (#924)

* Text updates

Fix typos and make writing more clear and accurate

* Capitalization consistency

* adds the wallet as the default tab

* always upsert

* Update version to 0.8 (#930)

* update to 0.8

* fixes menu margin clipping

* remove comma

* work towards new minimonogo sync

* fix ipcpath bug

* got basic persistence working

* minor error

* refactor sendTransaction error alerts (#959)

* "Change language" translated in mist.nb.i18n.json (#953)

"Change language" translated in mist.nb.i18n.json

* timer delay on menu refreshing from tab updates

* rename 'passwordError' to 'wrongPassword' for consistency (#951)

* sync not specific to a window

* refactor to enable access to mongo sync from all windows

* update .meteor paths on .gitignore (#977)

* DAO fork support (#970)

* created DAO fork dummy code

* text update

* added node flags choice 

* changed DAO fork texts

* disable eth-node switch until hardfork is supported (#975)

* disable eth-node until hardfork is supported

* remove test function

* reworded the disclaimer link

* Syncing Tabs after account connection

* Enable Tabs sync and persistence in all windows (#2)

* sync not specific to a window

* refactor to enable access to mongo sync from all windows

* Pin/unpin Tabs

* Adding show password on Create account popup

* change remove button animation

* add globe image as default non-icon
@lock
Copy link

lock bot commented Apr 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked and limited conversation to collaborators Apr 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants