Merge pull request #483 from h3poteto/iss-151

refs #151 Translate languages using i18next
This commit is contained in:
AkiraFukushima 2018-08-13 18:25:39 +09:00 committed by GitHub
commit e5f83a22cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 1011 additions and 440 deletions

View File

@ -134,6 +134,7 @@ let rendererConfig = {
resolve: {
alias: {
'@': path.join(__dirname, '../src/renderer'),
'~': path.join(__dirname, '../'),
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['.js', '.vue', '.json', '.css', '.node']

52
package-lock.json generated
View File

@ -183,6 +183,21 @@
"integrity": "sha512-LAQ1d4OPfSJ/BMbI2DuizmYrrkD9JMaTdi2hQTlI53lQ4kRQPyZQRS4CYQ7O66bnBBnP/oYdRxbk++X0xuFU6A==",
"dev": true
},
"@panter/vue-i18next": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@panter/vue-i18next/-/vue-i18next-0.12.0.tgz",
"integrity": "sha1-SHXDjUW36kzk6HbWCFQWEnuGa0Y=",
"requires": {
"deepmerge": "2.1.1"
},
"dependencies": {
"deepmerge": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.1.1.tgz",
"integrity": "sha512-urQxA1smbLZ2cBbXbaYObM1dJ82aJ2H57A1C/Kklfh/ZN1bgH4G/n5KWhdNfOK11W98gqZfyYj7W4frJJRwA2w=="
}
}
},
"@trodi/electron-splashscreen": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@trodi/electron-splashscreen/-/electron-splashscreen-0.3.1.tgz",
@ -715,7 +730,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "1.0.3"
}
@ -6070,8 +6084,7 @@
"esprima": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
"integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=",
"dev": true
"integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE="
},
"esquery": {
"version": "1.0.1",
@ -8833,6 +8846,36 @@
"integrity": "sha1-pls0RZrWNnrbs3B6gqPJ+RYWcDA=",
"dev": true
},
"i18next": {
"version": "11.5.0",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-11.5.0.tgz",
"integrity": "sha512-PM2G3iY1LoHonDwygLT9xyBAINuHujXnisnrib7RXdLtE9Tb1dT8RKXwWB+MCl9VOcM5rJwWO9iLw/3KftVEoA=="
},
"i18next-sync-fs-backend": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/i18next-sync-fs-backend/-/i18next-sync-fs-backend-1.1.0.tgz",
"integrity": "sha512-Lj2QE06GB77hNtkG60vJ5mRQWDKTIaCnVkQYfp9j9NHbvICpKlidtrR6fewVSWHQLxxfjFzNniI7vVB7b5LpUw==",
"requires": {
"js-yaml": "3.5.4",
"json5": "0.5.0"
},
"dependencies": {
"js-yaml": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.4.tgz",
"integrity": "sha1-9k8W3NeL65zoNhBo5zPr5HsHkXk=",
"requires": {
"argparse": "1.0.10",
"esprima": "2.7.3"
}
},
"json5": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.0.tgz",
"integrity": "sha1-myBxWwJsvjd4/Xae3M2CLYMypbI="
}
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
@ -16014,8 +16057,7 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
},
"sshpk": {
"version": "1.14.2",

View File

@ -91,6 +91,7 @@
}
},
"dependencies": {
"@panter/vue-i18next": "^0.12.0",
"@trodi/electron-splashscreen": "^0.3.1",
"about-window": "^1.11.0",
"animate.css": "^3.6.1",
@ -104,6 +105,8 @@
"element-ui": "^2.3.4",
"hawk": "^7.0.7",
"hoek": "^5.0.3",
"i18next": "^11.5.0",
"i18next-sync-fs-backend": "^1.1.0",
"is-empty": "^1.2.0",
"lodash": "^4.17.10",
"megalodon": "^0.3.0",

24
src/config/i18n.js Normal file
View File

@ -0,0 +1,24 @@
import path from 'path'
import i18next from 'i18next'
import Backend from 'i18next-sync-fs-backend'
const options = {
initImmediate: false,
lng: 'en',
backend: {
// path where resources get loaded from
loadPath: path.resolve(__dirname, './locales/{{lng}}/{{ns}}.json'),
// path to post missing resources
addPath: path.resolve(__dirname, './locales/{{lng}}/{{ns}}.missing.json'),
// jsonIndent to use when storing json files
jsonIndent: 2
}
}
i18next
.use(Backend)
.init(options)
export default i18next

View File

@ -0,0 +1,222 @@
{
"main_menu": {
"application": {
"name": "Whalebird",
"about": "About Whalebird",
"preferences": "Preferences...",
"services": "Services",
"hide": "Hide Whalebird",
"hide_others": "Hide Others",
"show_all": "Show All",
"quit": "Quit"
},
"toot": {
"name": "Toot",
"new": "New Toot"
},
"edit": {
"name": "Edit",
"undo": "Undo",
"redo": "Redo",
"cut": "Cut",
"copy": "Copy",
"paste": "Paste",
"select_all": "Select All"
},
"view": {
"name": "View",
"toggle_full_screen": "Toggle Full Screen"
},
"window": {
"name": "Window",
"close": "Close Window",
"minimize": "Minimize",
"jump_to": "Jump to"
}
},
"side_menu": {
"edit_profile": "Edit profile",
"home": "Home",
"notification": "Notification",
"favourite": "Favourite",
"local": "Local timeline",
"public": "Public timeline",
"hashtag": "Hashtag",
"search": "Search",
"lists": "Lists"
},
"header_menu": {
"home": "Home",
"notification": "Notification",
"favourite": "Favourite",
"local": "Local timeline",
"public": "Public timeline",
"hashtag": "Hashtag",
"search": "Search",
"lists": "Lists",
"members": "Members",
"filter": {
"title": "Filter",
"placeholder": "Filter out by regular expressions",
"apply": "Apply"
}
},
"preferences": {
"title": "Preferences",
"general": {
"title": "General",
"appearance": "Appearance",
"theme_color": "Theme color:",
"theme": {
"light": "Light",
"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?"
}
},
"modals": {
"new_toot": {
"title": "New Toot",
"cw": "Write your waring here",
"status": "What is on your mind?",
"cancel": "Cancel",
"toot": "Toot"
},
"jump": {
"jump_to": "Jump to..."
},
"add_list_member": {
"title": "Add Member to List",
"account_name": "Account name"
},
"list_membership": {
"title": "List Memberships"
}
},
"cards": {
"toot": {
"show_more": "Show more",
"hide": "Hide",
"sensitive": "Show sensitive content",
"view_toot_detail": "View Toot Detail",
"open_in_browser": "Open in Browser",
"copy_link_to_toot": "Copy Link to Toot",
"delete": "Delete",
"via": "via {{application}}"
}
},
"side_bar": {
"account_profile": {
"follows_you": "Follows you",
"doesnt_follow_you": "Doesn't follow you",
"open_in_browser": "Open in Browser",
"manage_list_memberships": "Manage List Memberships",
"toots": "Toots",
"follows": "Follows",
"followers": "Followers"
}
},
"hashtag": {
"tag_name": "Tag name"
},
"search": {
"search": "Search",
"account": "Account",
"keyword": "keyword"
},
"lists": {
"index": {
"new_list": "New List",
"edit": "Edit"
}
},
"login": {
"domain_name_label": "First, let's log in to a Mastodon instance. Please enter an instance domain name.",
"search": "Search",
"login": "Login"
},
"authorize": {
"manually_1": "Now authorization page is opened in your browser.",
"manually_2": "If it is not opened, please open the following URL manually.",
"code_label": "Please paste authorization code from your browser:",
"submit": "Submit"
},
"receive_drop": {
"drop_message": "Drop to Upload to Mastodon"
},
"message": {
"account_load_error": "Failed to load accounts",
"account_remove_error": "Failed to remove the account",
"preferences_load_error": "Failed to load preferences",
"timeline_fetch_error": "Failed to fetch timeline",
"notification_fetch_error": "Failed to fetch notification",
"favourite_fetch_error": "Failed to fetch favorite",
"start_streaming_error": "Failed to start streaming",
"attach_error": "Could not attach the file",
"authorize_duplicate_error": "Can not login the same account of the same domain",
"authorize_error": "Failed to authorize",
"followers_fetch_error": "Failed to fetch followers",
"follows_fetch_error": "Failed to fetch follows",
"toot_fetch_error": "Failed to fetch the toot detail",
"follow_error": "Failed to follow the user",
"unfollow_error": "Failed to unfollow the user",
"lists_fetch_error": "Failed to fetch lists",
"list_create_error": "Failed to create a list",
"members_fetch_error": "Failed to fetch members",
"remove_user_error": "Failed to remove the user",
"find_account_error": "Account not found",
"reblog_error": "Failed to reblog",
"unreblog_error": "Failed to unreblog",
"favourite_error": "Failed to favourite",
"unfavourite_error": "Failed to unfavourite",
"delete_error": "Failed to delete the toot",
"search_error": "Failed to search",
"toot_error": "Failed to toot",
"update_list_memberships_error": "Failed to update the list memberships",
"add_user_error": "Failed to add user",
"authorize_url_error": "Failed to get authorize url",
"domain_confirmed": "{{domain}} is confirmed, please login",
"domain_doesnt_exist": "{{domain}} does not exist"
},
"validation": {
"login": {
"rquire_domain_name": "Domain name is required",
"domain_format": "Please write only domain name"
},
"new_toot": {
"toot_length": "Toot length should be {{min}} to {{max}}",
"attach_length": "You can only attach up to {{max}} images",
"attach_image": "You can only attach images or videos"
}
}
}

View File

@ -0,0 +1,222 @@
{
"main_menu": {
"application": {
"name": "Whalebird",
"about": "Whalebirdについて",
"preferences": "設定...",
"services": "サービス",
"hide": "Whalebirdを隠す",
"hide_others": "ほかを隠す",
"show_all": "すべてを表示",
"quit": "終了"
},
"toot": {
"name": "トゥート",
"new": "トゥート"
},
"edit": {
"name": "編集",
"undo": "取り消す",
"redo": "やり直す",
"cut": "カット",
"copy": "コピー",
"paste": "ペースト",
"select_all": "すべてを選択"
},
"view": {
"name": "表示",
"toggle_full_screen": "フルスクリーンにする"
},
"window": {
"name": "ウィンドウ",
"close": "閉じる",
"minimize": "縮小",
"jump_to": "ジャンプ"
}
},
"side_menu": {
"edit_profile": "編集",
"home": "ホーム",
"notification": "通知",
"favourite": "お気に入り",
"local": "ローカル",
"public": "連合",
"hashtag": "ハッシュタグ",
"search": "検索",
"lists": "リスト"
},
"header_menu": {
"home": "ホーム",
"notification": "通知",
"favourite": "お気に入り",
"local": "ローカルタイムライン",
"public": "連合タイムライン",
"hashtag": "ハッシュタグ",
"search": "検索",
"lists": "リスト",
"members": "メンバー",
"filter": {
"title": "フィルター",
"placeholder": "正規表現でフィルター",
"apply": "適用"
}
},
"preferences": {
"title": "設定",
"general": {
"title": "一般",
"appearance": "外観",
"theme_color": "テーマカラー:",
"theme": {
"light": "標準",
"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": "本当に全ての連携を削除しますか?"
}
},
"modals": {
"new_toot": {
"title": "トゥート",
"cw": "ここに警告を書いてください",
"status": "今なにしてる?",
"cancel": "キャンセル",
"toot": "トゥート!"
},
"jump": {
"jump_to": "移動..."
},
"add_list_member": {
"title": "リストに追加",
"account_name": "アカウント名"
},
"list_membership": {
"title": "リストメンバー管理"
}
},
"cards": {
"toot": {
"show_more": "続きを見る",
"hide": "隠す",
"sensitive": "表示する",
"view_toot_detail": "詳細",
"open_in_browser": "ブラウザで開く",
"copy_link_to_toot": "コピー",
"delete": "削除する",
"via": "{{application}} より"
}
},
"side_bar": {
"account_profile": {
"follows_you": "フォローされています",
"doesnt_follow_you": "フォローされていません",
"open_in_browser": "ブラウザで開く",
"manage_list_memberships": "リストの管理",
"toots": "トゥート",
"follows": "フォロー",
"followers": "フォロワー"
}
},
"hashtag": {
"tag_name": "タグ名"
},
"search": {
"search": "検索",
"account": "アカウント",
"keyword": "キーワード"
},
"lists": {
"index": {
"new_list": "新規リスト",
"edit": "編集"
}
},
"login": {
"domain_name_label": "ドメイン名を入力してマストドンにログインしてください.",
"search": "検索",
"login": "ログイン"
},
"authorize": {
"manually_1": "認証用ページが自動的に開きます.",
"manually_2": "もし開かない場合は以下のURLから手動で認証用ページを開いてください",
"code_label": "ブラウザに表示された認証コードを貼り付けてください",
"submit": "認証"
},
"receive_drop": {
"drop_message": "ファイルをドロップしてください"
},
"message": {
"account_load_error": "アカウントの読み込みに失敗しました",
"account_remove_error": "アカウントの削除に失敗しました",
"preferences_load_error": "設定の読み込みに失敗しました",
"timeline_fetch_error": "タイムラインの読み込みに失敗しました",
"notification_fetch_error": "通知の読み込みに失敗しました",
"favourite_fetch_error": "お気に入りの読み込みに失敗しました",
"start_streaming_error": "ストリーミングを開始できませんでした",
"attach_error": "ファイルを添付できませんでした",
"authorize_duplicate_error": "同一ドメイン同一アカウントではログインできません",
"authorize_error": "認証に失敗しました",
"followers_fetch_error": "フォロワーの取得に失敗しました",
"follows_fetch_error": "フォローの取得に失敗しました",
"toot_fetch_error": "トゥート詳細の読み込みに失敗しました",
"follow_error": "フォローに失敗しました",
"unfollow_error": "フォロー解除に失敗しました",
"lists_fetch_error": "リストの読み込みに失敗しました",
"list_create_error": "リストの作成に失敗しました",
"members_fetch_error": "メンバーの取得に失敗しました",
"remove_user_error": "ユーザの削除に失敗しました",
"find_account_error": "アカウントが見つかりません",
"reblog_error": "ブーストできませんでした",
"unreblog_error": "ブースト解除に失敗しました",
"favourite_error": "お気に入りできませんでした",
"unfavourite_error": "お気に入り解除に失敗しました",
"delete_error": "トゥート削除に失敗しました",
"search_error": "検索に失敗しました",
"toot_error": "トゥートに失敗しました",
"update_list_memberships_error": "リストメンバーの更新に失敗しました",
"add_user_error": "メンバー追加に失敗しました",
"authorize_url_error": "認証用URLの取得に失敗しました",
"domain_confirmed": "{{domain}} が確認できました,ログインしてください",
"domain_doesnt_exist": "{{domain}} は存在しません"
},
"validation": {
"login": {
"rquire_domain_name": "ドメイン名は必須です",
"domain_format": "ドメイン名のみを入力してください"
},
"new_toot": {
"toot_length": "トゥートの長さは {{min}} から {{max}}文字である必要があります",
"attach_length": "添付ファイルは {{max}} つまでです",
"attach_image": "画像かビデオしか添付できません"
}
}
}

View File

@ -0,0 +1,16 @@
import i18n from '../config/i18n'
export default {
DisplayNameAndUsername: {
name: i18n.t('preferences.general.display_style.display_name_and_username'),
value: 0
},
DisplayName: {
name: i18n.t('preferences.general.display_style.display_name'),
value: 1
},
Username: {
name: i18n.t('preferences.general.display_style.username'),
value: 2
}
}

12
src/constants/theme.js Normal file
View File

@ -0,0 +1,12 @@
import i18n from '../config/i18n'
export default {
Light: {
name: i18n.t('preferences.general.theme.light'),
key: 'light'
},
Dark: {
name: i18n.t('preferences.general.theme.dark'),
key: 'dark'
}
}

View File

@ -1,18 +1,24 @@
import i18n from '../config/i18n'
export default {
Public: {
name: 'public',
value: 0
name: i18n.t('preferences.general.visibility.public'),
value: 0,
key: 'public'
},
Unlisted: {
name: 'unlisted',
value: 1
name: i18n.t('preferences.general.visibility.unlisted'),
value: 1,
key: 'unlisted'
},
Private: {
name: 'private',
value: 2
name: i18n.t('preferences.general.visibility.private'),
value: 2,
key: 'private'
},
Direct: {
name: 'direct',
value: 3
name: i18n.t('preferences.general.visibility.direct'),
value: 3,
key: 'direct'
}
}

View File

@ -7,15 +7,16 @@ import log from 'electron-log'
import windowStateKeeper from 'electron-window-state'
import simplayer from 'simplayer'
import path from 'path'
import openAboutWindow from 'about-window'
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 i18n from '../config/i18n'
/**
* Context menu
@ -107,165 +108,11 @@ async function createWindow () {
click: () => changeAccount(a, index)
}
})
/**
* For mac menu
*/
const macGeneralMenu = process.platform !== 'darwin' ? [] : [
{
type: 'separator'
},
{
label: 'Services',
role: 'services',
submenu: []
},
{
type: 'separator'
},
{
label: 'Hide Whalebird',
role: 'hide'
},
{
label: 'Hide Others',
role: 'hideothers'
},
{
label: 'Show All',
role: 'unhide'
}
]
/**
* Set application menu
*/
const template = [
{
label: 'Whalebird',
submenu: [
{
label: 'About Whalebird',
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: 'Preferences...',
accelerator: 'CmdOrCtrl+,',
click: () => {
mainWindow.webContents.send('open-preferences')
}
},
...macGeneralMenu,
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'CmdOrCtrl+Q',
role: 'quit'
}
]
},
{
label: 'Toot',
submenu: [
{
label: 'New Toot',
accelerator: 'CmdOrCtrl+N',
click: () => {
mainWindow.webContents.send('CmdOrCtrl+N')
}
}
]
},
{
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'CmdOrCtrl+Z',
role: 'undo'
},
{
label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z',
role: 'redo'
},
{
type: 'separator'
},
{
label: 'Cut',
accelerator: 'CmdOrCtrl+X',
role: 'cut'
},
{
label: 'Copy',
accelerator: 'CmdOrCtrl+C',
role: 'copy'
},
{
label: 'Paste',
accelerator: 'CmdOrCtrl+V',
role: 'paste'
},
{
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
role: 'selectall'
}
]
},
{
label: 'View',
submenu: [
{
label: 'Toggle Full Screen',
role: 'togglefullscreen'
}
]
},
{
label: 'Window',
submenu: [
{
label: 'Close Window',
role: 'close'
},
{
label: 'Minimize',
role: 'minimize'
},
{
type: 'separator'
},
{
label: 'Jump to',
accelerator: 'CmdOrCtrl+K',
enabled: true,
click: () => {
mainWindow.webContents.send('CmdOrCtrl+K')
}
},
{
type: 'separator'
},
...accountsChange
]
}
]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
ApplicationMenu(accountsChange, i18n)
/**
* Set dock menu for mac
@ -798,3 +645,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)
}

View File

@ -1,6 +1,8 @@
import storage from 'electron-json-storage'
import objectAssignDeep from 'object-assign-deep'
import Visibility from '../constants/visibility'
import DisplayStyle from '../constants/displayStyle'
import Theme from '../constants/theme'
const Base = {
general: {
@ -8,9 +10,9 @@ const Base = {
fav_rb: true,
toot: true
},
theme: 'white',
theme: Theme.Light.key,
fontSize: 14,
displayNameStyle: 0,
displayNameStyle: DisplayStyle.DisplayNameAndUsername.value,
tootVisibility: Visibility.Public.value
},
state: {

View File

@ -11,12 +11,12 @@
</el-header>
<el-main>
<div class="authorization-url">
<p>Now authorization page is opened in your browser.</p>
<p>If it is not opened, please open the following URL manually.</p>
<p>{{ $t('authorize.manually_1') }}</p>
<p>{{ $t('authorize.manually_2') }}</p>
<p class="url">{{ $route.query.url }}</p>
</div>
<el-form ref="form" :model="authorizeForm" label-width="120px" label-position="top" class="authorize-form" v-on:submit.prevent="authorizeSubmit">
<el-form-item label="Please paste authorization code from your browser:">
<el-form-item :label="$t('authorize.code_label')">
<el-input v-model="authorizeForm.code"></el-input>
</el-form-item>
<!-- Dummy form to guard submitting with enter -->
@ -29,7 +29,7 @@
@click="authorizeSubmit"
v-loading="submitting"
element-loading-background="rgba(0, 0, 0, 0.8)">
Submit
{{ $t('authorize.submit') }}
</el-button>
</el-form-item>
</el-form>
@ -71,12 +71,12 @@ export default {
.catch((err) => {
if (err.name === 'DuplicateRecordError') {
this.$message({
message: 'Can not login the same account of the same domain',
message: this.$t('message.authorize_duplicate_error'),
type: 'error'
})
} else {
this.$message({
message: 'Failed to authorize',
message: this.$t('message.authorize_error'),
type: 'error'
})
}

View File

@ -1,6 +1,6 @@
<template>
<el-form ref="loginForm" label-width="120px" label-position="top" v-on:submit.prevent="confirm('loginForm')" class="login-form" :rules="rules" :model="form">
<el-form-item label="First, let's log in to a Mastodon instance. Please enter an instance domain name." prop="domainName">
<el-form-item :label="$t('login.domain_name_label')" prop="domainName">
<el-input v-model="form.domainName" placeholder="mastodon.social" v-shortkey="['enter']" @shortkey.native="handleKey"></el-input>
</el-form-item>
<!-- Dummy form to guard submitting with enter -->
@ -13,7 +13,7 @@
v-if="selectedInstance === null"
v-loading="searching"
element-loading-background="rgba(0, 0, 0, 0.8)">
Search
{{ $t('login.search') }}
</el-button>
<el-form-item class="submit">
<el-button
@ -21,7 +21,7 @@
class="login"
@click="login"
v-if="selectedInstance !== null">
Login
{{ $t('login.login') }}
</el-button>
</el-form-item>
</el-form>
@ -37,20 +37,6 @@ export default {
return {
form: {
domainName: ''
},
rules: {
domainName: [
{
type: 'string',
required: true,
message: 'Domain name is required'
},
{
pattern: domainFormat,
trigger: 'change',
message: 'Please write only domain name'
}
]
}
}
},
@ -58,7 +44,25 @@ export default {
...mapState({
selectedInstance: state => state.Login.selectedInstance,
searching: state => state.Login.searching
})
}),
rules: {
get () {
return {
domainName: [
{
type: 'string',
required: true,
message: this.$t('validation.login.require_domain_name')
},
{
pattern: domainFormat,
trigger: 'change',
message: this.$t('validation.login.domain_format')
}
]
}
}
}
},
methods: {
login () {
@ -77,7 +81,7 @@ export default {
.catch(() => {
loading.close()
this.$message({
message: 'Could not get authorize url',
message: this.$t('message.authorize_url_error'),
type: 'error'
})
})
@ -88,19 +92,19 @@ export default {
this.$store.dispatch('Login/confirmInstance', this.form.domainName)
.then(() => {
this.$message({
message: `${this.form.domainName} is confirmed, please login`,
message: this.$t('message.domain_confirmed', {domain: this.form.domainName}),
type: 'success'
})
})
.catch(() => {
this.$message({
message: `${this.form.domainName} does not exist`,
message: this.$t('message.domain_doesnt_exist', {domain: this.form.domainName}),
type: 'error'
})
})
} else {
this.$message({
message: 'Please write only domain name',
message: this.$t('validation.login.domain_format'),
type: 'error'
})
return false

View File

@ -3,7 +3,7 @@
<el-header class="header">
<el-row>
<el-col :span="23">
<h3>Preferences</h3>
<h3>{{ $t('preferences.title') }}</h3>
</el-col>
<el-col :span="1">
<el-button type="text" icon="el-icon-close" @click="close" class="close-button"></el-button>
@ -20,11 +20,11 @@
:route="true">
<el-menu-item index="1" :route="{path: '/preferences/general'}" @click="general">
<icon name="cog" class="icon" scale="1.3"></icon>
<span>General</span>
<span>{{ $t('preferences.general.title') }}</span>
</el-menu-item>
<el-menu-item index="2" :route="{path: '/preferences/account'}" @click="account">
<icon name="user" class="icon" scale="1.3"></icon>
<span>Account</span>
<span>{{ $t('preferences.account.title') }}</span>
</el-menu-item>
</el-menu>
</el-aside>

View File

@ -1,8 +1,8 @@
<template>
<div id="account">
<h2>Account</h2>
<h2>{{ $t('preferences.account.title') }}</h2>
<div class="connected-account">
<h3>Connected Accounts</h3>
<h3>{{ $t('preferences.account.connected') }}</h3>
<template>
<el-table
:data="accounts"
@ -12,24 +12,24 @@
v-loading="accountLoading">
<el-table-column
prop="username"
label="Username">
:label="$t('preferences.account.username')">
</el-table-column>
<el-table-column
prop="domain"
label="Domain">
:label="$t('preferences.account.domain')">
</el-table-column>
<el-table-column
label="Association">
:label="$t('preferences.account.association')">
<template slot-scope="scope">
<el-button
@click.native.prevent="removeAccount(scope.$index, accounts)"
type="text">
<i class="el-icon-close"></i> Remove association
<i class="el-icon-close"></i> {{ $t('preferences.account.remove_association') }}
</el-button>
</template>
</el-table-column>
<el-table-column
label="Order"
:label="$t('preferences.account.order')"
width="60">
<template slot-scope="scope">
<div>
@ -48,12 +48,12 @@
placement="top"
width="160"
v-model="deletePopoverVisible">
<p>Are you sure to remove all associations?</p>
<p>{{ $t('preferences.account.confirm_message') }}</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="deletePopoverVisible = false">cancel</el-button>
<el-button type="danger" size="mini" @click="removeAllAssociations">confirm</el-button>
<el-button size="mini" type="text" @click="deletePopoverVisible = false">{{ $t('preferences.account.cancel') }}</el-button>
<el-button type="danger" size="mini" @click="removeAllAssociations">{{ $t('preferences.account.confirm') }}</el-button>
</div>
<el-button slot="reference" type="danger">Remove all associations</el-button>
<el-button slot="reference" type="danger">{{ $t('preferences.account.remove_all_associations') }}</el-button>
</el-popover>
</div>
</div>
@ -85,13 +85,13 @@ export default {
this.$store.commit('Preferences/Account/updateAccountLoading', true)
try {
await this.$store.dispatch('Preferences/Account/loadAccounts')
this.$store.commit('Preferences/Account/updateAccountLoading', false)
} catch (err) {
this.$store.commit('Preferences/Account/updateAccountLoading', false)
return this.$message({
message: 'Failed to load accounts',
message: this.$t('message.account_load_error'),
type: 'error'
})
} finally {
this.$store.commit('Preferences/Account/updateAccountLoading', false)
}
},
removeAccount (index, accounts) {
@ -101,7 +101,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to remove the association',
message: this.$t('message.account_remove_error'),
type: 'error'
})
})

View File

@ -1,25 +1,24 @@
<template>
<div id="general" v-loading="loading">
<h2>General</h2>
<h2>{{ $t('preferences.general.title') }}</h2>
<div class="appearance">
<h3>Appearance</h3>
<h3>{{ $t('preferences.general.appearance') }}</h3>
<table class="theme">
<tbody>
<tr>
<td class="title">Theme color:</td>
<td class="title">{{ $t('preferences.general.theme_color') }}</td>
<td class="status">
<el-radio v-model="theme" label="white">White</el-radio>
<el-radio v-model="theme" label="dark">Dark</el-radio>
<el-radio v-for="t in themes" :key="t.key" v-model="theme" :label="t.key">{{ t.name }}</el-radio>
</td>
</tr>
<tr>
<td class="title">Font size:</td>
<td class="title">{{ $t('preferences.general.font_size') }}</td>
<td class="status">
<el-input-number :value="fontSize" :min="9" :max="18" @change="updateFontSize"></el-input-number>
</td>
</tr>
<tr>
<td class="title">Display name style:</td>
<td class="title">{{ $t('preferences.general.display_style.title') }}</td>
<td class="status">
<el-select v-model="displayNameStyle" placeholder="style">
<el-option
@ -35,11 +34,11 @@
</table>
</div>
<div class="toot">
<h3>Toot</h3>
<h3>{{ $t('preferences.general.toot') }}</h3>
<table>
<tbody>
<tr>
<td class="title">Default Visibility:</td>
<td class="title">{{ $t('preferences.general.visibility.title') }}</td>
<td class="status">
<el-select v-model="tootVisibility" placeholder="visibility">
<el-option
@ -55,11 +54,11 @@
</table>
</div>
<div class="sounds">
<h3>Sounds</h3>
<h3>{{ $t('preferences.general.sounds') }}</h3>
<table>
<tbody>
<tr>
<td class="title">Favourite, Reblog action sound:</td>
<td class="title">{{ $t('preferences.general.fav_rb_sound') }}</td>
<td class="status">
<el-switch
v-model="sound_fav_rb"
@ -68,7 +67,7 @@
</td>
</tr>
<tr>
<td class="title">Toot action sound:</td>
<td class="title">{{ $t('preferences.general.toot_sound') }}</td>
<td class="status">
<el-switch
v-model="sound_toot"
@ -84,30 +83,27 @@
<script>
import { mapState } from 'vuex'
import Visibility from '../../../constants/visibility'
import Visibility from '~/src/constants/visibility'
import DisplayStyle from '~/src/constants/displayStyle'
import Theme from '~/src/constants/theme'
export default {
name: 'general',
data () {
return {
nameStyles: [
{
name: 'DisplayName and username',
value: 0
},
{
name: 'DisplayName',
value: 1
},
{
name: 'username',
value: 2
}
],
visibilities: [
Visibility.Public,
Visibility.Unlisted,
Visibility.Private
],
nameStyles: [
DisplayStyle.DisplayNameAndUsername,
DisplayStyle.DisplayName,
DisplayStyle.Username
],
themes: [
Theme.Light,
Theme.Dark
]
}
},
@ -118,7 +114,7 @@ export default {
}),
theme: {
get () {
return this.$store.state.Preferences.General.general.theme || 'white'
return this.$store.state.Preferences.General.general.theme
},
set (value) {
this.$store.dispatch('Preferences/General/updateTheme', value)
@ -165,7 +161,7 @@ export default {
this.$store.dispatch('Preferences/General/loadGeneral')
.catch(() => {
this.$message({
message: 'Failed to load preferences',
message: this.$t('message.preferences_load_error'),
type: 'error'
})
})

View File

@ -83,7 +83,7 @@ export default {
this.$store.dispatch('TimelineSpace/watchShortcutEvents')
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch(() => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
})
@ -91,7 +91,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
} catch (err) {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
}
@ -99,7 +99,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
} catch (err) {
this.$message({
message: 'Could not fetch notification',
message: this.$t('message.notification_fetch_error'),
type: 'error'
})
}
@ -107,7 +107,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
} catch (err) {
this.$message({
message: 'Could not fetch local timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
}
@ -115,7 +115,7 @@ export default {
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
.catch(() => {
this.$message({
message: 'Failed to start streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})
@ -131,7 +131,7 @@ export default {
const file = e.dataTransfer.files.item(0)
if (!file.type.includes('image') && !file.type.includes('video')) {
this.$message({
message: 'You can only attach images or videos',
message: this.$t('validation.new_toot.attach_image'),
type: 'error'
})
return false
@ -141,7 +141,7 @@ export default {
this.$store.dispatch('TimelineSpace/Modals/NewToot/uploadImage', file)
.catch(() => {
this.$message({
message: 'Could not attach the file',
message: this.$t('message.attach_error'),
type: 'error'
})
})

View File

@ -82,7 +82,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Account not found',
message: this.$t('message.find_account_error'),
type: 'error'
})
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', false)

View File

@ -82,7 +82,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Account not found',
message: this.$t('message.find_account_error'),
type: 'error'
})
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', false)

View File

@ -22,17 +22,17 @@
<div class="spoiler" v-show="spoilered(message)">
{{ originalMessage(message).spoiler_text }}
<el-button v-show="!isShowContent(message)" type="text" @click="showContent = true">
Show more
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-show="isShowContent(message)" type="text" @click="showContent = false">
Hide
{{ $t('cards.toot.hide')}}
</el-button>
</div>
<div class="content" v-show="isShowContent(message)" v-html="originalMessage(message).content" @click.capture.prevent="tootClick"></div>
</div>
<div class="attachments">
<el-button v-show="sensitive(message) && !isShowAttachments(message)" class="show-sensitive" type="info" @click="showAttachments = true">
Show sensitive contents
{{ $t('cards.toot.sensitive') }}
</el-button>
<div v-show="isShowAttachments(message)">
<el-button v-show="sensitive(message) && isShowAttachments(message)" class="hide-sensitive" type="text" @click="showAttachments = false">
@ -76,16 +76,16 @@
<div class="popper toot-menu">
<ul class="menu-list">
<li role="button" @click="openDetail(message)">
View Toot Detail
{{ $t('cards.toot.view_toot_detail') }}
</li>
<li role="button" @click="openBrowser(originalMessage(message))">
Open in Browser
{{ $t('cards.toot.open_in_browser') }}
</li>
<li role="button" @click="copyLink(originalMessage(message))">
Copy Link to Toot
{{ $t('cards.toot.copy_link_to_toot') }}
</li>
<li role="button" class="separate" @click="deleteToot(message)" v-show="isMyMessage(message)">
Delete
{{ $t('cards.toot.delete') }}
</li>
</ul>
</div>
@ -95,7 +95,7 @@
</popper>
</div>
<div class="application" v-show="application(message) !== null">
via {{ application(message) }}
{{ $t('cards.toot.via', { application: application(message) }) }}
</div>
</div>
<div class="clearfix"></div>
@ -109,6 +109,7 @@ import moment from 'moment'
import { shell, clipboard } from 'electron'
import { mapState } from 'vuex'
import { findAccount, findLink, isTag } from '../../../utils/link'
import DisplayStyle from '~/src/constants/displayStyle'
export default {
name: 'toot',
@ -143,29 +144,28 @@ export default {
},
username (account) {
switch (this.displayNameStyle) {
case 0:
case DisplayStyle.DisplayNameAndUsername.value:
if (account.display_name !== '') {
return account.display_name
} else {
return account.username
}
case 1:
case DisplayStyle.DisplayName.value:
if (account.display_name !== '') {
return account.display_name
} else {
return account.username
}
case 2:
case DisplayStyle.Username.value:
return `@${account.username}`
}
},
accountName (account) {
switch (this.displayNameStyle) {
case 0:
case DisplayStyle.DisplayNameAndUsername.value:
return `@${account.username}`
case 1:
return ''
case 2:
case DisplayStyle.DisplayName.value:
case DisplayStyle.Username.value:
return ''
}
},
@ -188,7 +188,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Account not found',
message: this.$t('message.find_account_error'),
type: 'error'
})
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', false)
@ -225,7 +225,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to unreblog',
message: this.$t('message.unreblog_error'),
type: 'error'
})
})
@ -236,7 +236,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to reblog',
message: this.$t('message.reblog_error'),
type: 'error'
})
})
@ -250,7 +250,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to unfavourite',
message: this.$t('message.unfavourite_error'),
type: 'error'
})
})
@ -261,7 +261,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to favourite',
message: this.$t('message.favourite_error'),
type: 'error'
})
})
@ -309,7 +309,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to delete the toot',
message: this.$t('message.delete_error'),
type: 'error'
})
})

View File

@ -42,7 +42,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Favourites/fetchFavourites', this.account)
.catch(() => {
this.$message({
message: 'Could not fetch favourites',
message: this.$t('message.favourite_fetch_error'),
type: 'error'
})
})
@ -82,7 +82,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Favourites/lazyFetchFavourites', this.favourites[this.favourites.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch favourites',
message: this.$t('message.favourite_fetch_error'),
type: 'error'
})
})
@ -99,7 +99,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -113,7 +113,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Favourites/fetchFavourites', account)
.catch(() => {
this.$message({
message: 'Could not fetch favourites',
message: this.$t('message.favourite_fetch_error'),
type: 'error'
})
})

View File

@ -9,7 +9,7 @@
</el-button>
</div>
<div class="form-item input">
<input v-model="tag" placeholder="Tag name" class="search-keyword" v-shortkey="['enter']" @shortkey="search" autofocus></input>
<input v-model="tag" :placeholder="$t('hashtag.tag_name')" class="search-keyword" v-shortkey="['enter']" @shortkey="search" autofocus></input>
</div>
<div class="form-item" v-show="tagPage()">
<el-button type="text" @click="save">

View File

@ -73,14 +73,14 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetch', tag)
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/startStreaming', tag)
.catch(() => {
this.$message({
message: 'Could not start streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})
@ -124,7 +124,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -139,7 +139,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetch', tag)
.catch(() => {
this.$message({
message: 'Could not fetch timeline with tag',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -149,7 +149,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/startStreaming', tag)
.catch(() => {
this.$message({
message: 'Failed to restart streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})

View File

@ -71,7 +71,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Home/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch home timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -95,7 +95,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -106,7 +106,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -115,7 +115,7 @@ export default {
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
.catch(() => {
this.$message({
message: 'Failed to restart streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})

View File

@ -34,7 +34,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Lists/Edit/fetchMembers', this.list_id)
} catch (err) {
this.$message({
message: 'Failed to fetch members',
message: this.$t('message.members_fetch_error'),
type: 'error'
})
} finally {
@ -51,7 +51,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Lists/Edit/fetchMembers', this.list_id)
} catch (err) {
this.$message({
message: 'Failed to remove user',
message: this.$t('message.remove_user_error'),
type: 'error'
})
} finally {

View File

@ -2,7 +2,7 @@
<div id="lists">
<div class="new-list" v-loading="creating" :element-loading-background="loadingBackground">
<el-form :inline="true">
<input v-model="title" placeholder="New List" class="list-title"></input>
<input v-model="title" :placeholder="$t('lists.index.new_list')" class="list-title"></input>
<el-button type="text" class="create" @click="createList">
<icon name="plus"></icon>
</el-button>
@ -14,7 +14,7 @@
</router-link>
<div class="tools">
<el-button type="text" @click="edit(list)">
Edit
{{ $t('lists.index.edit') }}
</el-button>
</div>
</div>
@ -53,7 +53,7 @@ export default {
return this.$store.dispatch('TimelineSpace/Contents/Lists/Index/fetchLists')
.catch(() => {
this.$message({
message: 'Failed to fetch lists',
message: this.$t('message.lists_fetch_error'),
type: 'error'
})
})
@ -65,7 +65,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Lists/Index/fetchLists')
} catch (err) {
this.$message({
message: 'Failed to create a list',
message: this.$t('message.list_create_error'),
type: 'error'
})
} finally {

View File

@ -81,14 +81,14 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', this.list_id)
} catch (err) {
this.$message({
message: 'Failed to get timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
}
this.$store.dispatch('TimelineSpace/Contents/Lists/Show/startStreaming', this.list_id)
.catch(() => {
this.$message({
message: 'Failed to start streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})
@ -120,7 +120,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -135,7 +135,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', this.list_id)
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -145,7 +145,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Lists/Show/startStreaming', this.list_id)
.catch(() => {
this.$message({
message: 'Failed to restart streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})

View File

@ -76,7 +76,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Local/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -94,7 +94,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -106,7 +106,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
.catch(() => {
this.$message({
message: 'Could not fetch local timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -115,7 +115,7 @@ export default {
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
.catch(() => {
this.$message({
message: 'Failed to restart streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})

View File

@ -71,7 +71,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Notifications/lazyFetchNotifications', this.notifications[this.notifications.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch notification',
message: this.$t('message.notification_fetch_error'),
type: 'error'
})
})
@ -89,7 +89,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -102,7 +102,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
.catch(() => {
this.$message({
message: 'Could not fetch notifications',
message: this.$t('message.notification_fetch_error'),
type: 'error'
})
})

View File

@ -73,14 +73,14 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Public/fetchPublicTimeline')
} catch (err) {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
}
this.$store.dispatch('TimelineSpace/Contents/Public/startPublicStreaming')
.catch(() => {
this.$message({
message: 'Failed to start streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})
@ -96,7 +96,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Public/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -114,7 +114,7 @@ export default {
try {
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
this.$message({
message: 'Could not find account',
message: this.$t('message.account_load_error'),
type: 'error'
})
throw err
@ -128,7 +128,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Contents/Public/fetchPublicTimeline')
.catch(() => {
this.$message({
message: 'Could not fetch public timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -138,7 +138,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Public/startPublicStreaming')
.catch(() => {
this.$message({
message: 'Failed to restart streaming',
message: this.$t('message.start_streaming_error'),
type: 'error'
})
})

View File

@ -2,7 +2,7 @@
<div id="search">
<div class="search-header" v-loading="loading" :element-loading-background="loadingBackground">
<el-form :inline="true">
<el-select v-model="target" placeholder="search" class="search-target">
<el-select v-model="target" :placeholder="$t('search.search')" class="search-target">
<el-option
v-for="item in searchTargets"
:key="item.target"
@ -10,7 +10,7 @@
:value="item.target">
</el-option>
</el-select>
<input v-model="query" placeholder="keyword" class="search-keyword" v-shortkey="['enter']" @shortkey="search" autofocus></input>
<input v-model="query" :placeholder="$t('search.keyword')" class="search-keyword" v-shortkey="['enter']" @shortkey="search" autofocus></input>
<div class="clearfix"></div>
</el-form>
</div>
@ -30,12 +30,6 @@ export default {
data () {
return {
target: 'account',
searchTargets: [
{
target: 'account',
label: 'Account'
}
],
query: ''
}
},
@ -43,7 +37,17 @@ export default {
...mapState({
loading: state => state.TimelineSpace.Contents.Search.loading,
loadingBackground: state => state.App.theme.wrapper_mask_color
})
}),
searchTargets: {
get () {
return [
{
target: 'account',
label: this.$t('search.account')
}
]
}
}
},
methods: {
search () {
@ -52,7 +56,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/Search/Account/search', this.query)
.catch(() => {
this.$message({
message: 'Could not search',
message: this.$t('message.search_error'),
type: 'error'
})
})

View File

@ -8,8 +8,8 @@
<div class="header">
<div class="follow-follower" v-if="relationship !== null && relationship !== ''">
<div class="follower-status">
<span class="status" v-if="relationship.followed_by">Follows you</span>
<span class="status" v-else>Doesn't follow you</span>
<span class="status" v-if="relationship.followed_by">{{ $t('side_bar.account_profile.follows_you') }}</span>
<span class="status" v-else>{{ $t('side_bar.account_profile.doesnt_follow_you') }}</span>
</div>
<div class="follow-status">
<div v-if="relationship.following" class="unfollow" @click="unfollow(account)">
@ -28,10 +28,10 @@
<div class="popper">
<ul class="menu-list">
<li role="button" @click="openBrowser(account)">
Open in Browser
{{ $t('side_bar.account_profile.open_in_browser') }}
</li>
<li role="button" @click="addToList(account)">
Manage List Memberships
{{ $t('side_bar.account_profile.manage_list_memberships') }}
</li>
</ul>
</div>
@ -57,19 +57,19 @@
<el-row class="basic-info">
<el-col :span="8" :class="activeTab === 1 ? 'info info-active' : 'info'" @click="changeTab">
<el-button type="text" class="tab" @click="changeTab(1)">
<div class="title">Toots</div>
<div class="title">{{ $t('side_bar.account_profile.toots') }}</div>
<div class="count">{{ account.statuses_count }}</div>
</el-button>
</el-col>
<el-col :span="8" :class="activeTab === 2 ? 'info info-active' : 'info'">
<el-button type="text" class="tab" @click="changeTab(2)">
<div class="title">Follows</div>
<div class="title">{{ $t('side_bar.account_profile.follows') }}</div>
<div class="count">{{ account.following_count }}</div>
</el-button>
</el-col>
<el-col :span="8" :class="activeTab === 3 ? 'info info-active' : 'info'">
<el-button type="text" class="tab" @click="changeTab(3)">
<div class="title">Followers</div>
<div class="title">{{ $t('side_bar.account_profile.followers') }}</div>
<div class="count">{{ account.followers_count }}</div>
</el-button>
</el-col>
@ -141,7 +141,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/follow', account)
.catch(() => {
this.$message({
message: 'Could not follow this user',
message: this.$t('message.follow_error'),
type: 'error'
})
})
@ -150,7 +150,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/unfollow', account)
.catch(() => {
this.$message({
message: 'Could not unfollow this user',
message: this.$t('message.unfollow_error'),
type: 'error'
})
})

View File

@ -32,7 +32,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/Followers/fetchFollowers', this.account)
.catch(() => {
this.$message({
message: 'Could not get followers',
message: this.$t('message.followers_fetch_error'),
type: 'error'
})
})

View File

@ -32,7 +32,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/Follows/fetchFollows', this.account)
.catch(() => {
this.$message({
message: 'Could not get follows',
message: this.$t('message.follows_fetch_error'),
type: 'error'
})
})

View File

@ -44,7 +44,7 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/fetchTimeline', this.account)
.catch(() => {
this.message({
message: 'Could not get timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})
@ -60,7 +60,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Could not fetch account timeline',
message: this.$t('message.timeline_fetch_error'),
type: 'error'
})
})

View File

@ -43,7 +43,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Could not fetch toot detail',
message: this.$t('message.toot_fetch_error'),
type: 'error'
})
})

View File

@ -16,11 +16,11 @@
v-model="filterVisible">
<div>
<el-form>
<el-form-item label="Filter">
<el-input v-model="filter" placeholder="Filter out by regular expressions"></el-input>
<el-form-item :label="$t('header_menu.filter.title')">
<el-input v-model="filter" :placeholder="$t('header_menu.filter.placeholder')"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="applyFilter(filter)">Apply</el-button>
<el-button type="primary" @click="applyFilter(filter)">{{ $t('header_menu.filter.apply') }}</el-button>
</el-form-item>
</el-form>
</div>
@ -62,41 +62,41 @@ export default {
channelName () {
switch (this.$route.name) {
case 'home':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Home')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.home'))
break
case 'notifications':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Notification')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.notification'))
break
case 'favourites':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Favourite')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.favourite'))
break
case 'local':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Local timeline')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.local'))
break
case 'public':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Public timeline')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.public'))
break
case 'hashtag-list':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Hashtag')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.hashtag'))
break
case 'tag':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', `#${this.$route.params.tag}`)
break
case 'search':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Search')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.search'))
break
case 'lists':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Lists')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.lists'))
break
case 'edit-list':
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Members')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.members'))
break
case 'list':
this.$store.dispatch('TimelineSpace/HeaderMenu/fetchList', this.$route.params.list_id)
break
default:
console.log(this.$route)
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', 'Home')
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.home'))
break
}
},

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
title="Add Member to List"
:title="$t('modals.add_list_member.title')"
:visible.sync="addListMemberModal"
width="400px"
class="add-member">
@ -81,7 +81,7 @@ export default {
})
.catch(() => {
this.$message({
message: 'Failed to add user',
message: this.$t('message.add_user_error'),
type: 'error'
})
})

View File

@ -8,7 +8,7 @@
<input
type="text"
v-model="channel"
placeholder="Jump to..."
:placeholder="$t('modals.jump.jump_to')"
ref="channel"
v-shortkey="{next: ['arrowdown'], prev: ['arrowup'], select: ['enter']}"
@shortkey="handleKey"

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
title="List Memberships"
:title="$t('modals.list_membership.title')"
:visible.sync="listMembershipModal"
width="400px"
class="list-membership-modal"
@ -50,7 +50,7 @@ export default {
return this.$store.dispatch('TimelineSpace/Modals/ListMembership/changeBelongToLists', value)
.catch(() => {
this.$message({
message: 'Failed to update list memberships',
message: this.$t('message.update_list_memberships_error'),
type: 'error'
})
})
@ -72,7 +72,7 @@ export default {
await this.$store.dispatch('TimelineSpace/Modals/ListMembership/fetchLists')
} catch (err) {
this.$message({
message: 'Failed to fetch list',
message: this.$t('message.lists_fetch_error'),
type: 'error'
})
} finally {

View File

@ -1,12 +1,12 @@
<template>
<el-dialog
title="New Toot"
:title="$t('modals.new_toot.title')"
:visible.sync="newTootModal"
width="400px"
class="new-toot-modal">
<el-form v-on:submit.prevent="toot">
<div class="spoiler" v-show="showContentWarning">
<el-input placeholder="Write your warning here" v-model="spoiler"></el-input>
<el-input :placeholder="$t('modals.new_toot.cw')" v-model="spoiler"></el-input>
</div>
<Status
v-model="status"
@ -29,10 +29,22 @@
<el-dropdown trigger="click" @command="changeVisibility">
<el-button size="small" type="text"><icon :name="visibilityIcon"></icon></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="public"><icon name="globe" class="privacy-icon"></icon>Public</el-dropdown-item>
<el-dropdown-item command="unlisted"><icon name="unlock" class="privacy-icon"></icon>Unlisted</el-dropdown-item>
<el-dropdown-item command="private"><icon name="lock" class="privacy-icon"></icon>Private</el-dropdown-item>
<el-dropdown-item command="direct"><icon name="envelope" class="privacy-icon" scale="0.8"></icon>Direct</el-dropdown-item>
<el-dropdown-item :command="visibilityList.Public.value">
<icon name="globe" class="privacy-icon"></icon>
{{ visibilityList.Public.name }}
</el-dropdown-item>
<el-dropdown-item :command="visibilityList.Unlisted.value">
<icon name="unlock" class="privacy-icon"></icon>
{{ visibilityList.Unlisted.name }}
</el-dropdown-item>
<el-dropdown-item :command="visibilityList.Private.value">
<icon name="lock" class="privacy-icon"></icon>
{{ visibilityList.Private.name }}
</el-dropdown-item>
<el-dropdown-item :command="visibilityList.Direct.value">
<icon name="envelope" class="privacy-icon" scale="0.8"></icon>
{{ visibilityList.Direct.name }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
@ -48,8 +60,8 @@
</el-button>
</div>
<span class="text-count">{{ 500 - status.length }}</span>
<el-button @click="close">Cancel</el-button>
<el-button type="primary" @click="toot" v-loading="blockSubmit">Toot</el-button>
<el-button @click="close">{{ $t('modals.new_toot.cancel') }}</el-button>
<el-button type="primary" @click="toot" v-loading="blockSubmit">{{ $t('modals.new_toot.toot') }}</el-button>
<div class="clearfix"></div>
</div>
</el-dialog>
@ -57,7 +69,7 @@
<script>
import { mapState } from 'vuex'
import Visibility from '../../../../constants/visibility'
import Visibility from '~/src/constants/visibility'
import Status from './NewToot/Status'
export default {
@ -67,7 +79,8 @@ export default {
},
data () {
return {
showContentWarning: false
showContentWarning: false,
visibilityList: Visibility
}
},
computed: {
@ -147,7 +160,7 @@ export default {
}
if (this.status.length <= 0 || this.status.length >= 500) {
return this.$message({
message: 'Toot length should be 1 to 500',
message: this.$t('validation.new_toot.toot_length', {min: 1, max: 500}),
type: 'error'
})
}
@ -156,7 +169,7 @@ export default {
})
let form = {
status: this.status,
visibility: Visibility[visibilityKey].name,
visibility: Visibility[visibilityKey].key,
sensitive: this.sensitive,
spoiler_text: this.spoiler
}
@ -168,7 +181,7 @@ export default {
if (this.attachedMedias.length > 0) {
if (this.attachedMedias.length > 4) {
return this.$message({
message: 'You can only attach up to 4 images',
message: this.$t('validation.new_toot.attach_length', {max: 4}),
type: 'error'
})
}
@ -180,7 +193,7 @@ export default {
this.$store.dispatch('TimelineSpace/Modals/NewToot/postToot', form)
.catch(() => {
this.$message({
message: 'Could not toot',
message: this.$t('message.toot_error'),
type: 'error'
})
})
@ -196,7 +209,7 @@ export default {
const file = e.target.files.item(0)
if (!file.type.includes('image') && !file.type.includes('video')) {
this.$message({
message: 'You can only attach images or videos',
message: this.$t('validation.new_toot.attach_image'),
type: 'error'
})
return
@ -208,7 +221,7 @@ export default {
this.$store.dispatch('TimelineSpace/Modals/NewToot/uploadImage', file)
.catch(() => {
this.$message({
message: 'Could not attach the file',
message: this.$t('message.attach_error'),
type: 'error'
})
})
@ -217,7 +230,7 @@ export default {
this.$store.commit('TimelineSpace/Modals/NewToot/removeMedia', media)
},
changeVisibility (level) {
this.$store.dispatch('TimelineSpace/Modals/NewToot/changeVisibility', level)
this.$store.commit('TimelineSpace/Modals/NewToot/changeVisibilityValue', level)
},
changeSensitive () {
this.$store.commit('TimelineSpace/Modals/NewToot/changeSensitive', !this.sensitive)

View File

@ -6,7 +6,7 @@
v-shortkey="openSuggest ? {up: ['arrowup'], down: ['arrowdown'], enter: ['enter']} : {linux: ['ctrl', 'enter'], mac: ['meta', 'enter']}"
@shortkey="handleKey"
v-on:input="startSuggest"
placeholder="What is on your mind?"
:placeholder="$t('modals.new_toot.status')"
autofocus>
</textarea>
<el-popover

View File

@ -2,7 +2,7 @@
<div id="receive_drop">
<div class="drop-area">
<div class="drop-message">
<h1>Drop to Upload to Mastodon</h1>
<h1>{{ $t('receive_drop.drop_message') }}</h1>
</div>
</div>
</div>

View File

@ -11,7 +11,7 @@
<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="edit">Edit profile</el-dropdown-item>
<el-dropdown-item command="edit">{{ $t("side_menu.edit_profile") }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
@ -36,41 +36,41 @@
:class="collapse ? 'el-menu-vertical timeline-menu narrow-menu':'el-menu-vertical timeline-menu'">
<el-menu-item :index="`/${id()}/home`">
<icon name="home"></icon>
<span>Home</span>
<span>{{ $t("side_menu.home") }}</span>
<el-badge is-dot :hidden="!unreadHomeTimeline">
</el-badge>
</el-menu-item>
<el-menu-item :index="`/${id()}/notifications`">
<icon name="bell"></icon>
<span>Notification</span>
<span>{{ $t("side_menu.notification") }}</span>
<el-badge is-dot :hidden="!unreadNotifications">
</el-badge>
</el-menu-item>
<el-menu-item :index="`/${id()}/favourites`">
<icon name="star"></icon>
<span>Favourite</span>
<span>{{ $t("side_menu.favourite") }}</span>
</el-menu-item>
<el-menu-item :index="`/${id()}/local`">
<icon name="users"></icon>
<span>Local timeline</span>
<span>{{ $t("side_menu.local") }}</span>
<el-badge is-dot :hidden="!unreadLocalTimeline">
</el-badge>
</el-menu-item>
<el-menu-item :index="`/${id()}/public`">
<icon name="globe"></icon>
<span>Public timeline</span>
<span>{{ $t("side_menu.public") }}</span>
</el-menu-item>
<el-menu-item :index="`/${id()}/hashtag`">
<icon name="hashtag"></icon>
<span>Hashtag</span>
<span>{{ $t("side_menu.hashtag") }}</span>
</el-menu-item>
<el-menu-item :index="`/${id()}/search`">
<icon name="search"></icon>
<span>Search</span>
<span>{{ $t("side_menu.search") }}</span>
</el-menu-item>
<el-menu-item :index="`/${id()}/lists`">
<icon name="list-ul"></icon>
<span>Lists</span>
<span>{{ $t("side_menu.lists") }}</span>
</el-menu-item>
<template v-for="list in lists">
<el-menu-item :index="`/${id()}/lists/${list.id}`" class="sub-menu" v-bind:key="list.id">

View File

@ -8,14 +8,17 @@ import Popper from 'vue-popperjs'
import 'vue-popperjs/dist/css/vue-popper.css'
import { sync } from 'vuex-router-sync'
import shortkey from 'vue-shortkey'
import VueI18Next from '@panter/vue-i18next'
import './assets/fonts/fonts.css'
import App from './App'
import router from './router'
import store from './store'
import i18next from '~/src/config/i18n'
Vue.use(ElementUI)
Vue.use(shortkey)
Vue.use(VueI18Next)
Vue.component('icon', Icon)
Vue.component('popper', Popper)
@ -25,9 +28,12 @@ if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.http = Vue.prototype.$http = axios
Vue.config.productionTip = false
const i18n = new VueI18Next(i18next)
/* eslint-disable no-new */
new Vue({
components: { App },
i18n: i18n,
router,
store,
template: '<App/>'

View File

@ -1,24 +1,25 @@
import { ipcRenderer } from 'electron'
import router from '../router'
import { LightTheme, DarkTheme } from '../utils/theme'
import Visibility from '~/src/constants/visibility'
import DisplayStyle from '~/src/constants/displayStyle'
import Theme from '~/src/constants/theme'
const App = {
namespaced: true,
state: {
theme: LightTheme,
fontSize: 14,
// 0: display name and username
// 1: display name
// 2: username
displayNameStyle: 0
displayNameStyle: DisplayStyle.DisplayNameAndUsername.value,
tootVisibility: Visibility.Public.value
},
mutations: {
updateTheme (state, themeName) {
switch (themeName) {
case 'light':
updateTheme (state, themeKey) {
switch (themeKey) {
case Theme.Light.key:
state.theme = LightTheme
break
case 'dark':
case Theme.Dark.key:
state.theme = DarkTheme
break
default:

View File

@ -33,19 +33,14 @@ const Login = {
pageBack ({ commit }) {
commit('changeInstance', null)
},
confirmInstance ({ commit }, domain) {
return new Promise((resolve, reject) => {
commit('changeSearching', true)
axios
.get(`https://${domain}/api/v1/instance`)
.then((res) => {
commit('changeInstance', domain)
resolve(res)
})
.finally(() => {
commit('changeSearching', false)
})
})
async confirmInstance ({ commit }, domain) {
commit('changeSearching', true)
const res = await axios.get(`https://${domain}/api/v1/instance`)
.finally(() => {
commit('changeSearching', false)
})
commit('changeInstance', domain)
return res.data
}
}
}

View File

@ -1,5 +1,7 @@
import { ipcRenderer } from 'electron'
import Visibility from '../../../constants/visibility'
import Visibility from '~/src/constants/visibility'
import DisplayStyle from '~/src/constants/displayStyle'
import Theme from '~/src/constants/theme'
const General = {
namespaced: true,
@ -9,9 +11,9 @@ const General = {
fav_rb: true,
toot: true
},
theme: 'white',
theme: Theme.Light.key,
fontSize: 14,
displayNameStyle: 0,
displayNameStyle: DisplayStyle.DisplayNameAndUsername.value,
tootVisibility: Visibility.Public.value
},
loading: false

View File

@ -1,4 +1,5 @@
import router from '../../../router'
import i18n from '~/src/config/i18n'
const Jump = {
namespaced: true,
@ -7,37 +8,37 @@ const Jump = {
channel: '',
defaultChannelList: [
{
name: 'Home',
name: i18n.t('side_menu.home'),
path: 'home'
},
{
name: 'Notification',
name: i18n.t('side_menu.notification'),
path: 'notifications'
},
{
name: 'Favourite',
name: i18n.t('side_menu.favourite'),
path: 'favourites'
},
{
name: 'Local timeline',
name: i18n.t('side_menu.local'),
path: 'local'
},
{
name: 'Public timeline',
name: i18n.t('side_menu.public'),
path: 'public'
},
{
name: 'Hashtag',
name: i18n.t('side_menu.hashtag'),
path: 'hashtag'
},
{
name: 'Search',
name: i18n.t('side_menu.search'),
path: 'search'
}
],
listChannelList: [],
selectedChannel: {
name: 'Home',
name: i18n.t('side_menu.home'),
path: 'home'
}
},

View File

@ -1,6 +1,6 @@
import Mastodon from 'megalodon'
import { ipcRenderer } from 'electron'
import Visibility from '../../../../constants/visibility'
import Visibility from '~/src/constants/visibility'
import Status from './NewToot/Status'
const NewToot = {
@ -45,10 +45,14 @@ const NewToot = {
* changeVisibility
* Update visibility using Visibility constants
* @param state vuex state object
* @param visibility Visibility constants object
* @param level Visibility level
**/
changeVisibility (state, visibility) {
state.visibility = visibility.value
changeVisibility (state, level) {
Object.keys(Visibility).map((key, index) => {
if (Visibility[key].key === level) {
this.visibility = Visibility[key].value
}
})
},
/**
* changeVisibilityValue
@ -91,14 +95,11 @@ const NewToot = {
.filter((a) => a !== rootState.TimelineSpace.account.username)
commit('changeModal', true)
commit('updateStatus', `${mentionAccounts.map(m => `@${m}`).join(' ')} `)
dispatch('changeVisibility', message.visibility)
commit('changeVisibility', message.visibility)
},
openModal ({ dispatch, commit }) {
openModal ({ dispatch, commit, rootState }) {
commit('changeModal', true)
ipcRenderer.send('get-preferences')
ipcRenderer.once('response-get-preferences', (event, conf) => {
commit('changeVisibilityValue', conf.general.tootVisibility)
})
commit('changeVisibilityValue', rootState.tootVisibility)
},
closeModal ({ commit }) {
commit('changeModal', false)
@ -139,18 +140,6 @@ const NewToot = {
},
resetMediaId ({ commit }) {
commit('updateMediaId', 0)
},
/**
* changeVisibility
* @param commit vuex commit object
* @param level visibility level string object
**/
changeVisibility ({ commit }, level) {
Object.keys(Visibility).map((key, index) => {
if (Visibility[key].name === level) {
commit('changeVisibility', Visibility[key])
}
})
}
}
}