Skip to content

Commit

Permalink
fix(neuron-wallet): set the language on app ready
Browse files Browse the repository at this point in the history
1. the app.getLocale method should be called after app.ready.
2. generate the application menu template dynamically on updating so it always has the latest status.
  • Loading branch information
Keith-CY committed Aug 12, 2019
1 parent 71a4d61 commit 875cd5c
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 227 deletions.
5 changes: 4 additions & 1 deletion packages/neuron-wallet/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { app } from 'electron'
import 'reflect-metadata'
import { debounceTime } from 'rxjs/operators'

Expand All @@ -10,6 +9,8 @@ import initConnection from 'database/address/ormconfig'
import WalletsService from 'services/wallets'
import { WalletListSubject, CurrentWalletSubject } from 'models/subjects/wallets'
import dataUpdateSubject from 'models/subjects/data-update'
import app from 'app'
import { changeLanguage } from 'utils/i18n'

const walletsService = WalletsService.getInstance()

Expand All @@ -29,6 +30,8 @@ const openWindow = () => {
}

app.on('ready', async () => {
changeLanguage(app.getLocale())

WalletListSubject.pipe(debounceTime(50)).subscribe(({ currentWallet = null, currentWalletList = [] }) => {
const walletList = currentWalletList.map(({ id, name }) => ({ id, name }))
const currentWalletId = currentWallet ? currentWallet.id : null
Expand Down
Loading

0 comments on commit 875cd5c

Please sign in to comment.