Skip to content

Commit

Permalink
fix: get english text when specify default locale
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Feb 8, 2021
1 parent 2c239da commit 7796f48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/translateTimeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 7796f48

Please sign in to comment.