From 7796f48dbffdbe52e8dbf4ea3e28f9d5036ff559 Mon Sep 17 00:00:00 2001 From: Maiko Tan Date: Mon, 8 Feb 2021 21:34:44 +0800 Subject: [PATCH] fix: get english text when specify default locale --- src/translateTimeline.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/translateTimeline.ts b/src/translateTimeline.ts index 69ed250..85fbdcd 100644 --- a/src/translateTimeline.ts +++ b/src/translateTimeline.ts @@ -224,7 +224,7 @@ export const translateTimeline = async () => { let locale = vscode.workspace.getConfiguration().get("cactbot.timeline.defaultLocale"); if (!(typeof locale === "string" && locale)) { - locale = await vscode.window.showQuickPick( + locale = (await vscode.window.showQuickPick( [ { label: 'de', @@ -256,14 +256,14 @@ export const translateTimeline = async () => { placeHolder: 'Input a locale...', canPickMany: false, } - ); + ))?.label; } if (!locale) { return; } - const uri = vscode.Uri.parse('cactbot-timeline:' + filename + "?" + (locale as vscode.QuickPickItem).label); + const uri = vscode.Uri.parse('cactbot-timeline:' + filename + "?" + locale); const translatedDocument = await vscode.workspace.openTextDocument(uri); // calls back into the provider await vscode.window.showTextDocument(translatedDocument, { preview: true }); await vscode.languages.setTextDocumentLanguage(translatedDocument, "cactbot-timeline");