From dc71efe43c90bef18b365cc2d200342eedd8279f Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 1 Aug 2023 01:54:55 +0900 Subject: [PATCH] feat: translate button on posts in foreign languages --- README.md | 1 + locales/en-US.yml | 1 + locales/ja-JP.yml | 1 + packages/client/package.json | 1 + packages/client/src/components/MkNote.vue | 42 ++++++++++++++++++ packages/client/src/components/MkNoteSub.vue | 43 +++++++++++++++++++ .../client/src/pages/settings/general.vue | 9 ++++ packages/client/src/store.ts | 4 ++ pnpm-lock.yaml | 9 ++++ 9 files changed, 111 insertions(+) diff --git a/README.md b/README.md index c203662d..be54d22b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ ## 主要な変更点 +- 投稿言語を自動検出して外国語の投稿に翻訳ボタンを表示する設定を追加 - モバイル表示の下部のウィジェットボタンを再読み込みボタンに変更可能に - スマートフォンでウィジェットは使わないけど再読み込みはたくさんする人はいそう - モバイル表示の下部のチャットボタンをアカウント切り替えボタンに変更可能に diff --git a/locales/en-US.yml b/locales/en-US.yml index 1ba4b75d..f6d152a2 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1142,6 +1142,7 @@ deletePasskeys: "Delete passkeys" delete2faConfirm: "This will irreversibly delete 2FA on this account. Proceed?" deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?" inputNotMatch: "Input does not match" +detectPostLanguage: "Automatically detect the language and show a translate button for non-English posts" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index f0908472..e8cf2d1c 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -995,6 +995,7 @@ forMobile: "モバイル向け" replaceChatButtonWithAccountButton: "画面下部のチャットのボタンをアカウント切り替えボタンに変更する" replaceWidgetsButtonWithReloadButton: "画面下部のウィジェットのボタンを再読み込みボタンに変更する" addRe: "閲覧注意の投稿への返信で、注釈の先頭に\"re:\"を追加する" +detectPostLanguage: "投稿の言語を自動検出し、外国語の投稿に翻訳ボタンを表示する" _sensitiveMediaDetection: description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。" diff --git a/packages/client/package.json b/packages/client/package.json index 43983c46..46aa303a 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -83,6 +83,7 @@ "three": "0.146.0", "throttle-debounce": "5.0.0", "tinycolor2": "1.6.0", + "tinyld": "1.3.4", "tsc-alias": "1.8.7", "tsconfig-paths": "4.2.0", "twemoji-parser": "14.0.0", diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index face71b6..f0a287c0 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -219,6 +219,14 @@ + +