|
1 | 1 | import { commands, window, Selection, QuickPickItem, TextEditor } from 'vscode'; |
2 | 2 | import { COMMAND_NAME, CONTEXT, SETTING_CONTENT_WYSIWYG } from '../constants'; |
3 | 3 | import { Settings } from '../helpers'; |
4 | | -import * as l10n from '@vscode/l10n'; |
5 | | -import { LocalizationKey } from '../localization'; |
| 4 | +import { LocalizationKey, localize } from '../localization'; |
6 | 5 |
|
7 | 6 | enum MarkupType { |
8 | 7 | bold = 1, |
@@ -83,45 +82,45 @@ export class Wysiwyg { |
83 | 82 | commands.registerCommand(COMMAND_NAME.options, async () => { |
84 | 83 | const qpItems: QuickPickItem[] = [ |
85 | 84 | { |
86 | | - label: `$(list-unordered) ${LocalizationKey.commandsWysiwygCommandUnorderedListLabel}`, |
87 | | - detail: LocalizationKey.commandsWysiwygCommandUnorderedListDetail, |
| 85 | + label: `$(list-unordered) ${localize(LocalizationKey.commandsWysiwygCommandUnorderedListLabel)}`, |
| 86 | + detail: localize(LocalizationKey.commandsWysiwygCommandUnorderedListDetail), |
88 | 87 | alwaysShow: true |
89 | 88 | }, |
90 | 89 | { |
91 | | - label: `$(list-ordered) ${LocalizationKey.commandsWysiwygCommandOrderedListLabel}`, |
92 | | - detail: LocalizationKey.commandsWysiwygCommandOrderedListDetail, |
| 90 | + label: `$(list-ordered) ${localize(LocalizationKey.commandsWysiwygCommandOrderedListLabel)}`, |
| 91 | + detail: localize(LocalizationKey.commandsWysiwygCommandOrderedListDetail), |
93 | 92 | alwaysShow: true |
94 | 93 | }, |
95 | 94 | { |
96 | | - label: `$(tasklist) ${LocalizationKey.commandsWysiwygCommandTaskListLabel}`, |
97 | | - detail: LocalizationKey.commandsWysiwygCommandTaskListDetail, |
| 95 | + label: `$(tasklist) ${localize(LocalizationKey.commandsWysiwygCommandTaskListLabel)}`, |
| 96 | + detail: localize(LocalizationKey.commandsWysiwygCommandTaskListDetail), |
98 | 97 | alwaysShow: true |
99 | 98 | }, |
100 | 99 | { |
101 | | - label: `$(code) ${LocalizationKey.commandsWysiwygCommandCodeLabel}`, |
102 | | - detail: LocalizationKey.commandsWysiwygCommandCodeDetail, |
| 100 | + label: `$(code) ${localize(LocalizationKey.commandsWysiwygCommandCodeLabel)}`, |
| 101 | + detail: localize(LocalizationKey.commandsWysiwygCommandCodeDetail), |
103 | 102 | alwaysShow: true |
104 | 103 | }, |
105 | 104 | { |
106 | | - label: `$(symbol-namespace) ${LocalizationKey.commandsWysiwygCommandCodeblockLabel}`, |
107 | | - detail: LocalizationKey.commandsWysiwygCommandCodeblockDetail, |
| 105 | + label: `$(symbol-namespace) ${localize(LocalizationKey.commandsWysiwygCommandCodeblockLabel)}`, |
| 106 | + detail: localize(LocalizationKey.commandsWysiwygCommandCodeblockDetail), |
108 | 107 | alwaysShow: true |
109 | 108 | }, |
110 | 109 | { |
111 | | - label: `$(quote) ${LocalizationKey.commandsWysiwygCommandBlockquoteLabel}`, |
112 | | - detail: LocalizationKey.commandsWysiwygCommandBlockquoteDetail, |
| 110 | + label: `$(quote) ${localize(LocalizationKey.commandsWysiwygCommandBlockquoteLabel)}`, |
| 111 | + detail: localize(LocalizationKey.commandsWysiwygCommandBlockquoteDetail), |
113 | 112 | alwaysShow: true |
114 | 113 | }, |
115 | 114 | { |
116 | | - label: `$(symbol-text) ${LocalizationKey.commandsWysiwygCommandStrikethroughLabel}`, |
117 | | - detail: LocalizationKey.commandsWysiwygCommandStrikethroughDetail, |
| 115 | + label: `$(symbol-text) ${localize(LocalizationKey.commandsWysiwygCommandStrikethroughLabel)}`, |
| 116 | + detail: localize(LocalizationKey.commandsWysiwygCommandStrikethroughDetail), |
118 | 117 | alwaysShow: true |
119 | 118 | } |
120 | 119 | ]; |
121 | 120 |
|
122 | 121 | const option = await window.showQuickPick([...qpItems], { |
123 | | - title: l10n.t(LocalizationKey.commandsWysiwygQuickPickTitle), |
124 | | - placeHolder: l10n.t(LocalizationKey.commandsWysiwygQuickPickPlaceholder), |
| 122 | + title: localize(LocalizationKey.commandsWysiwygQuickPickTitle), |
| 123 | + placeHolder: localize(LocalizationKey.commandsWysiwygQuickPickPlaceholder), |
125 | 124 | canPickMany: false, |
126 | 125 | ignoreFocusOut: true |
127 | 126 | }); |
@@ -211,17 +210,17 @@ export class Wysiwyg { |
211 | 210 | const linkText = hasTextSelection ? editor.document.getText(selection) : ''; |
212 | 211 |
|
213 | 212 | const link = await window.showInputBox({ |
214 | | - title: l10n.t(LocalizationKey.commandsWysiwygAddHyperlinkHyperlinkInputTitle), |
215 | | - placeHolder: l10n.t(LocalizationKey.commandsWysiwygAddHyperlinkHyperlinkInputPrompt), |
216 | | - prompt: l10n.t(LocalizationKey.commandsWysiwygAddHyperlinkHyperlinkInputPrompt), |
| 213 | + title: localize(LocalizationKey.commandsWysiwygAddHyperlinkHyperlinkInputTitle), |
| 214 | + placeHolder: localize(LocalizationKey.commandsWysiwygAddHyperlinkHyperlinkInputPrompt), |
| 215 | + prompt: localize(LocalizationKey.commandsWysiwygAddHyperlinkHyperlinkInputPrompt), |
217 | 216 | value: linkText, |
218 | 217 | ignoreFocusOut: true |
219 | 218 | }); |
220 | 219 |
|
221 | 220 | const text = await window.showInputBox({ |
222 | | - title: l10n.t(LocalizationKey.commandsWysiwygAddHyperlinkTextInputTitle), |
223 | | - prompt: l10n.t(LocalizationKey.commandsWysiwygAddHyperlinkTextInputPrompt), |
224 | | - placeHolder: l10n.t(LocalizationKey.commandsWysiwygAddHyperlinkTextInputPrompt), |
| 221 | + title: localize(LocalizationKey.commandsWysiwygAddHyperlinkTextInputTitle), |
| 222 | + prompt: localize(LocalizationKey.commandsWysiwygAddHyperlinkTextInputPrompt), |
| 223 | + placeHolder: localize(LocalizationKey.commandsWysiwygAddHyperlinkTextInputPrompt), |
225 | 224 | value: linkText, |
226 | 225 | ignoreFocusOut: true |
227 | 226 | }); |
@@ -280,8 +279,8 @@ export class Wysiwyg { |
280 | 279 | const headingLvl = await window.showQuickPick( |
281 | 280 | ['Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5', 'Heading 6'], |
282 | 281 | { |
283 | | - title: l10n.t(LocalizationKey.commandsWysiwygInsertTextHeadingInputTitle), |
284 | | - placeHolder: l10n.t(LocalizationKey.commandsWysiwygInsertTextHeadingInputPlaceholder), |
| 282 | + title: localize(LocalizationKey.commandsWysiwygInsertTextHeadingInputTitle), |
| 283 | + placeHolder: localize(LocalizationKey.commandsWysiwygInsertTextHeadingInputPlaceholder), |
285 | 284 | canPickMany: false, |
286 | 285 | ignoreFocusOut: true |
287 | 286 | } |
|
0 commit comments