Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat: add shortcut panel i18n (#722)
Wenzhao Hu3d2e0ed1ce68
diff --git a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.tsindex eb43b8cf5e..a82ef5d469 100644--- a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts+++ b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts@@ -75,6 +75,8 @@ export function generateArrowSelectionShortCutItem() {export const EditorCursorEnterShortcut: IShortcutItem = {id: SetCellEditVisibleOperation.id,binding: KeyCode.ENTER,+ description: 'shortcut.sheet.toggle-editing',+ group: '4_sheet-edit',preconditions: (contextService) => whenEditorDidNotInputFormulaActivated(contextService),staticParameters: {visible: false,@@ -97,6 +99,8 @@ export const EditorCursorTabShortcut: IShortcutItem = {export const EditorCursorEscShortcut: IShortcutItem = {id: SetCellEditVisibleOperation.id,binding: KeyCode.ESC,+ description: 'shortcut.sheet.abort-editing',+ group: '4_sheet-edit',preconditions: (contextService) => contextService.getContextValue(FOCUSING_EDITOR),staticParameters: {visible: false,@@ -107,6 +111,8 @@ export const EditorCursorEscShortcut: IShortcutItem = {export const EditorBreakLineShortcut: IShortcutItem = {id: BreakLineCommand.id,+ description: 'shortcut.sheet.break-line',+ group: '4_sheet-edit',preconditions: (contextService) => contextService.getContextValue(FOCUSING_EDITOR),binding: KeyCode.ENTER | MetaKeys.ALT,};@@ -120,6 +126,8 @@ export const EditorDeleteLeftShortcut: IShortcutItem = {export const EditorDeleteLeftShortcutInActive: IShortcutItem = {id: SetCellEditVisibleOperation.id,+ description: 'shortcut.sheet.delete-and-start-editing',+ group: '4_sheet-edit',preconditions: (contextService) =>whenEditorFocusIsHidden(contextService) && !whenFormulaEditorFocused(contextService),binding: KeyCode.BACKSPACE,diff --git a/packages/sheets-ui/src/controllers/shortcuts/selection.shortcut.ts b/packages/sheets-ui/src/controllers/shortcuts/selection.shortcut.tsindex 48c5f711d3..9808e7c0f4 100644--- a/packages/sheets-ui/src/controllers/shortcuts/selection.shortcut.ts+++ b/packages/sheets-ui/src/controllers/shortcuts/selection.shortcut.ts@@ -255,7 +255,7 @@ export const ExpandSelectionEndDownShortcutItem: IShortcutItem<IExpandSelectionCexport const ExpandSelectionEndUpShortcutItem: IShortcutItem<IExpandSelectionCommandParams> = {id: ExpandSelectionCommand.id,- description: 'shortcut.sheet.expand-selection-to-above-gap',+ description: 'shortcut.sheet.expand-selection-to-up-gap',group: '3_sheet-view',binding: KeyCode.ARROW_UP | MetaKeys.SHIFT | MetaKeys.CTRL_COMMAND,preconditions: whenEditorNotActivated,diff --git a/packages/sheets-ui/src/controllers/shortcuts/style.shortcut.ts b/packages/sheets-ui/src/controllers/shortcuts/style.shortcut.tsindex b5ea0818e1..fb938c5e51 100644--- a/packages/sheets-ui/src/controllers/shortcuts/style.shortcut.ts+++ b/packages/sheets-ui/src/controllers/shortcuts/style.shortcut.ts@@ -22,24 +22,32 @@ import { whenEditorNotActivated } from './utils';export const SetBoldShortcutItem: IShortcutItem = {id: SetBoldCommand.id,+ description: 'shortcut.sheet.set-bold',+ group: '4_sheet-edit',preconditions: (contextService) => whenEditorNotActivated(contextService),binding: KeyCode.B | MetaKeys.CTRL_COMMAND,};export const SetItalicShortcutItem: IShortcutItem = {id: SetItalicCommand.id,+ description: 'shortcut.sheet.set-italic',+ group: '4_sheet-edit',preconditions: (contextService) => whenEditorNotActivated(contextService),binding: KeyCode.I | MetaKeys.CTRL_COMMAND,};export const SetUnderlineShortcutItem: IShortcutItem = {id: SetUnderlineCommand.id,+ description: 'shortcut.sheet.set-underline',+ group: '4_sheet-edit',preconditions: (contextService) => whenEditorNotActivated(contextService),binding: KeyCode.U | MetaKeys.CTRL_COMMAND,};export const SetStrikeThroughShortcutItem: IShortcutItem = {id: SetStrikeThroughCommand.id,+ description: 'shortcut.sheet.set-strike-through',+ group: '4_sheet-edit',preconditions: (contextService) => whenEditorNotActivated(contextService),binding: KeyCode.X | MetaKeys.SHIFT | MetaKeys.CTRL_COMMAND,};diff --git a/packages/sheets-ui/src/locale/en-US.ts b/packages/sheets-ui/src/locale/en-US.tsindex 120bb9ea32..9d35648800 100644--- a/packages/sheets-ui/src/locale/en-US.ts+++ b/packages/sheets-ui/src/locale/en-US.ts@@ -611,8 +611,17 @@ export default {'expand-selection-to-right-gap': 'Expand selection to the right gap','expand-selection-to-up-gap': 'Expand selection to the up gap','select-all': 'Select all',+ 'toggle-editing': 'Toggle editing',+ 'delete-and-start-editing': 'Clear and start editing',+ 'abort-editing': 'Abort editing',+ 'break-line': 'Break line',+ 'set-bold': 'Toggle bold',+ 'set-italic': 'Toggle italic',+ 'set-underline': 'Toggle underline',+ 'set-strike-through': 'Toggle strike through',},},'sheet-view': 'Sheet View',+ 'sheet-edit': 'Sheet Edit',};diff --git a/packages/sheets-ui/src/locale/zh-CN.ts b/packages/sheets-ui/src/locale/zh-CN.tsindex 9d25db187c..a43f93a6bc 100644--- a/packages/sheets-ui/src/locale/zh-CN.ts+++ b/packages/sheets-ui/src/locale/zh-CN.ts@@ -449,4 +449,40 @@ export default {placeholder: '选择范围或输入值',tooltip: '选择范围',},+ shortcut: {+ sheet: {+ 'zoom-in': '放大',+ 'zoom-out': '缩小',+ 'reset-zoom': '恢复缩放',+ 'select-below-cell': '选择下方单元格',+ 'select-up-cell': '选择上方单元格',+ 'select-left-cell': '选择左侧单元格',+ 'select-right-cell': '选择右侧单元格',+ 'select-next-cell': '选择后一个单元格',+ 'select-previous-cell': '选择前一个单元格',+ 'select-up-value-cell': '选择上方有值的单元格',+ 'select-below-value-cell': '选择下方有值的单元格',+ 'select-left-value-cell': '选择左侧有值的单元格',+ 'select-right-value-cell': '选择右侧有值的单元格',+ 'expand-selection-down': '向下扩展选区',+ 'expand-selection-up': '向上扩展选区',+ 'expand-selection-left': '向左扩展选区',+ 'expand-selection-right': '向右扩展选区',+ 'expand-selection-to-left-gap': '向左扩展选区到下一个边界',+ 'expand-selection-to-below-gap': '向下扩展选区到下一个边界',+ 'expand-selection-to-right-gap': '向右扩展选区到下一个边界',+ 'expand-selection-to-up-gap': '向上扩展选区到下一个边界',+ 'select-all': '全选',+ 'toggle-editing': '开始 / 结束编辑',+ 'delete-and-start-editing': '清空并开始编辑',+ 'abort-editing': '放弃编辑',+ 'break-line': '换行',+ 'set-bold': '切换粗体',+ 'set-italic': '切换斜体',+ 'set-underline': '切换下划线',+ 'set-strike-through': '切换删除线',+ },+ },+ 'sheet-view': '浏览表格',+ 'sheet-edit': '编辑表格',};diff --git a/packages/ui/src/controllers/shortcut-display/menu.ts b/packages/ui/src/controllers/shortcut-display/menu.tsindex 2af9f00880..0029d560da 100644--- a/packages/ui/src/controllers/shortcut-display/menu.ts+++ b/packages/ui/src/controllers/shortcut-display/menu.ts@@ -25,6 +25,6 @@ export function ShortcutPanelMenuItemFactory(): IMenuButtonItem {tooltip: 'toggle-shortcut-panel',icon: 'KeyboardSingle',type: MenuItemType.BUTTON,- positions: [MenuPosition.TOOLBAR_OTHERS],+ positions: [MenuPosition.TOOLBAR_START],};}diff --git a/packages/ui/src/locale/en-US.ts b/packages/ui/src/locale/en-US.tsindex 84aea9d12e..b276e0df5c 100644--- a/packages/ui/src/locale/en-US.ts+++ b/packages/ui/src/locale/en-US.ts@@ -34,4 +34,5 @@ export default {paste: 'Paste',},'common-edit': 'Common Editing Shortcuts',+ 'toggle-shortcut-panel': 'Toggle Shortcut Panel',};diff --git a/packages/ui/src/locale/zh-CN.ts b/packages/ui/src/locale/zh-CN.tsindex 366ae5f3fb..46357fcb9f 100644--- a/packages/ui/src/locale/zh-CN.ts+++ b/packages/ui/src/locale/zh-CN.ts@@ -23,4 +23,16 @@ export default {view: '视图',others: '其他',},+ 'shortcut-panel': {+ title: '快捷键面板',+ },+ shortcut: {+ undo: '撤销',+ redo: '重做',+ cut: '剪切',+ copy: '复制',+ paste: '粘贴',+ },+ 'common-edit': '常用编辑',+ 'toggle-shortcut-panel': '打开收起快捷键面板',};