@difizen/libro-jupyter 0.2.35 → 0.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/es/config/config.js +13 -13
  2. package/es/file/file-command.d.ts.map +1 -1
  3. package/es/file/file-command.js +74 -10
  4. package/es/file/file-create-modal.d.ts.map +1 -1
  5. package/es/file/file-create-modal.js +11 -10
  6. package/es/file/file-createdir-modal.d.ts.map +1 -1
  7. package/es/file/file-createdir-modal.js +9 -8
  8. package/es/file/file-icon.d.ts.map +1 -1
  9. package/es/file/file-icon.js +3 -5
  10. package/es/file/file-rename-modal.d.ts.map +1 -1
  11. package/es/file/file-rename-modal.js +6 -5
  12. package/es/file/file-service.d.ts.map +1 -1
  13. package/es/file/file-service.js +3 -2
  14. package/es/file/file-view/index.d.ts.map +1 -1
  15. package/es/file/file-view/index.js +8 -3
  16. package/es/file/utils.d.ts.map +1 -1
  17. package/es/file/utils.js +5 -4
  18. package/es/keybind-instructions/keybind-instructions-items.js +33 -31
  19. package/es/keybind-instructions/keybind-instructions-view.d.ts.map +1 -1
  20. package/es/keybind-instructions/keybind-instructions-view.js +48 -48
  21. package/es/libro-jupyter-protocol.d.ts.map +1 -1
  22. package/es/libro-jupyter-protocol.js +12 -13
  23. package/es/toolbar/index.less +1 -1
  24. package/es/toolbar/kernel-status-and-selector.d.ts.map +1 -1
  25. package/es/toolbar/kernel-status-and-selector.js +3 -3
  26. package/es/toolbar/run-selector.d.ts.map +1 -1
  27. package/es/toolbar/run-selector.js +1 -1
  28. package/es/toolbar/side-toolbar-run-selector.d.ts.map +1 -1
  29. package/es/toolbar/side-toolbar-run-selector.js +38 -38
  30. package/es/toolbar/toolbar-contribution.js +9 -7
  31. package/package.json +7 -7
  32. package/src/config/config.ts +13 -13
  33. package/src/file/file-command.tsx +24 -8
  34. package/src/file/file-create-modal.tsx +14 -11
  35. package/src/file/file-createdir-modal.tsx +9 -8
  36. package/src/file/file-icon.tsx +0 -1
  37. package/src/file/file-rename-modal.tsx +6 -5
  38. package/src/file/file-service.ts +3 -2
  39. package/src/file/file-view/index.tsx +6 -3
  40. package/src/file/utils.ts +5 -4
  41. package/src/keybind-instructions/keybind-instructions-items.tsx +31 -31
  42. package/src/keybind-instructions/keybind-instructions-view.tsx +66 -63
  43. package/src/libro-jupyter-protocol.ts +12 -13
  44. package/src/toolbar/index.less +1 -1
  45. package/src/toolbar/kernel-status-and-selector.tsx +3 -4
  46. package/src/toolbar/run-selector.tsx +3 -2
  47. package/src/toolbar/side-toolbar-run-selector.tsx +38 -40
  48. package/src/toolbar/toolbar-contribution.tsx +2 -2
