Skip to content

Commit

Permalink
fix(neuron-wallet): enable the i18n and update the wallet label of th…
Browse files Browse the repository at this point in the history
…e application menu
  • Loading branch information
Keith-CY committed Aug 7, 2019
1 parent 5b20d64 commit 664ccc8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions packages/neuron-wallet/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { app } from 'electron'
import 'reflect-metadata'
import { debounceTime } from 'rxjs/operators'

import i18n from 'utils/i18n'
import { updateApplicationMenu } from 'utils/application-menu'
import WindowManager from 'models/window-manager'
import createMainWindow from 'startup/create-main-window'
Expand Down Expand Up @@ -44,7 +43,6 @@ app.on('ready', async () => {
}
})

i18n.changeLanguage(['zh', 'zh-CN'].includes(app.getLocale()) ? 'zh' : 'en')
const wallets = walletsService.getAll()
const currentWallet = walletsService.getCurrent()

Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/src/utils/application-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const appMenuItem: MenuItemConstructorOptions = {

export const walletMenuItem: MenuItemConstructorOptions = {
id: 'wallet',
label: 'Wallet',
label: i18n.t('application-menu.wallet.label'),
submenu: [
{ id: 'select', label: i18n.t('application-menu.wallet.select'), submenu: [] },
{
Expand Down
4 changes: 3 additions & 1 deletion packages/neuron-wallet/src/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import i18n from 'i18next'
import zh from 'locales/zh'
import en from 'locales/en'
import app from 'app'

if (!i18n.isInitialized) {
const fallbackLng = ['zh', 'zh-CN'].includes(app.getLocale()) ? 'zh' : 'en'
i18n.init({
resources: {
en,
zh,
},
fallbackLng: 'en',
fallbackLng,
interpolation: {
escapeValue: false,
},
Expand Down

0 comments on commit 664ccc8

Please sign in to comment.