From 3963ed8ff7488a0e2f7f3876461f909e6be08e25 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 23 May 2020 13:19:31 +0900 Subject: [PATCH] =?UTF-8?q?feat(client):=20=E7=BF=BB=E8=A8=B3=E3=82=92Inde?= =?UTF-8?q?xedDB=E3=81=AB=E4=BF=9D=E5=AD=98=E3=83=BB=E3=83=97=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A5=E9=80=9A=E7=9F=A5=E3=82=92=E7=BF=BB=E8=A8=B3?= =?UTF-8?q?=20(#6396)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * wip * tabun ok * better msg * oops * fix lint * Update gulpfile.ts Co-authored-by: Acid Chicken (硫酸鶏) * Update src/client/scripts/set-i18n-contexts.ts Co-authored-by: Acid Chicken (硫酸鶏) * refactor Co-authored-by: acid-chicken * ✨ * wip * fix lint * たぶんおk * fix flush * Translate Notification * remove console.log * fix * add notifications * remove san * wip * ok * :v: * Update src/prelude/array.ts Co-authored-by: Acid Chicken (硫酸鶏) * wip * i18n refactor * Update init.ts * :v: Co-authored-by: Acid Chicken (硫酸鶏) Co-authored-by: syuilo --- gulpfile.ts | 6 +- locales/ja-JP.yml | 16 +++ package.json | 2 + src/client/app.vue | 3 - src/client/components/captcha.vue | 2 - src/client/components/cw-button.vue | 3 - src/client/components/date-separated-list.vue | 3 - src/client/components/dialog.vue | 3 - src/client/components/drive-window.vue | 3 - src/client/components/drive.file.vue | 3 - src/client/components/drive.folder.vue | 3 - src/client/components/drive.nav-folder.vue | 3 - src/client/components/drive.vue | 3 - src/client/components/emoji-picker.vue | 3 - src/client/components/error.vue | 2 - src/client/components/follow-button.vue | 3 - src/client/components/google.vue | 2 - src/client/components/image-viewer.vue | 3 - src/client/components/instance-stats.vue | 3 - src/client/components/media-banner.vue | 2 - src/client/components/media-image.vue | 2 - src/client/components/media-video.vue | 2 - src/client/components/mention.vue | 2 - src/client/components/note.vue | 2 - src/client/components/notes.vue | 3 - src/client/components/notification.vue | 6 +- src/client/components/notifications.vue | 3 - src/client/components/page/page.post.vue | 2 - src/client/components/page/page.vue | 3 - src/client/components/poll-editor.vue | 2 - src/client/components/poll.vue | 2 - src/client/components/post-form-attaches.vue | 3 - src/client/components/post-form.vue | 3 - src/client/components/reaction-icon.vue | 2 - src/client/components/reaction-picker.vue | 3 - .../components/reactions-viewer.details.vue | 2 - src/client/components/remote-caution.vue | 2 - src/client/components/signin-dialog.vue | 3 - src/client/components/signin.vue | 3 - src/client/components/signup-dialog.vue | 3 - src/client/components/signup.vue | 3 - src/client/components/stream-indicator.vue | 2 - src/client/components/sub-note-content.vue | 2 - src/client/components/time.vue | 2 - src/client/components/uploader.vue | 2 - src/client/components/url-preview-popup.vue | 3 - src/client/components/url-preview.vue | 3 - src/client/components/user-list.vue | 3 - src/client/components/user-menu.vue | 3 - src/client/components/user-preview.vue | 3 - src/client/components/user-select.vue | 3 - src/client/components/users-dialog.vue | 3 - src/client/components/visibility-chooser.vue | 2 - src/client/components/window.vue | 3 - src/client/config.ts | 5 +- src/client/db.ts | 68 +++++++++++++ src/client/i18n.ts | 12 --- src/client/init.ts | 44 ++++----- src/client/pages/about-misskey.vue | 3 - src/client/pages/about.vue | 3 - src/client/pages/announcements.vue | 3 - src/client/pages/auth.form.vue | 2 - src/client/pages/auth.vue | 2 - src/client/pages/doc.vue | 3 - src/client/pages/explore.vue | 3 - src/client/pages/follow.vue | 3 - src/client/pages/index.welcome.entrance.vue | 3 - src/client/pages/index.welcome.setup.vue | 2 - src/client/pages/instance/announcements.vue | 3 - .../pages/instance/federation.instance.vue | 3 - src/client/pages/instance/federation.vue | 3 - src/client/pages/instance/index.vue | 3 - src/client/pages/instance/queue.queue.vue | 3 - src/client/pages/instance/queue.vue | 3 - src/client/pages/instance/relays.vue | 3 - src/client/pages/instance/settings.vue | 3 - src/client/pages/instance/users.user.vue | 3 - src/client/pages/messaging/index.vue | 3 - .../pages/messaging/messaging-room.form.vue | 2 - .../messaging/messaging-room.message.vue | 2 - src/client/pages/messaging/messaging-room.vue | 3 - src/client/pages/miauth.vue | 2 - .../pages/my-antennas/index.antenna.vue | 3 - src/client/pages/my-groups/group.vue | 3 - src/client/pages/my-lists/list.vue | 3 - src/client/pages/my-settings/2fa.vue | 2 - src/client/pages/my-settings/api.vue | 2 - src/client/pages/my-settings/drive.vue | 3 - .../pages/my-settings/import-export.vue | 3 - src/client/pages/my-settings/integration.vue | 3 - src/client/pages/my-settings/mute-block.vue | 3 - src/client/pages/my-settings/privacy.vue | 3 - src/client/pages/my-settings/profile.vue | 3 - src/client/pages/my-settings/reaction.vue | 3 - src/client/pages/my-settings/security.vue | 3 - src/client/pages/not-found.vue | 3 - src/client/pages/note.vue | 2 - .../page-editor/els/page-editor.el.button.vue | 3 - .../page-editor/els/page-editor.el.canvas.vue | 3 - .../els/page-editor.el.counter.vue | 3 - .../page-editor/els/page-editor.el.if.vue | 3 - .../page-editor/els/page-editor.el.image.vue | 3 - .../els/page-editor.el.number-input.vue | 3 - .../page-editor/els/page-editor.el.post.vue | 3 - .../els/page-editor.el.radio-button.vue | 2 - .../els/page-editor.el.section.vue | 3 - .../page-editor/els/page-editor.el.switch.vue | 3 - .../els/page-editor.el.text-input.vue | 3 - .../page-editor/els/page-editor.el.text.vue | 3 - .../els/page-editor.el.textarea-input.vue | 3 - .../els/page-editor.el.textarea.vue | 3 - .../page-editor/page-editor.container.vue | 3 - .../page-editor/page-editor.script-block.vue | 3 - src/client/pages/page-editor/page-editor.vue | 3 - src/client/pages/pages.vue | 2 - src/client/pages/preferences/index.vue | 22 ++++- src/client/pages/preferences/sidebar.vue | 3 - src/client/pages/preferences/theme.vue | 3 - src/client/pages/room/room.vue | 3 - src/client/pages/scratchpad.vue | 3 - src/client/pages/share.vue | 3 - src/client/pages/user/follow-list.vue | 3 - src/client/pages/user/index.photos.vue | 2 - src/client/scripts/compose-notification.ts | 97 +++++++++++++------ src/client/scripts/set-i18n-contexts.ts | 18 ++++ src/client/{sw.js => sw.ts} | 13 +-- src/client/tsconfig.json | 5 + src/client/widgets/activity.chart.vue | 2 - src/client/widgets/activity.vue | 2 - src/client/widgets/calendar.vue | 2 - src/client/widgets/memo.vue | 2 - src/client/widgets/notifications.vue | 2 - src/client/widgets/photos.vue | 2 - src/client/widgets/rss.vue | 2 - src/client/widgets/timeline.vue | 2 - src/client/widgets/trends.vue | 2 - src/misc/get-note-summary.ts | 14 +-- src/prelude/array.ts | 12 ++- src/server/web/index.ts | 3 +- src/server/web/views/flush.pug | 32 ++++-- src/services/push-notification.ts | 7 +- webpack.config.ts | 2 +- yarn.lock | 10 ++ 143 files changed, 290 insertions(+), 433 deletions(-) create mode 100644 src/client/db.ts delete mode 100644 src/client/i18n.ts create mode 100644 src/client/scripts/set-i18n-contexts.ts rename src/client/{sw.js => sw.ts} (88%) diff --git a/gulpfile.ts b/gulpfile.ts index 262c0a5030..880adb51de 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -11,7 +11,7 @@ const cleanCSS = require('gulp-clean-css'); const sass = require('gulp-dart-sass'); const fiber = require('fibers'); -const locales = require('./locales'); +const locales: { [x: string]: any } = require('./locales'); const meta = require('./package.json'); gulp.task('build:ts', () => { @@ -31,8 +31,10 @@ gulp.task('build:copy:views', () => gulp.task('build:copy:locales', cb => { fs.mkdirSync('./built/client/assets/locales', { recursive: true }); + const v = { '_version_': meta.version }; + for (const [lang, locale] of Object.entries(locales)) { - fs.writeFileSync(`./built/client/assets/locales/${lang}.${meta.version}.json`, JSON.stringify(locale), 'utf-8'); + fs.writeFileSync(`./built/client/assets/locales/${lang}.${meta.version}.json`, JSON.stringify({ ...locale, ...v }), 'utf-8'); } cb(); diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index ab293eb89d..3c7dc6640b 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -507,6 +507,8 @@ addRelay: "リレーの追加" inboxUrl: "inboxのURL" addedRelays: "追加済みのリレー" serviceworkerInfo: "プッシュ通知を行うには有効する必要があります。" +deletedNote: "削除された投稿" +invisibleNote: "非公開の投稿" _theme: explore: "テーマを探す" @@ -1102,3 +1104,17 @@ _relayStatus: requesting: "承認待ち" accepted: "承認済み" rejected: "拒否済み" + +_notification: + fileUploaded: "ファイルがアップロードされました" + youGotMention: "{name}からのメンション" + youGotReply: "{name}からのリプライ" + youGotQuote: "{name}による引用" + youRenoted: "{name}がRenoteしました" + youGotPoll: "{name}が投票しました" + youGotMessagingMessageFromUser: "{name}からのチャットがあります" + youGotMessagingMessageFromGroup: "{name}のチャットがあります" + youWereFollowed: "フォローされました" + youReceivedFollowRequest: "フォローリクエストが来ました" + yourFollowRequestAccepted: "フォローリクエストが承認されました" + youWereInvitedToGroup: "グループに招待されました" diff --git a/package.json b/package.json index 15c1478dbd..d34394d138 100644 --- a/package.json +++ b/package.json @@ -125,6 +125,7 @@ "css-loader": "3.5.3", "cssnano": "4.1.10", "dateformat": "3.0.3", + "deep-entries": "3.1.0", "diskusage": "1.1.3", "double-ended-queue": "2.1.0-0", "escape-regexp": "0.0.1", @@ -151,6 +152,7 @@ "http-proxy-agent": "4.0.1", "http-signature": "1.3.4", "https-proxy-agent": "5.0.0", + "idb-keyval": "3.2.0", "insert-text-at-cursor": "0.3.0", "is-root": "2.1.0", "is-svg": "4.2.1", diff --git a/src/client/app.vue b/src/client/app.vue index 5e7396205b..8e192d4633 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -136,15 +136,12 @@ import { faGripVertical, faChevronLeft, faHashtag, faBroadcastTower, faFireAlt, import { faBell, faEnvelope, faLaugh, faComments } from '@fortawesome/free-regular-svg-icons'; import { ResizeObserver } from '@juggle/resize-observer'; import { v4 as uuid } from 'uuid'; -import i18n from './i18n'; import { host, instanceName } from './config'; import { search } from './scripts/search'; const DESKTOP_THRESHOLD = 1100; export default Vue.extend({ - i18n, - components: { XClock: () => import('./components/header-clock.vue').then(m => m.default), MkButton: () => import('./components/ui/button.vue').then(m => m.default), diff --git a/src/client/components/captcha.vue b/src/client/components/captcha.vue index 6b1ee6f0b2..1a894d9350 100644 --- a/src/client/components/captcha.vue +++ b/src/client/components/captcha.vue @@ -7,7 +7,6 @@