From 55dd63f54661a68c58842968bab99720df75e946 Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Mon, 21 Nov 2022 09:33:04 +0800 Subject: [PATCH] feat: add option to disable translate individually (#123) Co-authored-by: Shigma --- src/index.ts | 3 ++- src/locales/zh-CN.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 232c392..b63bd68 100644 --- a/src/index.ts +++ b/src/index.ts @@ -101,6 +101,7 @@ export function apply(ctx: Context, config: Config) { .option('noise', '-n ', { hidden: restricted }) .option('strength', '-N ', { hidden: restricted }) .option('undesired', '-u ') + .option('noTranslator', '-T', { hidden: () => !ctx.translator || !config.translator }) .action(async ({ session, options }, input) => { if (!input?.trim()) return session.execute('help novelai') @@ -125,7 +126,7 @@ export function apply(ctx: Context, config: Config) { delete options.steps } - if (config.translator && ctx.translator) { + if (config.translator && ctx.translator && !options.noTranslator) { try { input = await ctx.translator.translate({ input, target: 'en' }) } catch (err) { diff --git a/src/locales/zh-CN.yml b/src/locales/zh-CN.yml index 2d4cbcf..dbb80ac 100644 --- a/src/locales/zh-CN.yml +++ b/src/locales/zh-CN.yml @@ -17,6 +17,7 @@ commands: strength: 图片修改幅度 noise: 图片噪声强度 undesired: 排除标签 + noTranslator: 禁用自动翻译 messages: expect-prompt: 请输入标签。