Skip to content

Commit fb01034

Browse files
committed
Internationalize configuration quick pick labels and tooltips using the i18n translation utility
- should use [Fragment]
1 parent e4ea009 commit fb01034

7 files changed

Lines changed: 35 additions & 28 deletions

File tree

‎apps/editor/src/utils/intelligent-update-utils.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { cleanup_api_response } from './cleanup-api-response'
1313
import { intelligent_update_instructions } from '../constants/instructions'
1414
import { dictionary } from '@shared/constants/dictionary'
1515
import { apply_reasoning_effort } from './apply-reasoning-effort'
16+
import { t } from '@/i18n'
1617

1718
export const get_intelligent_update_config = async ( // Note: Kept original name exported due to external dependencies or index.ts exports, but updating return type. Wait, the prompt allowed renaming variables, I will rename it in callers. I renamed it where possible.
1819
api_providers_manager: ModelProvidersManager,
@@ -88,7 +89,7 @@ export const get_intelligent_update_config = async ( // Note: Kept original name
8889

8990
if (matched_recent_api_configurations.length > 0) {
9091
items.push({
91-
label: 'recently used',
92+
label: t('common.separator.recently-used'),
9293
kind: vscode.QuickPickItemKind.Separator
9394
})
9495
items.push(...matched_recent_api_configurations.map(map_api_configuration_to_item))
@@ -97,7 +98,7 @@ export const get_intelligent_update_config = async ( // Note: Kept original name
9798
if (remaining_api_configurations.length > 0) {
9899
if (matched_recent_api_configurations.length > 0) {
99100
items.push({
100-
label: 'other configurations',
101+
label: t('common.config.other'),
101102
kind: vscode.QuickPickItemKind.Separator
102103
})
103104
}
@@ -111,11 +112,11 @@ export const get_intelligent_update_config = async ( // Note: Kept original name
111112
quick_pick.buttons = [
112113
{
113114
iconPath: new vscode.ThemeIcon('close'),
114-
tooltip: 'Close'
115+
tooltip: t('common.close')
115116
}
116117
]
117118
quick_pick.items = create_items()
118-
quick_pick.title = 'Configurations'
119+
quick_pick.title = t('common.config.title')
119120
quick_pick.placeholder =
120121
'Select the Intelligent Update API tool configuration'
121122
quick_pick.matchOnDescription = true
@@ -136,7 +137,7 @@ export const get_intelligent_update_config = async ( // Note: Kept original name
136137
return new Promise<{ model_provider: ModelProvider; api_configuration: ApiConfiguration } | undefined>(
137138
(resolve) => {
138139
quick_pick.onDidTriggerButton((button) => {
139-
if (button.tooltip == 'Close') {
140+
if (button.tooltip == t('common.close')) {
140141
quick_pick.hide()
141142
resolve(undefined)
142143
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-code-at-cursor.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { randomUUID } from 'crypto'
1818
import { build_user_content } from '@/utils/build-user-content'
1919
import { replace_symbols } from '@/views/panel/backend/utils/symbols/replace-symbols'
2020
import { split_recent_and_rest_configurations } from '@/views/panel/backend/utils/split-recent-and-rest-configurations'
21+
import { t } from '@/i18n'
2122

2223
const get_code_at_cursor_api_configuration = async (
2324
api_providers_manager: ModelProvidersManager,
@@ -109,7 +110,7 @@ const get_code_at_cursor_api_configuration = async (
109110

110111
if (recent_api_configurations.length > 0) {
111112
items.push({
112-
label: 'recently used',
113+
label: t('common.separator.recently-used'),
113114
kind: vscode.QuickPickItemKind.Separator
114115
})
115116
items.push(...recent_api_configurations.map(map_api_configuration_to_item))
@@ -118,7 +119,7 @@ const get_code_at_cursor_api_configuration = async (
118119
if (other_api_configurations.length > 0) {
119120
if (recent_api_configurations.length > 0) {
120121
items.push({
121-
label: 'other API configurations',
122+
label: t('common.config.other'),
122123
kind: vscode.QuickPickItemKind.Separator
123124
})
124125
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { default_system_instructions } from '@shared/constants/default-system-in
2727
import { build_user_content } from '@/utils/build-user-content'
2828
import { replace_symbols } from '@/views/panel/backend/utils/symbols/replace-symbols'
2929
import { split_recent_and_rest_configurations } from '@/views/panel/backend/utils/split-recent-and-rest-configurations'
30+
import { t } from '@/i18n'
3031

3132
const get_edit_context_api_configuration = async (params: {
3233
api_providers_manager: ModelProvidersManager
@@ -131,7 +132,7 @@ const get_edit_context_api_configuration = async (params: {
131132

132133
if (recent_api_configurations.length > 0) {
133134
items.push({
134-
label: 'recently used',
135+
label: t('common.separator.recently-used'),
135136
kind: vscode.QuickPickItemKind.Separator
136137
})
137138
items.push(...recent_api_configurations.map(map_api_configuration_to_item))
@@ -140,7 +141,7 @@ const get_edit_context_api_configuration = async (params: {
140141
if (other_api_configurations.length > 0) {
141142
if (recent_api_configurations.length > 0) {
142143
items.push({
143-
label: 'other configurations',
144+
label: t('common.config.other'),
144145
kind: vscode.QuickPickItemKind.Separator
145146
})
146147
}
@@ -152,13 +153,13 @@ const get_edit_context_api_configuration = async (params: {
152153

153154
const quick_pick = vscode.window.createQuickPick<Item>()
154155
quick_pick.items = await create_items()
155-
quick_pick.title = 'Configurations'
156+
quick_pick.title = t('common.config.title')
156157
quick_pick.placeholder = 'Select a configuration'
157158
quick_pick.matchOnDescription = true
158159
quick_pick.buttons = [
159160
{
160161
iconPath: new vscode.ThemeIcon('close'),
161-
tooltip: 'Close'
162+
tooltip: t('common.close')
162163
}
163164
]
164165

@@ -185,7 +186,7 @@ const get_edit_context_api_configuration = async (params: {
185186
let accepted = false
186187

187188
quick_pick.onDidTriggerButton((button) => {
188-
if (button.tooltip == 'Close') {
189+
if (button.tooltip == t('common.close')) {
189190
resolve(undefined)
190191
quick_pick.hide()
191192
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-find-relevant-files.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import { build_user_content } from '@/utils/build-user-content'
2424
import { replace_symbols } from '@/views/panel/backend/utils/symbols/replace-symbols'
2525
import { split_recent_and_rest_configurations } from '@/views/panel/backend/utils/split-recent-and-rest-configurations'
26+
import { t } from '@/i18n'
2627

2728
const get_find_relevant_files_api_configuration = async (params: {
2829
api_providers_manager: ModelProvidersManager
@@ -127,7 +128,7 @@ const get_find_relevant_files_api_configuration = async (params: {
127128

128129
if (recent_api_configurations.length > 0) {
129130
items.push({
130-
label: 'recently used',
131+
label: t('common.separator.recently-used'),
131132
kind: vscode.QuickPickItemKind.Separator
132133
})
133134
items.push(...recent_api_configurations.map(map_api_configuration_to_item))
@@ -136,7 +137,7 @@ const get_find_relevant_files_api_configuration = async (params: {
136137
if (other_api_configurations.length > 0) {
137138
if (recent_api_configurations.length > 0) {
138139
items.push({
139-
label: 'other API configurations',
140+
label: t('common.config.other'),
140141
kind: vscode.QuickPickItemKind.Separator
141142
})
142143
}
@@ -148,13 +149,13 @@ const get_find_relevant_files_api_configuration = async (params: {
148149

149150
const quick_pick = vscode.window.createQuickPick<Item>()
150151
quick_pick.items = await create_items()
151-
quick_pick.title = 'Configurations'
152+
quick_pick.title = t('common.config.title')
152153
quick_pick.placeholder = 'Select a configuration'
153154
quick_pick.matchOnDescription = true
154155
quick_pick.buttons = [
155156
{
156157
iconPath: new vscode.ThemeIcon('close'),
157-
tooltip: 'Close'
158+
tooltip: t('common.close')
158159
}
159160
]
160161

@@ -181,7 +182,7 @@ const get_find_relevant_files_api_configuration = async (params: {
181182
let accepted = false
182183

183184
quick_pick.onDidTriggerButton((button) => {
184-
if (button.tooltip == 'Close') {
185+
if (button.tooltip == t('common.close')) {
185186
resolve(undefined)
186187
quick_pick.hide()
187188
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-send-to-browser.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
import { handle_update_last_used_web_configuration_or_group } from './handle-update-last-used-web-configuration-or-group'
2525
import { replace_symbols } from '@/views/panel/backend/utils/symbols/replace-symbols'
2626
import { split_recent_and_rest_configurations } from '@/views/panel/backend/utils/split-recent-and-rest-configurations'
27+
import { t } from '@/i18n'
2728

2829
export const handle_send_to_browser = async (params: {
2930
panel_provider: PanelProvider
@@ -276,7 +277,7 @@ const show_web_configuration_quick_pick = async (params: {
276277

277278
if (matched_recent.length > 0) {
278279
items.push({
279-
label: 'recently used',
280+
label: t('common.separator.recently-used'),
280281
kind: vscode.QuickPickItemKind.Separator
281282
})
282283
items.push(...matched_recent.map(map_web_configuration_to_item))
@@ -285,7 +286,7 @@ const show_web_configuration_quick_pick = async (params: {
285286
if (remaining.length > 0) {
286287
if (matched_recent.length > 0) {
287288
items.push({
288-
label: 'other configurations',
289+
label: t('common.config.other'),
289290
kind: vscode.QuickPickItemKind.Separator
290291
})
291292
}
@@ -294,12 +295,12 @@ const show_web_configuration_quick_pick = async (params: {
294295

295296
quick_pick.items = items
296297
quick_pick.placeholder = 'Select a configuration'
297-
quick_pick.title = 'Configurations'
298+
quick_pick.title = t('common.config.title')
298299
quick_pick.matchOnDescription = true
299300

300301
const close_button = {
301302
iconPath: new vscode.ThemeIcon('close'),
302-
tooltip: 'Close'
303+
tooltip: t('common.close')
303304
}
304305
quick_pick.buttons = [close_button]
305306

‎apps/editor/src/views/panel/backend/message-handlers/handle-show-prompt-template-quick-pick.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { PanelProvider } from '@/views/panel/backend/panel-provider'
33
import { MODE } from '@/views/panel/types/main-view-mode'
44
import { ApiPromptType, WebPromptType } from '@shared/types/prompt-types'
55
import { dictionary } from '@shared/constants/dictionary'
6+
import { t } from '@/i18n'
67

78
type PromptTemplate = {
89
name?: string
@@ -58,7 +59,7 @@ export const handle_show_prompt_template_quick_pick = async (
5859
templates_quick_pick.placeholder =
5960
'Select a prompt template or create a new one'
6061
templates_quick_pick.buttons = [
61-
{ iconPath: new vscode.ThemeIcon('close'), tooltip: 'Close' }
62+
{ iconPath: new vscode.ThemeIcon('close'), tooltip: t('common.close') }
6263
]
6364

6465
const edit_button = {
@@ -88,7 +89,7 @@ export const handle_show_prompt_template_quick_pick = async (
8889
if (templates.length > 0) {
8990
if (!search_value) {
9091
items.push({
91-
label: 'recently used',
92+
label: t('common.separator.recently-used'),
9293
kind: vscode.QuickPickItemKind.Separator
9394
})
9495
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-voice-input.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { make_api_request } from '@/utils/make-api-request'
1414
import { voice_input_instructions } from '@/constants/instructions'
1515
import { RECENTLY_USED_VOICE_INPUT_CONFIG_IDS_STATE_KEY } from '@/constants/state-keys'
1616
import { split_recent_and_rest_configurations } from '@/views/panel/backend/utils/split-recent-and-rest-configurations'
17+
import { t } from '@/i18n'
1718

1819
const MIN_RECORDING_DURATION = 1000
1920

@@ -95,7 +96,7 @@ const stop_recording = async (panel_provider: PanelProvider) => {
9596

9697
if (matched_recent_api_configurations.length > 0) {
9798
items.push({
98-
label: 'recently used',
99+
label: t('common.separator.recently-used'),
99100
kind: vscode.QuickPickItemKind.Separator
100101
})
101102
items.push(...matched_recent_api_configurations.map(map_api_configuration_to_item))
@@ -104,7 +105,7 @@ const stop_recording = async (panel_provider: PanelProvider) => {
104105
if (remaining_api_configurations.length > 0) {
105106
if (matched_recent_api_configurations.length > 0) {
106107
items.push({
107-
label: 'other configurations',
108+
label: t('common.config.other'),
108109
kind: vscode.QuickPickItemKind.Separator
109110
})
110111
}
@@ -113,12 +114,12 @@ const stop_recording = async (panel_provider: PanelProvider) => {
113114

114115
const quick_pick = vscode.window.createQuickPick()
115116
quick_pick.items = items
116-
quick_pick.title = 'Configurations'
117+
quick_pick.title = t('common.config.title')
117118
quick_pick.placeholder = 'Select a configuration'
118119
quick_pick.buttons = [
119120
{
120121
iconPath: new vscode.ThemeIcon('close'),
121-
tooltip: 'Close'
122+
tooltip: t('common.close')
122123
}
123124
]
124125

@@ -130,7 +131,7 @@ const stop_recording = async (panel_provider: PanelProvider) => {
130131
| undefined
131132
>((resolve) => {
132133
quick_pick.onDidTriggerButton((button) => {
133-
if (button.tooltip == 'Close') {
134+
if (button.tooltip == t('common.close')) {
134135
resolve(undefined)
135136
quick_pick.hide()
136137
}

0 commit comments

Comments
 (0)