Skip to content

Commit 65f45a5

Browse files
committed
Implement i18n for the checkpoints command and reorganize command translation files
1 parent ad3472f commit 65f45a5

7 files changed

Lines changed: 270 additions & 21 deletions

File tree

‎apps/editor/src/commands/checkpoints-command/checkpoints-command.ts‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { WorkspaceProvider } from '../../context/providers/workspace/workspace-provider'
77
import dayjs from 'dayjs'
88
import relativeTime from 'dayjs/plugin/relativeTime'
9+
import { t } from '@/i18n'
910
import type { Checkpoint } from './types'
1011
import {
1112
create_checkpoint,
@@ -75,19 +76,18 @@ export const checkpoints_command = (params: {
7576
const quick_pick = vscode.window.createQuickPick<
7677
vscode.QuickPickItem & { id?: string; checkpoint?: Checkpoint }
7778
>()
78-
quick_pick.title = 'Checkpoints'
79-
quick_pick.placeholder =
80-
'Select a checkpoint to restore or add a new one'
79+
quick_pick.title = t('command.checkpoints.title')
80+
quick_pick.placeholder = t('command.checkpoints.placeholder')
8181
quick_pick.matchOnDetail = true
8282

8383
const clear_all_button: vscode.QuickInputButton = {
8484
iconPath: new vscode.ThemeIcon('trash'),
85-
tooltip: 'Delete all checkpoints'
85+
tooltip: t('command.checkpoints.delete-all')
8686
}
8787

8888
const close_button: vscode.QuickInputButton = {
8989
iconPath: new vscode.ThemeIcon('close'),
90-
tooltip: 'Close'
90+
tooltip: t('common.close')
9191
}
9292

9393
let notification_count = 0
@@ -102,7 +102,7 @@ export const checkpoints_command = (params: {
102102
if (temp_checkpoint_is_valid) {
103103
revert_item = {
104104
id: 'revert-last',
105-
label: '$(discard) Revert last restored checkpoint'
105+
label: `$(discard) ${t('command.checkpoints.revert-last')}`
106106
}
107107
}
108108

@@ -118,7 +118,7 @@ export const checkpoints_command = (params: {
118118
...(visible_checkpoints.length > 0
119119
? [
120120
{
121-
label: 'recently created',
121+
label: t('common.separator.recently-created'),
122122
kind: vscode.QuickPickItemKind.Separator
123123
}
124124
]
@@ -136,19 +136,21 @@ export const checkpoints_command = (params: {
136136
iconPath: new vscode.ThemeIcon(
137137
c.is_starred ? 'star-full' : 'star-empty'
138138
),
139-
tooltip: c.is_starred ? 'Unstar' : 'Star'
139+
tooltip: c.is_starred
140+
? t('common.unstar')
141+
: t('common.star')
140142
},
141143
...(c.title == 'Created by user'
142144
? [
143145
{
144146
iconPath: new vscode.ThemeIcon('edit'),
145-
tooltip: 'Edit Description'
147+
tooltip: t('command.checkpoints.edit-description')
146148
}
147149
]
148150
: []),
149151
{
150152
iconPath: new vscode.ThemeIcon('trash'),
151-
tooltip: 'Delete'
153+
tooltip: t('common.delete')
152154
}
153155
]
154156
}
@@ -161,7 +163,7 @@ export const checkpoints_command = (params: {
161163
quick_pick.items = [
162164
{
163165
id: 'add-new',
164-
label: '$(add) New checkpoint...'
166+
label: `$(add) ${t('command.checkpoints.new')}`
165167
},
166168
...(revert_item ? [revert_item] : []),
167169
...checkpoint_items
@@ -317,7 +319,10 @@ export const checkpoints_command = (params: {
317319
}
318320
if (!item.checkpoint) return
319321

320-
if (e.button.tooltip == 'Star' || e.button.tooltip == 'Unstar') {
322+
if (
323+
e.button.tooltip == t('common.star') ||
324+
e.button.tooltip == t('common.unstar')
325+
) {
321326
await toggle_checkpoint_star({
322327
context: params.context,
323328
timestamp: item.checkpoint.timestamp,
@@ -336,13 +341,13 @@ export const checkpoints_command = (params: {
336341
return
337342
}
338343

339-
if (e.button.tooltip == 'Edit Description') {
344+
if (e.button.tooltip == t('command.checkpoints.edit-description')) {
340345
notification_count++
341346
const new_description = await vscode.window.showInputBox({
342-
title: 'Description',
343-
prompt: 'Enter a description for the checkpoint',
347+
title: t('command.checkpoints.description.title'),
348+
prompt: t('command.checkpoints.description.prompt'),
344349
value: item.checkpoint.description || '',
345-
placeHolder: 'e.g. Before refactoring the main component'
350+
placeHolder: t('command.checkpoints.description.placeholder')
346351
})
347352
notification_count--
348353

@@ -374,7 +379,7 @@ export const checkpoints_command = (params: {
374379
return
375380
}
376381

377-
if (e.button.tooltip == 'Delete') {
382+
if (e.button.tooltip == t('common.delete')) {
378383
const was_restored = await delete_checkpoint_with_undo({
379384
context: params.context,
380385
checkpoint: item.checkpoint,

‎apps/editor/src/commands/generate-commit-message-command/utils/get-commit-message-config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const get_commit_message_config = async (
100100

101101
if (recent_configs.length > 0) {
102102
items.push({
103-
label: t('common.config.recently-used'),
103+
label: t('common.separator.recently-used'),
104104
kind: vscode.QuickPickItemKind.Separator
105105
})
106106
items.push(...recent_configs.map(map_config_to_item))
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
export const checkpoints = {
2+
'command.checkpoints.title': {
3+
en: 'Checkpoints',
4+
pl: 'Punkty kontrolne',
5+
'zh-cn': '检查点',
6+
ja: 'チェックポイント',
7+
'zh-tw': '檢查點',
8+
de: 'Checkpoints',
9+
es: 'Puntos de control',
10+
fr: 'Points de contrôle',
11+
'pt-br': 'Pontos de verificação',
12+
ru: 'Контрольные точки',
13+
ko: '체크포인트',
14+
it: 'Punti di controllo',
15+
tr: 'Kontrol Noktaları',
16+
cs: 'Kontrolní body',
17+
hu: 'Ellenőrzőpontok',
18+
bg: 'Контролни точки'
19+
},
20+
'command.checkpoints.placeholder': {
21+
en: 'Select a checkpoint to restore or add a new one',
22+
pl: 'Wybierz punkt kontrolny do przywrócenia lub dodaj nowy',
23+
'zh-cn': '选择要恢复的检查点或添加一个新检查点',
24+
ja: '復元するチェックポイントを選択するか、新しく追加します',
25+
'zh-tw': '選擇要還原的檢查點或新增一個檢查點',
26+
de: 'Wählen Sie einen Checkpoint zum Wiederherstellen aus oder fügen Sie einen neuen hinzu',
27+
es: 'Seleccione un punto de control para restaurar o agregue uno nuevo',
28+
fr: 'Sélectionnez un point de contrôle à restaurer ou ajoutez-en un nouveau',
29+
'pt-br':
30+
'Selecione um ponto de verificação para restaurar ou adicione um novo',
31+
ru: 'Выберите контрольную точку для восстановления или добавьте новую',
32+
ko: '복원할 체크포인트를 선택하거나 새 체크포인트를 추가하세요',
33+
it: 'Seleziona un punto di controllo da ripristinare o aggiungine uno nuovo',
34+
tr: 'Geri yüklemek için bir kontrol noktası seçin veya yeni bir tane ekleyin',
35+
cs: 'Vyberte kontrolní bod k obnovení nebo přidejte nový',
36+
hu: 'Válasszon egy ellenőrzőpontot a visszaállításhoz, vagy adjon hozzá egy újat',
37+
bg: 'Изберете контролна точка за възстановяване или добавете нова'
38+
},
39+
'command.checkpoints.delete-all': {
40+
en: 'Delete all checkpoints',
41+
pl: 'Usuń wszystkie punkty kontrolne',
42+
'zh-cn': '删除所有检查点',
43+
ja: 'すべてのチェックポイントを削除',
44+
'zh-tw': '刪除所有檢查點',
45+
de: 'Alle Checkpoints löschen',
46+
es: 'Eliminar todos los puntos de control',
47+
fr: 'Supprimer tous les points de contrôle',
48+
'pt-br': 'Excluir todos os pontos de verificação',
49+
ru: 'Удалить все контрольные точки',
50+
ko: '모든 체크포인트 삭제',
51+
it: 'Elimina tutti i punti di controllo',
52+
tr: 'Tüm kontrol noktalarını sil',
53+
cs: 'Smazat všechny kontrolní body',
54+
hu: 'Összes ellenőrzőpont törlése',
55+
bg: 'Изтриване на всички контролни точки'
56+
},
57+
'command.checkpoints.revert-last': {
58+
en: 'Revert last restored checkpoint',
59+
pl: 'Cofnij ostatnio przywrócony punkt kontrolny',
60+
'zh-cn': '撤销上次恢复的检查点',
61+
ja: '最後に復元したチェックポイントを元に戻す',
62+
'zh-tw': '撤銷上次還原的檢查點',
63+
de: 'Zuletzt wiederhergestellten Checkpoint rückgängig machen',
64+
es: 'Revertir el último punto de control restaurado',
65+
fr: 'Annuler le dernier point de contrôle restauré',
66+
'pt-br': 'Reverter o último ponto de verificação restaurado',
67+
ru: 'Отменить последнюю восстановленную контрольную точку',
68+
ko: '마지막으로 복원된 체크포인트 되돌리기',
69+
it: "Annulla l'ultimo punto di controllo ripristinato",
70+
tr: 'Son geri yüklenen kontrol noktasını geri al',
71+
cs: 'Vrátit zpět poslední obnovený kontrolní bod',
72+
hu: 'Utoljára visszaállított ellenőrzőpont visszavonása',
73+
bg: 'Отмяна на последната възстановена контролна точка'
74+
},
75+
'command.checkpoints.edit-description': {
76+
en: 'Edit Description',
77+
pl: 'Edytuj opis',
78+
'zh-cn': '编辑描述',
79+
ja: '説明を編集',
80+
'zh-tw': '編輯描述',
81+
de: 'Beschreibung bearbeiten',
82+
es: 'Editar descripción',
83+
fr: 'Modifier la description',
84+
'pt-br': 'Editar descrição',
85+
ru: 'Редактировать описание',
86+
ko: '설명 편집',
87+
it: 'Modifica descrizione',
88+
tr: 'Açıklamayı Düzenle',
89+
cs: 'Upravit popis',
90+
hu: 'Leírás szerkesztése',
91+
bg: 'Редактиране на описанието'
92+
},
93+
'command.checkpoints.new': {
94+
en: 'New checkpoint...',
95+
pl: 'Nowy punkt kontrolny...',
96+
'zh-cn': '新检查点...',
97+
ja: '新しいチェックポイント...',
98+
'zh-tw': '新檢查點...',
99+
de: 'Neuer Checkpoint...',
100+
es: 'Nuevo punto de control...',
101+
fr: 'Nouveau point de contrôle...',
102+
'pt-br': 'Novo ponto de verificação...',
103+
ru: 'Новая контрольная точка...',
104+
ko: '새 체크포인트...',
105+
it: 'Nuovo punto di controllo...',
106+
tr: 'Yeni kontrol noktası...',
107+
cs: 'Nový kontrolní bod...',
108+
hu: 'Új ellenőrzőpont...',
109+
bg: 'Нова контролна точка...'
110+
},
111+
'command.checkpoints.description.title': {
112+
en: 'Description',
113+
pl: 'Opis',
114+
'zh-cn': '描述',
115+
ja: '説明',
116+
'zh-tw': '描述',
117+
de: 'Beschreibung',
118+
es: 'Descripción',
119+
fr: 'Description',
120+
'pt-br': 'Descripción',
121+
ru: 'Описание',
122+
ko: '설명',
123+
it: 'Descrizione',
124+
tr: 'Açıklama',
125+
cs: 'Popis',
126+
hu: 'Leírás',
127+
bg: 'Описание'
128+
},
129+
'command.checkpoints.description.prompt': {
130+
en: 'Enter a description for the checkpoint',
131+
pl: 'Wprowadź opis dla punktu kontrolnego',
132+
'zh-cn': '输入检查点的描述',
133+
ja: 'チェックポイントの説明を入力してください',
134+
'zh-tw': '輸入檢查點的描述',
135+
de: 'Geben Sie eine Beschreibung für den Checkpoint ein',
136+
es: 'Ingrese una descripción para el punto de control',
137+
fr: 'Entrez une description pour le point de contrôle',
138+
'pt-br': 'Insira uma descrição para o ponto de verificação',
139+
ru: 'Введите описание для контрольной точки',
140+
ko: '체크포인트에 대한 설명을 입력하세요',
141+
it: 'Inserisci una descrizione per il punto di controllo',
142+
tr: 'Kontrol noktası için bir açıklama girin',
143+
cs: 'Zadejte popis pro kontrolní bod',
144+
hu: 'Adja meg az ellenőrzőpont leírását',
145+
bg: 'Въведете описание за контролната точка'
146+
},
147+
'command.checkpoints.description.placeholder': {
148+
en: 'e.g. Before refactoring the main component',
149+
pl: 'np. Przed refaktoryzacją głównego komponentu',
150+
'zh-cn': '例如:在重构主组件之前',
151+
ja: '例: メインコンポーネントのリファクタリング前',
152+
'zh-tw': '例如:在重構主組件之前',
153+
de: 'z.B. Vor dem Refactoring der Hauptkomponente',
154+
es: 'ej. Antes de refactorizar el componente principal',
155+
fr: 'ex. Avant de refactoriser le composant principal',
156+
'pt-br': 'ex. Antes de refatorar o componente principal',
157+
ru: 'напр. Перед рефакторингом главного компонента',
158+
ko: '예: 메인 컴포넌트 리팩토링 전',
159+
it: 'es. Prima del refactoring del componente principale',
160+
tr: 'örn. Ana bileşeni yeniden düzenlemeden önce',
161+
cs: 'např. Před refaktorizací hlavní komponenty',
162+
hu: 'pl. A fő komponens refaktorálása előtt',
163+
bg: 'напр. Преди рефакториране на главния компонент'
164+
}
165+
} as const

apps/editor/src/i18n/translations/commands.ts renamed to apps/editor/src/i18n/translations/commands/generate-commit-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const commands = {
1+
export const generate_commit_message = {
22
'command.commit-message.input.title': {
33
en: 'Commit Message',
44
pl: 'Wiadomość commita',
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { checkpoints } from './checkpoints'
2+
import { generate_commit_message } from './generate-commit-message'
3+
4+
export const commands = {
5+
...checkpoints,
6+
...generate_commit_message
7+
}

‎apps/editor/src/i18n/translations/common.ts‎

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const common = {
8989
hu: 'gondolkodás...',
9090
bg: 'мислене...'
9191
},
92-
'common.config.recently-used': {
92+
'common.separator.recently-used': {
9393
en: 'recently used',
9494
pl: 'ostatnio używane',
9595
'zh-cn': '最近使用',
@@ -160,5 +160,77 @@ export const common = {
160160
cs: 'Vyberte konfiguraci',
161161
hu: 'Válasszon konfigurációt',
162162
bg: 'Изберете конфигурация'
163+
},
164+
'common.separator.recently-created': {
165+
en: 'recently created',
166+
pl: 'ostatnio utworzone',
167+
'zh-cn': '最近创建',
168+
ja: '最近作成された項目',
169+
'zh-tw': '最近建立',
170+
de: 'kürzlich erstellt',
171+
es: 'creado recientemente',
172+
fr: 'récemment créé',
173+
'pt-br': 'criado recentemente',
174+
ru: 'недавно созданные',
175+
ko: '최근 생성됨',
176+
it: 'creato di recente',
177+
tr: 'yeni oluşturuldu',
178+
cs: 'nedávno vytvořené',
179+
hu: 'nemrég létrehozva',
180+
bg: 'наскоро създадени'
181+
},
182+
'common.unstar': {
183+
en: 'Unstar',
184+
pl: 'Usuń z ulubionych',
185+
'zh-cn': '取消星标',
186+
ja: 'スターを外す',
187+
'zh-tw': '取消星標',
188+
de: 'Markierung aufheben',
189+
es: 'Desmarcar',
190+
fr: 'Retirer des favoris',
191+
'pt-br': 'Remover estrela',
192+
ru: 'Снять отметку',
193+
ko: '별표 해제',
194+
it: 'Rimuovi dai preferiti',
195+
tr: 'Yıldızı Kaldır',
196+
cs: 'Odebrat hvězdičku',
197+
hu: 'Csillag eltávolítása',
198+
bg: 'Премахване на звездата'
199+
},
200+
'common.star': {
201+
en: 'Star',
202+
pl: 'Dodaj do ulubionych',
203+
'zh-cn': '星标',
204+
ja: 'スターをつける',
205+
'zh-tw': '星標',
206+
de: 'Markieren',
207+
es: 'Marcar',
208+
fr: 'Ajouter aux favoris',
209+
'pt-br': 'Marcar com estrela',
210+
ru: 'Отметить',
211+
ko: '별표',
212+
it: 'Aggiungi ai preferiti',
213+
tr: 'Yıldızla',
214+
cs: 'Přidat hvězdičku',
215+
hu: 'Csillagozás',
216+
bg: 'Добавяне на звезда'
217+
},
218+
'common.delete': {
219+
en: 'Delete',
220+
pl: 'Usuń',
221+
'zh-cn': '删除',
222+
ja: '削除',
223+
'zh-tw': '刪除',
224+
de: 'Löschen',
225+
es: 'Eliminar',
226+
fr: 'Supprimer',
227+
'pt-br': 'Excluir',
228+
ru: 'Удалить',
229+
ko: '삭제',
230+
it: 'Elimina',
231+
tr: 'Sil',
232+
cs: 'Smazat',
233+
hu: 'Törlés',
234+
bg: 'Изтриване'
163235
}
164236
} as const

0 commit comments

Comments
 (0)