feat(translate): add translation presets and custom instructions
This commit is contained in:
1 parent
cebce0915f
commit
18ba92a6e3
9 files changed
+172
-8
No files matched your search
@@ -0,0 +1,59 @@
|
||||
// SPDX-FileCopyrightText: 2026 Tri Vo Khac
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "translationpresets.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
namespace TranslationPresets
|
||||
{
|
||||
const QList<Preset> &all()
|
||||
{
|
||||
static const QList<Preset> presets{
|
||||
{
|
||||
u"general"_s,
|
||||
i18nc("@item:inlistbox translation preset", "General"),
|
||||
u"Keep names as they are conventionally rendered and use a natural, conversational tone appropriate to the scene."_s,
|
||||
},
|
||||
{
|
||||
u"chinese-donghua"_s,
|
||||
i18nc("@item:inlistbox translation preset", "Chinese animation / wuxia / xianxia"),
|
||||
u"For Chinese animation, wuxia, xianxia, and historical settings, the source is often an English subtitle with pinyin names. When translating into Vietnamese, convert Chinese personal names, place names, sect and clan names, techniques, and cultivation terms into their Sino-Vietnamese (Hán-Việt) forms (for example, Xiao Yan → Tiêu Viêm, Dou Qi → Đấu Khí, Sect Master → Tông chủ). For other target languages, use that language's conventional rendering. Be consistent and prefer well-known established renderings from famous works. When translating into Vietnamese, use period-appropriate forms of address such as ta/ngươi, huynh/đệ, sư phụ, and tiền bối."_s,
|
||||
},
|
||||
{
|
||||
u"japanese-anime"_s,
|
||||
i18nc("@item:inlistbox translation preset", "Japanese anime"),
|
||||
u"Keep Japanese names in romaji. Keep honorifics such as -san, -kun, and -senpai as-is. Use a natural, casual tone."_s,
|
||||
},
|
||||
{
|
||||
u"korean-drama"_s,
|
||||
i18nc("@item:inlistbox translation preset", "Korean drama"),
|
||||
u"Keep Korean names. Use modern forms of address that fit the relationships; when translating into Vietnamese, use forms such as anh/em, and oppa may be kept when appropriate."_s,
|
||||
},
|
||||
{
|
||||
u"western"_s,
|
||||
i18nc("@item:inlistbox translation preset", "Western"),
|
||||
u"Keep names. Use a neutral modern tone and adapt idioms naturally for the target language."_s,
|
||||
},
|
||||
{
|
||||
u"documentary"_s,
|
||||
i18nc("@item:inlistbox translation preset", "Documentary"),
|
||||
u"Keep names. Use a formal, precise tone and translate terminology accurately."_s,
|
||||
},
|
||||
};
|
||||
return presets;
|
||||
}
|
||||
|
||||
const Preset &find(const QString &id)
|
||||
{
|
||||
const auto &presets = all();
|
||||
for (const Preset &preset : presets) {
|
||||
if (preset.id == id) {
|
||||
return preset;
|
||||
}
|
||||
}
|
||||
return presets.constFirst();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user