diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index 41ab39c5..e4eb7c72 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -60,5 +60,46 @@ "placeholder": "Filter out by regular expressions", "apply": "Apply" } + }, + "preferences": { + "title": "Preferences", + "general": { + "title": "General", + "appearance": "Appearance", + "theme_color": "Theme color:", + "white": "white", + "dark": "dark", + "font_size": "Font size:", + "display_style": { + "title": "Display style:", + "display_name_and_username": "Display name and username", + "display_name": "Display name", + "username": "Username" + }, + "toot": "Toot", + "visibility": { + "title": "Default visibility:", + "public": "Public", + "unlisted": "Unlisted", + "private": "Private", + "direct": "Direct" + }, + "sounds": "Sounds", + "fav_rb_sound": "Favoute and Boost:", + "toot_sound": "Toot:" + }, + "account": { + "title": "Account", + "connected": "Connected Account", + "username": "Username", + "domain": "Domain", + "association": "Association", + "order": "Order", + "remove_association": "Remove assocication", + "remove_all_associations": "Remove all associations", + "confirm": "Confirm", + "cancel": "Cancel", + "confirm_message": "Are you sure to remove all associations?" + } } } diff --git a/src/config/locales/ja/translation.json b/src/config/locales/ja/translation.json index 7f290b15..94dcee4b 100644 --- a/src/config/locales/ja/translation.json +++ b/src/config/locales/ja/translation.json @@ -60,5 +60,46 @@ "placeholder": "正規表現でフィルター", "apply": "適用" } + }, + "preferences": { + "title": "設定", + "general": { + "title": "一般", + "appearance": "外観", + "theme_color": "テーマカラー:", + "white": "標準", + "dark": "ダーク", + "font_size": "フォントサイズ:", + "display_style": { + "title": "ユーザ名の表示形式:", + "display_name_and_username": "表示名+ユーザー名", + "display_name": "表示名", + "username": "ユーザー名" + }, + "toot": "トゥート", + "visibility": { + "title": "公開設定:", + "public": "公開", + "unlisted": "未収載", + "private": "フォロワー限定", + "direct": "ダイレクト" + }, + "sounds": "効果音", + "fav_rb_sound": "お気に入り,ブースト時:", + "toot_sound": "トゥート時:" + }, + "account": { + "title": "アカウント", + "connected": "登録済みアカウント", + "username": "ユーザー名", + "domain": "ドメイン名", + "association": "連携", + "order": "順序", + "remove_association": "連携を削除", + "remove_all_associations": "全ての連携を削除", + "confirm": "確認", + "cancel": "キャンセル", + "confirm_message": "本当に全ての連携を削除しますか?" + } } } diff --git a/src/constants/visibility.js b/src/constants/visibility.js index a9adca12..e8947447 100644 --- a/src/constants/visibility.js +++ b/src/constants/visibility.js @@ -1,18 +1,20 @@ +import i18n from '../config/i18n' + export default { Public: { - name: 'public', + name: i18n.t('preferences.general.visibility.public'), value: 0 }, Unlisted: { - name: 'unlisted', + name: i18n.t('preferences.general.visibility.unlisted'), value: 1 }, Private: { - name: 'private', + name: i18n.t('preferences.general.visibility.private'), value: 2 }, Direct: { - name: 'direct', + name: i18n.t('preferences.general.visibility.direct'), value: 3 } } diff --git a/src/main/index.js b/src/main/index.js index e557a2b7..b8c59ade 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -9,13 +9,13 @@ import simplayer from 'simplayer' import path from 'path' import ContextMenu from 'electron-context-menu' import * as Splashscreen from '@trodi/electron-splashscreen' +import openAboutWindow from 'about-window' import Authentication from './auth' import Account from './account' import Streaming from './streaming' import Preferences from './preferences' import Hashtags from './hashtags' -import ApplicationMenu from './menu' import i18n from '../config/i18n' /** @@ -113,7 +113,7 @@ async function createWindow () { /** * Set application menu */ - ApplicationMenu(mainWindow, accountsChange, i18n) + ApplicationMenu(accountsChange, i18n) /** * Set dock menu for mac @@ -646,3 +646,166 @@ app.on('ready', () => { */ class EmptyTokenError {} + +/** + * Set application menu + */ +const ApplicationMenu = (accountsChange, i18n) => { + /** + * For mac menu + */ + const macGeneralMenu = process.platform !== 'darwin' ? [] : [ + { + type: 'separator' + }, + { + label: i18n.t('main_menu.application.services'), + role: 'services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: i18n.t('main_menu.application.hide'), + role: 'hide' + }, + { + label: i18n.t('main_menu.application.hide_others'), + role: 'hideothers' + }, + { + label: i18n.t('main_menu.application.show_all'), + role: 'unhide' + } + ] + + const template = [ + { + label: i18n.t('main_menu.application.name'), + submenu: [ + { + label: i18n.t('main_menu.application.about'), + role: 'about', + click: () => { + openAboutWindow({ + icon_path: path.resolve(__dirname, '../../build/icons/256x256.png'), + copyright: 'Copyright (c) 2018 AkiraFukushima', + package_json_dir: path.resolve(__dirname, '../../'), + open_devtools: process.env.NODE_ENV !== 'production' + }) + } + }, + { + type: 'separator' + }, + { + label: i18n.t('main_menu.application.preferences'), + accelerator: 'CmdOrCtrl+,', + click: () => { + mainWindow.webContents.send('open-preferences') + } + }, + ...macGeneralMenu, + { + type: 'separator' + }, + { + label: i18n.t('main_menu.application.quit'), + accelerator: 'CmdOrCtrl+Q', + role: 'quit' + } + ] + }, + { + label: i18n.t('main_menu.toot.name'), + submenu: [ + { + label: i18n.t('main_menu.toot.new'), + accelerator: 'CmdOrCtrl+N', + click: () => { + mainWindow.webContents.send('CmdOrCtrl+N') + } + } + ] + }, + { + label: i18n.t('main_menu.edit.name'), + submenu: [ + { + label: i18n.t('main_menu.edit.undo'), + accelerator: 'CmdOrCtrl+Z', + role: 'undo' + }, + { + label: i18n.t('main_menu.edit.redo'), + accelerator: 'Shift+CmdOrCtrl+Z', + role: 'redo' + }, + { + type: 'separator' + }, + { + label: i18n.t('main_menu.edit.cut'), + accelerator: 'CmdOrCtrl+X', + role: 'cut' + }, + { + label: i18n.t('main_menu.edit.copy'), + accelerator: 'CmdOrCtrl+C', + role: 'copy' + }, + { + label: i18n.t('main_menu.edit.paste'), + accelerator: 'CmdOrCtrl+V', + role: 'paste' + }, + { + label: i18n.t('main_menu.edit.select_all'), + accelerator: 'CmdOrCtrl+A', + role: 'selectall' + } + ] + }, + { + label: i18n.t('main_menu.view.name'), + submenu: [ + { + label: i18n.t('main_menu.view.toggle_full_screen'), + role: 'togglefullscreen' + } + ] + }, + { + label: i18n.t('main_menu.window.name'), + submenu: [ + { + label: i18n.t('main_menu.window.close'), + role: 'close' + }, + { + label: i18n.t('main_menu.window.minimize'), + role: 'minimize' + }, + { + type: 'separator' + }, + { + label: i18n.t('main_menu.window.jump_to'), + accelerator: 'CmdOrCtrl+K', + enabled: true, + click: () => { + mainWindow.webContents.send('CmdOrCtrl+K') + } + }, + { + type: 'separator' + }, + ...accountsChange + ] + } + ] + + const menu = Menu.buildFromTemplate(template) + Menu.setApplicationMenu(menu) +} diff --git a/src/main/menu.js b/src/main/menu.js deleted file mode 100644 index a4b25ba2..00000000 --- a/src/main/menu.js +++ /dev/null @@ -1,169 +0,0 @@ -import { Menu } from 'electron' -import path from 'path' -import openAboutWindow from 'about-window' - -/** - * Set application menu - */ -const ApplicationMenu = (mainWindow, accountsChange, i18n) => { - /** - * For mac menu - */ - - const macGeneralMenu = process.platform !== 'darwin' ? [] : [ - { - type: 'separator' - }, - { - label: i18n.t('main_menu.application.services'), - role: 'services', - submenu: [] - }, - { - type: 'separator' - }, - { - label: i18n.t('main_menu.application.hide'), - role: 'hide' - }, - { - label: i18n.t('main_menu.application.hide_others'), - role: 'hideothers' - }, - { - label: i18n.t('main_menu.application.show_all'), - role: 'unhide' - } - ] - - const template = [ - { - label: i18n.t('main_menu.application.name'), - submenu: [ - { - label: i18n.t('main_menu.application.about'), - role: 'about', - click: () => { - openAboutWindow({ - icon_path: path.resolve(__dirname, '../../build/icons/256x256.png'), - copyright: 'Copyright (c) 2018 AkiraFukushima', - package_json_dir: path.resolve(__dirname, '../../'), - open_devtools: process.env.NODE_ENV !== 'production' - }) - } - }, - { - type: 'separator' - }, - { - label: i18n.t('main_menu.application.preferences'), - accelerator: 'CmdOrCtrl+,', - click: () => { - mainWindow.webContents.send('open-preferences') - } - }, - ...macGeneralMenu, - { - type: 'separator' - }, - { - label: i18n.t('main_menu.application.quit'), - accelerator: 'CmdOrCtrl+Q', - role: 'quit' - } - ] - }, - { - label: i18n.t('main_menu.toot.name'), - submenu: [ - { - label: i18n.t('main_menu.toot.new'), - accelerator: 'CmdOrCtrl+N', - click: () => { - mainWindow.webContents.send('CmdOrCtrl+N') - } - } - ] - }, - { - label: i18n.t('main_menu.edit.name'), - submenu: [ - { - label: i18n.t('main_menu.edit.undo'), - accelerator: 'CmdOrCtrl+Z', - role: 'undo' - }, - { - label: i18n.t('main_menu.edit.redo'), - accelerator: 'Shift+CmdOrCtrl+Z', - role: 'redo' - }, - { - type: 'separator' - }, - { - label: i18n.t('main_menu.edit.cut'), - accelerator: 'CmdOrCtrl+X', - role: 'cut' - }, - { - label: i18n.t('main_menu.edit.copy'), - accelerator: 'CmdOrCtrl+C', - role: 'copy' - }, - { - label: i18n.t('main_menu.edit.paste'), - accelerator: 'CmdOrCtrl+V', - role: 'paste' - }, - { - label: i18n.t('main_menu.edit.select_all'), - accelerator: 'CmdOrCtrl+A', - role: 'selectall' - } - ] - }, - { - label: i18n.t('main_menu.view.name'), - submenu: [ - { - label: i18n.t('main_menu.view.toggle_full_screen'), - role: 'togglefullscreen' - } - ] - }, - { - label: i18n.t('main_menu.window.name'), - submenu: [ - { - label: i18n.t('main_menu.window.close'), - role: 'close' - }, - { - label: i18n.t('main_menu.window.minimize'), - role: 'minimize' - }, - { - type: 'separator' - }, - { - label: i18n.t('main_menu.window.jump_to'), - accelerator: 'CmdOrCtrl+K', - enabled: true, - click: () => { - mainWindow.webContents.send('CmdOrCtrl+K') - } - }, - { - type: 'separator' - }, - ...accountsChange - ] - } - ] - - const menu = Menu.buildFromTemplate(template) - Menu.setApplicationMenu(menu) -} - -export default ApplicationMenu diff --git a/src/renderer/components/Preferences.vue b/src/renderer/components/Preferences.vue index 3325d293..383b8cab 100644 --- a/src/renderer/components/Preferences.vue +++ b/src/renderer/components/Preferences.vue @@ -3,7 +3,7 @@ -

Preferences

+

{{ $t('preferences.title') }}

@@ -20,11 +20,11 @@ :route="true"> - General + {{ $t('preferences.general.title') }} - Account + {{ $t('preferences.account.title') }} diff --git a/src/renderer/components/Preferences/Account.vue b/src/renderer/components/Preferences/Account.vue index 358ef332..3a05da62 100644 --- a/src/renderer/components/Preferences/Account.vue +++ b/src/renderer/components/Preferences/Account.vue @@ -1,8 +1,8 @@