@@ -13,7 +13,7 @@ export interface DataType {
13
13
  export class LibroKeybindItems {
14
14
  commandModeActionColumns: ColumnsType<DataType> = [
15
15
  {
16
- title: l10n.t('命令态操作'),
16
+ title: () => l10n.t('命令态操作'),
17
17
  dataIndex: 'actionDescription',
18
18
  width: '125px',
19
19
  },
@@ -49,7 +49,7 @@ export class LibroKeybindItems {
49
49
  },
50
50
  {
51
51
  key: '2',
52
- actionDescription: l10n.t('运行选中cell'),
52
+ actionDescription: l10n.t('运行选中 Cell'),
53
53
  keybind: (
54
54
  <>
55
55
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -59,7 +59,7 @@ export class LibroKeybindItems {
59
59
  },
60
60
  {
61
61
  key: '3',
62
- actionDescription: l10n.t('运行并选择下一个cell'),
62
+ actionDescription: l10n.t('运行并选择下一个 Cell'),
63
63
  keybind: (
64
64
  <>
65
65
  <Tag>Shift</Tag>
@@ -69,7 +69,7 @@ export class LibroKeybindItems {
69
69
  },
70
70
  {
71
71
  key: '4',
72
- actionDescription: l10n.t('运行并新增cell'),
72
+ actionDescription: l10n.t('运行并新增 Cell'),
73
73
  keybind: (
74
74
  <>
75
75
  <Tag>{isMacintosh ? 'Option' : 'Alt'}</Tag>
@@ -79,7 +79,7 @@ export class LibroKeybindItems {
79
79
  },
80
80
  {
81
81
  key: '5',
82
- actionDescription: l10n.t('隐藏Code'),
82
+ actionDescription: l10n.t('隐藏 Code'),
83
83
  keybind: (
84
84
  <>
85
85
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -89,7 +89,7 @@ export class LibroKeybindItems {
89
89
  },
90
90
  {
91
91
  key: '6',
92
- actionDescription: l10n.t('隐藏Output'),
92
+ actionDescription: l10n.t('隐藏 Output'),
93
93
  keybind: (
94
94
  <>
95
95
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -99,7 +99,7 @@ export class LibroKeybindItems {
99
99
  },
100
100
  {
101
101
  key: '7',
102
- actionDescription: l10n.t('切分cell'),
102
+ actionDescription: l10n.t('切分 Cell'),
103
103
  keybind: (
104
104
  <>
105
105
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -287,7 +287,7 @@ export class LibroKeybindItems {
287
287
  },
288
288
  {
289
289
  key: '2',
290
- actionDescription: l10n.t('运行选中cell'),
290
+ actionDescription: l10n.t('运行选中 Cell'),
291
291
  keybind: (
292
292
  <>
293
293
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -297,7 +297,7 @@ export class LibroKeybindItems {
297
297
  },
298
298
  {
299
299
  key: '3',
300
- actionDescription: l10n.t('运行并选择下一个cell'),
300
+ actionDescription: l10n.t('运行并选择下一个 Cell'),
301
301
  keybind: (
302
302
  <>
303
303
  <Tag>Shift</Tag>
@@ -307,7 +307,7 @@ export class LibroKeybindItems {
307
307
  },
308
308
  {
309
309
  key: '4',
310
- actionDescription: l10n.t('运行并新增cell'),
310
+ actionDescription: l10n.t('运行并新增 Cell'),
311
311
  keybind: (
312
312
  <>
313
313
  <Tag>{isMacintosh ? 'Option' : 'Alt'}</Tag>
@@ -317,7 +317,7 @@ export class LibroKeybindItems {
317
317
  },
318
318
  {
319
319
  key: '5',
320
- actionDescription: l10n.t('选中上个cell'),
320
+ actionDescription: l10n.t('选中上个 Cell'),
321
321
  keybind: (
322
322
  <>
323
323
  <Tag>Up</Tag>/<Tag>K</Tag>
@@ -326,7 +326,7 @@ export class LibroKeybindItems {
326
326
  },
327
327
  {
328
328
  key: '6',
329
- actionDescription: l10n.t('隐藏Code'),
329
+ actionDescription: l10n.t('隐藏 Code'),
330
330
  keybind: (
331
331
  <>
332
332
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -336,7 +336,7 @@ export class LibroKeybindItems {
336
336
  },
337
337
  {
338
338
  key: '7',
339
- actionDescription: l10n.t('隐藏Output'),
339
+ actionDescription: l10n.t('隐藏 Output'),
340
340
  keybind: (
341
341
  <>
342
342
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -346,7 +346,7 @@ export class LibroKeybindItems {
346
346
  },
347
347
  {
348
348
  key: '8',
349
- actionDescription: l10n.t('选中下个cell'),
349
+ actionDescription: l10n.t('选中下个 Cell'),
350
350
  keybind: (
351
351
  <>
352
352
  <Tag>Down</Tag>/<Tag>J</Tag>
@@ -355,7 +355,7 @@ export class LibroKeybindItems {
355
355
  },
356
356
  {
357
357
  key: '9',
358
- actionDescription: l10n.t('向上新增cell'),
358
+ actionDescription: l10n.t('向上新增 Cell'),
359
359
  keybind: (
360
360
  <>
361
361
  <Tag>A</Tag>
@@ -364,7 +364,7 @@ export class LibroKeybindItems {
364
364
  },
365
365
  {
366
366
  key: '10',
367
- actionDescription: l10n.t('向下新增cell'),
367
+ actionDescription: l10n.t('向下新增 Cell'),
368
368
  keybind: (
369
369
  <>
370
370
  <Tag>B</Tag>
@@ -373,7 +373,7 @@ export class LibroKeybindItems {
373
373
  },
374
374
  {
375
375
  key: '11',
376
- actionDescription: l10n.t('删除选中cell'),
376
+ actionDescription: l10n.t('删除选中 Cell'),
377
377
  keybind: (
378
378
  <>
379
379
  <Tag>D D</Tag>
@@ -382,7 +382,7 @@ export class LibroKeybindItems {
382
382
  },
383
383
  {
384
384
  key: '12',
385
- actionDescription: l10n.t('复制cell'),
385
+ actionDescription: l10n.t('复制 Cell'),
386
386
  keybind: (
387
387
  <>
388
388
  <Tag>C</Tag>
@@ -391,7 +391,7 @@ export class LibroKeybindItems {
391
391
  },
392
392
  {
393
393
  key: '13',
394
- actionDescription: l10n.t('剪切cell'),
394
+ actionDescription: l10n.t('剪切 Cell'),
395
395
  keybind: (
396
396
  <>
397
397
  <Tag>X</Tag>
@@ -400,7 +400,7 @@ export class LibroKeybindItems {
400
400
  },
401
401
  {
402
402
  key: '14',
403
- actionDescription: l10n.t('粘贴cell'),
403
+ actionDescription: l10n.t('粘贴 Cell'),
404
404
  keybind: (
405
405
  <>
406
406
  <Tag>V</Tag>
@@ -409,7 +409,7 @@ export class LibroKeybindItems {
409
409
  },
410
410
  {
411
411
  key: '15',
412
- actionDescription: l10n.t('上移cell'),
412
+ actionDescription: l10n.t('上移 Cell'),
413
413
  keybind: (
414
414
  <>
415
415
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -420,7 +420,7 @@ export class LibroKeybindItems {
420
420
  },
421
421
  {
422
422
  key: '16',
423
- actionDescription: l10n.t('下移cell'),
423
+ actionDescription: l10n.t('下移 Cell'),
424
424
  keybind: (
425
425
  <>
426
426
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -431,7 +431,7 @@ export class LibroKeybindItems {
431
431
  },
432
432
  {
433
433
  key: '17',
434
- actionDescription: l10n.t('合并选中cell'),
434
+ actionDescription: l10n.t('合并选中 Cell'),
435
435
  keybind: (
436
436
  <>
437
437
  <Tag>Shift</Tag>
@@ -441,7 +441,7 @@ export class LibroKeybindItems {
441
441
  },
442
442
  {
443
443
  key: '18',
444
- actionDescription: l10n.t('向下合并cell'),
444
+ actionDescription: l10n.t('向下合并 Cell'),
445
445
  keybind: (
446
446
  <>
447
447
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -452,7 +452,7 @@ export class LibroKeybindItems {
452
452
  },
453
453
  {
454
454
  key: '19',
455
- actionDescription: l10n.t('向上合并cell'),
455
+ actionDescription: l10n.t('向上合并 Cell'),
456
456
  keybind: (
457
457
  <>
458
458
  <Tag>{isMacintosh ? 'Cmd' : 'Ctrl'}</Tag>
@@ -481,7 +481,7 @@ export class LibroKeybindItems {
481
481
  },
482
482
  {
483
483
  key: '22',
484
- actionDescription: l10n.t('转为Code Cell'),
484
+ actionDescription: l10n.t('转为 Code Cell'),
485
485
  keybind: (
486
486
  <>
487
487
  <Tag>Y</Tag>
@@ -490,7 +490,7 @@ export class LibroKeybindItems {
490
490
  },
491
491
  {
492
492
  key: '23',
493
- actionDescription: l10n.t('转为Markdown Cell'),
493
+ actionDescription: l10n.t('转为 Markdown Cell'),
494
494
  keybind: (
495
495
  <>
496
496
  <Tag>M</Tag>
@@ -553,7 +553,7 @@ export class LibroKeybindItems {
553
553
  },
554
554
  {
555
555
  key: '30',
556
- actionDescription: l10n.t('向上多选Cell'),
556
+ actionDescription: l10n.t('向上多选 Cell'),
557
557
  keybind: (
558
558
  <>
559
559
  <Tag>Shift</Tag>
@@ -564,7 +564,7 @@ export class LibroKeybindItems {
564
564
  },
565
565
  {
566
566
  key: '31',
567
- actionDescription: l10n.t('向下多选Cell'),
567
+ actionDescription: l10n.t('向下多选 Cell'),
568
568
  keybind: (
569
569
  <>
570
570
  <Tag>Shift</Tag>
@@ -575,7 +575,7 @@ export class LibroKeybindItems {
575
575
  },
576
576
  {
577
577
  key: '32',
578
- actionDescription: l10n.t('选中当前及之前cell'),
578
+ actionDescription: l10n.t('选中当前及之前 Cell'),
579
579
  keybind: (
580
580
  <>
581
581
  <Tag>Shift</Tag>
@@ -585,7 +585,7 @@ export class LibroKeybindItems {
585
585
  },
586
586
  {
587
587
  key: '33',
588
- actionDescription: l10n.t('选中当前及之后cell'),
588
+ actionDescription: l10n.t('选中当前及之后 Cell'),
589
589
  keybind: (
590
590
  <>
591
591
  <Tag>Shift</Tag>
@@ -62,67 +62,6 @@ export class KeybindInstrutionsService implements Disposable {
62
62
 
63
63
  type Segment = 'keybind' | 'magic';
64
64
 
65
- const magicColumns = [
66
- {
67
- title: '关键字',
68
- dataIndex: 'value',
69
- key: 'value',
70
- },
71
- {
72
- title: '含义',
73
- dataIndex: 'description',
74
- key: 'description',
75
- },
76
- ];
77
-
78
- const magics = [
79
- {
80
- key: '1',
81
- value: '%timeit',
82
- description: '测试单行语句的执行时间',
83
- },
84
- {
85
- key: '2',
86
- value: '%%timeit',
87
- description: '测试整个块中代码的执行时间',
88
- },
89
- {
90
- key: '3',
91
- value: '%run',
92
- description: '调用外部python脚本',
93
- },
94
- {
95
- key: '4',
96
- value: '%pwd',
97
- description: '查看当前工作目录',
98
- },
99
- {
100
- key: '5',
101
- value: '%ls',
102
- description: '查看目录文件列表',
103
- },
104
- {
105
- key: '6',
106
- value: '%reset',
107
- description: '清除全部变量',
108
- },
109
- {
110
- key: '7',
111
- value: '%who',
112
- description: '查看所有全局变量的名称,若给定类型参数,只返回该类型的变量列表',
113
- },
114
- {
115
- key: '8',
116
- value: '%whos',
117
- description: '显示所有的全局变量名称、类型、值/信息',
118
- },
119
- {
120
- key: '9',
121
- value: '%env',
122
- description: '列出全部环境变量',
123
- },
124
- ];
125
-
126
65
  export const KeybindInstrutionsComponent = forwardRef<
127
66
  HTMLDivElement,
128
67
  ModalItemProps<void>
@@ -154,6 +93,69 @@ export const KeybindInstrutionsComponent = forwardRef<
154
93
  );
155
94
  };
156
95
 
96
+ const magicColumns = [
97
+ {
98
+ title: l10n.t('关键字'),
99
+ dataIndex: 'value',
100
+ key: 'value',
101
+ },
102
+ {
103
+ title: l10n.t('含义'),
104
+ dataIndex: 'description',
105
+ key: 'description',
106
+ },
107
+ ];
108
+
109
+ const magics = [
110
+ {
111
+ key: '1',
112
+ value: '%timeit',
113
+ description: `${l10n.t('测试单行语句的运行时间')}`,
114
+ },
115
+ {
116
+ key: '2',
117
+ value: '%%timeit',
118
+ description: l10n.t('测试整个块中代码的运行时间'),
119
+ },
120
+ {
121
+ key: '3',
122
+ value: '%run',
123
+ description: l10n.t('调用外部 python 脚本'),
124
+ },
125
+ {
126
+ key: '4',
127
+ value: '%pwd',
128
+ description: l10n.t('查看当前工作目录'),
129
+ },
130
+ {
131
+ key: '5',
132
+ value: '%ls',
133
+ description: l10n.t('查看目录文件列表'),
134
+ },
135
+ {
136
+ key: '6',
137
+ value: '%reset',
138
+ description: l10n.t('清除全部变量'),
139
+ },
140
+ {
141
+ key: '7',
142
+ value: '%who',
143
+ description: l10n.t(
144
+ '查看所有全局变量的名称,若给定类型参数,只返回该类型的变量列表',
145
+ ),
146
+ },
147
+ {
148
+ key: '8',
149
+ value: '%whos',
150
+ description: l10n.t('显示所有的全局变量名称、类型、值/信息'),
151
+ },
152
+ {
153
+ key: '9',
154
+ value: '%env',
155
+ description: l10n.t('列出全部环境变量'),
156
+ },
157
+ ];
158
+
157
159
  const commandModeDataSource = getOrigin(
158
160
  keybindInstrutionsService.searchCommandModeData.length > 0
159
161
  ? keybindInstrutionsService.searchCommandModeData
@@ -177,7 +179,7 @@ export const KeybindInstrutionsComponent = forwardRef<
177
179
  >
178
180
  <div className="libro-keybind-instructions-command" ref={ref}>
179
181
  <Drawer
180
- title="快捷键"
182
+ title={l10n.t('快捷键')}
181
183
  placement="right"
182
184
  onClose={handleClose}
183
185
  width="330px"
@@ -191,9 +193,10 @@ export const KeybindInstrutionsComponent = forwardRef<
191
193
  onChange={(value) => setSegment(value as Segment)}
192
194
  options={[
193
195
  { label: l10n.t('快捷键'), value: 'keybind' },
194
- { label: 'Magic 命令', value: 'magic' },
196
+ { label: l10n.t('Magic 命令'), value: 'magic' },
195
197
  ]}
196
198
  />
199
+
197
200
  {segment === 'magic' && (
198
201
  <div className="libro-magic-table">
199
202
  <Table
@@ -8,7 +8,6 @@ import type {
8
8
  import { ExecutableCellModel } from '@difizen/libro-core';
9
9
  import type { IContentsModel } from '@difizen/libro-kernel';
10
10
  import type { Event as ManaEvent, Emitter } from '@difizen/mana-app';
11
- import { l10n } from '@difizen/mana-l10n';
12
11
 
13
12
  export interface ExecutionMeta extends PartialJSONObject {
14
13
  'shell.execute_reply.started': string; // Kernel 开始执行任务时间在 metadata 中的 key
@@ -81,19 +80,19 @@ export const jupyterServiceStatus: Record<string, ServerStatus> = {
81
80
  category: 'JupyterService',
82
81
  color: statusToColor.blocking,
83
82
  text: 'loading',
84
- text_zh: l10n.t('加载中'),
83
+ text_zh: '加载中',
85
84
  },
86
85
  failed: {
87
86
  category: 'JupyterService',
88
87
  color: statusToColor.error,
89
88
  text: 'failed',
90
- text_zh: l10n.t('加载失败'),
89
+ text_zh: '加载失败',
91
90
  },
92
91
  loaded: {
93
92
  category: 'JupyterService',
94
93
  color: statusToColor.canRunImmediate,
95
94
  text: 'loaded',
96
- text_zh: l10n.t('加载完成'),
95
+ text_zh: '加载完成',
97
96
  },
98
97
  };
99
98
 
@@ -102,54 +101,54 @@ export const kernelStatus: Record<string, ServerStatus> = {
102
101
  category: 'Kernel',
103
102
  color: statusToColor.blocking,
104
103
  text: 'connecting',
105
- text_zh: l10n.t('正在连接'),
104
+ text_zh: '正在连接',
106
105
  },
107
106
  unknown: {
108
107
  category: 'Kernel',
109
108
  color: statusToColor.blocking,
110
109
  text: 'unknown',
111
- text_zh: l10n.t('未知'),
110
+ text_zh: '未知',
112
111
  },
113
112
  starting: {
114
113
  category: 'Kernel',
115
114
  color: statusToColor.blocking,
116
115
  text: 'starting',
117
- text_zh: l10n.t('启动中'),
116
+ text_zh: '启动中',
118
117
  },
119
118
  idle: {
120
119
  category: 'Kernel',
121
120
  color: statusToColor.canRunImmediate,
122
121
  text: 'idle',
123
- text_zh: l10n.t('空闲'),
122
+ text_zh: '空闲',
124
123
  },
125
124
  busy: {
126
125
  category: 'Kernel',
127
126
  color: statusToColor.canRun,
128
127
  text: 'busy',
129
- text_zh: l10n.t('忙碌'),
128
+ text_zh: '忙碌',
130
129
  },
131
130
  terminating: {
132
131
  category: 'Kernel',
133
132
  color: statusToColor.blocking,
134
133
  text: 'terminating',
135
- text_zh: l10n.t('终止中'),
134
+ text_zh: '终止中',
136
135
  },
137
136
  restarting: {
138
137
  category: 'Kernel',
139
138
  color: statusToColor.blocking,
140
139
  text: 'restarting',
141
- text_zh: l10n.t('重启中'),
140
+ text_zh: '重启中',
142
141
  },
143
142
  autorestarting: {
144
143
  category: 'Kernel',
145
144
  color: statusToColor.blocking,
146
145
  text: 'autorestarting',
147
- text_zh: l10n.t('自动重启中'),
146
+ text_zh: '自动重启中',
148
147
  },
149
148
  dead: {
150
149
  category: 'Kernel',
151
150
  color: statusToColor.error,
152
151
  text: 'dead',
153
- text_zh: l10n.t('死亡'),
152
+ text_zh: '死亡',
154
153
  },
155
154
  };
@@ -148,7 +148,7 @@
148
148
  }
149
149
 
150
150
  .libro-run-menu-container {
151
- width: 220px;
151
+ width: 330px;
152
152
  background-color: var(--mana-libro-popover-background-color) !important;
153
153
  .@{ant-prefix}-dropdown-menu-item:hover {
154
154
  background-color: var(--mana-libro-menu-hover-color) !important;
@@ -6,7 +6,6 @@ import { l10n } from '@difizen/mana-l10n';
6
6
  import { Badge } from 'antd';
7
7
 
8
8
  import type { LibroJupyterModel } from '../libro-jupyter-model.js';
9
-
10
9
  import './index.less';
11
10
  import { kernelStatus } from '../libro-jupyter-protocol.js';
12
11
  import { getServiceStatusInfo } from '../utils/index.js';
@@ -31,7 +30,7 @@ export const KernelStatusSelector: React.FC = () => {
31
30
  return (
32
31
  <div className="libro-kernel-and-container-status">
33
32
  <div className="libro-kernel-status-and-selector">
34
- <span className="kernel">kernel:</span>
33
+ <span className="kernel">{l10n.t('kernel:')}</span>
35
34
  <KernelSelector />
36
35
  {showBadge &&
37
36
  (isKernelBusy ? (
@@ -39,14 +38,14 @@ export const KernelStatusSelector: React.FC = () => {
39
38
  className="libro-kernel-badge"
40
39
  key="libro-kernel-badge"
41
40
  color={kernelStatus['busy'].color}
42
- text={kernelStatus['busy'].text_zh}
41
+ text={l10n.t(kernelStatus['busy'].text_zh)}
43
42
  />
44
43
  ) : (
45
44
  <Badge
46
45
  className="libro-kernel-badge"
47
46
  key="libro-kernel-badge"
48
47
  color={color}
49
- text={text_zh}
48
+ text={l10n.t(text_zh)}
50
49
  />
51
50
  ))}
52
51
  </div>
@@ -35,8 +35,9 @@ export const RunSelector: React.FC = () => {
35
35
  libroModel as LibroJupyterModel,
36
36
  );
37
37
 
38
- const [kernelUnreadyBtnText, setKernelUnreadyBtnText] =
39
- useState<string>('kernel准备中,无法执行');
38
+ const [kernelUnreadyBtnText, setKernelUnreadyBtnText] = useState<string>(
39
+ l10n.t('kernel准备中,无法执行'),
40
+ );
40
41
 
41
42
  useEffect(() => {
42
43
  configService
@@ -11,56 +11,54 @@ import { LibroJupyterConfiguration } from '../index.js';
11
11
  import type { LibroJupyterModel } from '../libro-jupyter-model.js';
12
12
  import { kernelPrepared } from '../utils/index.js';
13
13
 
14
- const items: LibroSideToolbarMenuItemType[] = [
15
- {
16
- id: NotebookCommands['RunCell'].id,
17
- label: (
18
- <>
19
- <span className="libro-menu-item-label">{l10n.t('运行 Cell')}</span>
20
- <span className="libro-menu-item-keybind">Cmd + Enter</span>
21
- </>
22
- ),
23
-
24
- group: 'runCell1',
25
- },
26
- {
27
- id: NotebookCommands['RunAllAbove'].id,
28
- label: (
29
- <>
30
- <span className="libro-menu-item-label">{l10n.t('运行上方所有 Cell')}</span>
31
- <span className="libro-menu-item-keybind">Cmd + F8</span>
32
- </>
33
- ),
34
-
35
- group: 'runCell2',
36
- },
37
- {
38
- id: NotebookCommands['RunAllBelow'].id,
39
- label: (
40
- <>
41
- <span className="libro-menu-item-label">
42
- {l10n.t('运行当前及下方所有 Cell')}
43
- </span>
44
- <span className="libro-menu-item-keybind">Cmd + F10</span>
45
- </>
46
- ),
47
-
48
- group: 'runCell2',
49
- },
50
- ];
51
-
52
14
  export const SideToolbarRunSelector: React.FC = () => {
53
15
  const libroView = useInject<LibroView>(ViewInstance);
54
16
  const libroServerManager = useInject(ServerManager);
55
17
  const configService = useInject<ConfigurationService>(ConfigurationService);
56
18
  const libroModel = libroView ? libroView.model : undefined;
19
+ const items: LibroSideToolbarMenuItemType[] = [
20
+ {
21
+ id: NotebookCommands['RunCell'].id,
22
+ label: (
23
+ <>
24
+ <span className="libro-menu-item-label">{l10n.t('运行 Cell')}</span>
25
+ <span className="libro-menu-item-keybind">Cmd + Enter</span>
26
+ </>
27
+ ),
28
+
29
+ group: 'runCell1',
30
+ },
31
+ {
32
+ id: NotebookCommands['RunAllAbove'].id,
33
+ label: (
34
+ <>
35
+ <span className="libro-menu-item-label">{l10n.t('运行之前所有 Cell')}</span>
36
+ <span className="libro-menu-item-keybind">Cmd + F8</span>
37
+ </>
38
+ ),
39
+
40
+ group: 'runCell2',
41
+ },
42
+ {
43
+ id: NotebookCommands['RunAllBelow'].id,
44
+ label: (
45
+ <>
46
+ <span className="libro-menu-item-label">{l10n.t('运行当前及之后 Cell')}</span>
47
+ <span className="libro-menu-item-keybind">Cmd + F10</span>
48
+ </>
49
+ ),
50
+
51
+ group: 'runCell2',
52
+ },
53
+ ];
57
54
  const isKernelPrepared = kernelPrepared(
58
55
  libroServerManager,
59
56
  libroModel as LibroJupyterModel,
60
57
  );
61
58
 
62
- const [kernelUnreadyBtnText, setKernelUnreadyBtnText] =
63
- useState<string>('kernel准备中,无法执行');
59
+ const [kernelUnreadyBtnText, setKernelUnreadyBtnText] = useState<string>(
60
+ l10n.t('kernel准备中,无法运行'),
61
+ );
64
62
 
65
63
  useEffect(() => {
66
64
  configService
@@ -52,9 +52,9 @@ export class LibroJupyterToolbarContribution implements ToolbarContribution {
52
52
  command: NotebookCommands['SelectLastRunCell'].id,
53
53
  group: ['group2'],
54
54
  order: 'b',
55
- tooltip: (
55
+ tooltip: () => (
56
56
  <div className="libro-tooltip">
57
- <span className="libro-tooltip-text">{l10n.t('定位正在执行的Cell')}</span>
57
+ <span className="libro-tooltip-text">{l10n.t('定位正在运行的 Cell')}</span>
58
58
  </div>
59
59
  ),
60
60
  });