1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-23 22:56:53 +09:00

enhance(backend): 「内容を隠す」に設定されたノートの注釈も翻訳に含まれる

This commit is contained in:
NoriDev 2023-10-02 00:24:01 +09:00
parent d08c12b496
commit f7b3467981
2 changed files with 4 additions and 3 deletions

View File

@ -39,6 +39,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
### Server ### Server
- 이모티콘 중복 체크 (misskey-dev/misskey#11941) - 이모티콘 중복 체크 (misskey-dev/misskey#11941)
- Enhance: '내용 숨기기'로 설정된 노트의 주석도 번역에 포함됨
--- ---

View File

@ -103,12 +103,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (instance.deeplAuthKey == null) { if (instance.deeplAuthKey == null) {
return 204; // TODO: 良い感じのエラー返す return 204; // TODO: 良い感じのエラー返す
} }
translationResult = await this.translateDeepL(note.text, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType); translationResult = await this.translateDeepL((note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType);
} else if (instance.translatorType === 'google_no_api') { } else if (instance.translatorType === 'google_no_api') {
let targetLang = ps.targetLang; let targetLang = ps.targetLang;
if (targetLang.includes('-')) targetLang = targetLang.split('-')[0]; if (targetLang.includes('-')) targetLang = targetLang.split('-')[0];
const { text, raw } = await translate(note.text, { to: targetLang }); const { text, raw } = await translate((note.cw ? note.cw + '\n' : '') + note.text, { to: targetLang });
return { return {
sourceLang: raw.src, sourceLang: raw.src,
@ -119,7 +119,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (instance.ctav3SaKey == null) { return 204; } else if (instance.ctav3ProjectId == null) { return 204; } if (instance.ctav3SaKey == null) { return 204; } else if (instance.ctav3ProjectId == null) { return 204; }
else if (instance.ctav3Location == null) { return 204; } else if (instance.ctav3Location == null) { return 204; }
translationResult = await this.apiCloudTranslationAdvanced( translationResult = await this.apiCloudTranslationAdvanced(
note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType, (note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
); );
} else { } else {
throw new Error('Unsupported translator type'); throw new Error('Unsupported translator type');