Skip to content

Commit

Permalink
Localize keyboard shortcuts panel (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott authored Sep 26, 2024
1 parent 5c29452 commit cdd829a
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 33 deletions.
130 changes: 129 additions & 1 deletion src/ui/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,38 @@ const localizeInit = () => {
"data.totals.hidden": "Hidden",
"data.totals.deleted": "Deleted",

// Shortcuts panel
"shortcuts.title": "KEYBOARD SHORTCUTS",
"shortcuts.tools": "TOOLS",
"shortcuts.move": "Move",
"shortcuts.rotate": "Rotate",
"shortcuts.scale": "Scale",
"shortcuts.rect-selection": "Rect Selection",
"shortcuts.brush-selection": "Brush Selection",
"shortcuts.picker-selection": "Picker Selection",
"shortcuts.brush-size": "Decrease/Increase brush size",
"shortcuts.deactivate-tool": "Deactivate Tool",
"shortcuts.selection": "SELECTION",
"shortcuts.select-all": "Select All",
"shortcuts.deselect-all": "Deselect All",
"shortcuts.invert-selection": "Invert Selection",
"shortcuts.add-to-selection": "Add to Selection",
"shortcuts.remove-from-selection": "Remove from Selection",
"shortcuts.delete-selected-splats": "Delete Selected Splats",
"shortcuts.show": "SHOW",
"shortcuts.hide-selected-splats": "Hide Selected Splats",
"shortcuts.unhide-all-splats": "Unhide All Splats",
"shortcuts.toggle-data-panel": "Toggle Data Panel",
"shortcuts.other": "OTHER",
"shortcuts.select-next-splat": "Select Next Splat",
"shortcuts.undo": "Undo",
"shortcuts.redo": "Redo",
"shortcuts.toggle-splat-overlay": "Toggle Splat Overlay",
"shortcuts.focus-camera": "Focus Camera on current selection",
"shortcuts.toggle-camera-mode": "Toggle Camera Mode",
"shortcuts.toggle-grid": "Toggle Grid",
"shortcuts.toggle-gizmo-coordinate-space": "Toggle Gizmo Coordinate Space",

// Popup
"popup.ok": "OK",
"popup.cancel": "Cancel",
Expand Down Expand Up @@ -183,6 +215,38 @@ const localizeInit = () => {
"data.totals.hidden": "非表示",
"data.totals.deleted": "削除",

// Shortcuts panel
"shortcuts.title": "キーボードショートカット",
"shortcuts.tools": "ツール",
"shortcuts.move": "移動",
"shortcuts.rotate": "回転",
"shortcuts.scale": "スケール",
"shortcuts.rect-selection": "四角形選択",
"shortcuts.brush-selection": "ブラシ選択",
"shortcuts.picker-selection": "ピッカー選択",
"shortcuts.brush-size": "ブラシサイズの増減",
"shortcuts.deactivate-tool": "ツールの非アクティブ化",
"shortcuts.selection": "選択",
"shortcuts.select-all": "全て選択",
"shortcuts.deselect-all": "全て選択解除",
"shortcuts.invert-selection": "選択反転",
"shortcuts.add-to-selection": "選択追加",
"shortcuts.remove-from-selection": "選択解除",
"shortcuts.delete-selected-splats": "選択削除",
"shortcuts.show": "表示",
"shortcuts.hide-selected-splats": "選択非表示",
"shortcuts.unhide-all-splats": "全て表示",
"shortcuts.toggle-data-panel": "データパネルの切り替え",
"shortcuts.other": "その他",
"shortcuts.select-next-splat": "次のスプラットを選択",
"shortcuts.undo": "元に戻す",
"shortcuts.redo": "やり直し",
"shortcuts.toggle-splat-overlay": "スプラットオーバーレイの切り替え",
"shortcuts.focus-camera": "カメラの焦点を合わせる",
"shortcuts.toggle-camera-mode": "カメラモードの切り替え",
"shortcuts.toggle-grid": "グリッドの切り替え",
"shortcuts.toggle-gizmo-coordinate-space": "ギズモ座標空間の切り替え",

// Popup
"popup.ok": "OK",
"popup.cancel": "キャンセル",
Expand Down Expand Up @@ -283,6 +347,38 @@ const localizeInit = () => {
"data.totals.hidden": "숨겨진",
"data.totals.deleted": "삭제된",

// Shortcuts panel
"shortcuts.title": "키보드 단축키",
"shortcuts.tools": "도구",
"shortcuts.move": "이동",
"shortcuts.rotate": "회전",
"shortcuts.scale": "크기 조정",
"shortcuts.rect-selection": "사각형 선택",
"shortcuts.brush-selection": "브러시 선택",
"shortcuts.picker-selection": "피커 선택",
"shortcuts.brush-size": "브러시 크기 조정",
"shortcuts.deactivate-tool": "도구 비활성화",
"shortcuts.selection": "선택",
"shortcuts.select-all": "모두 선택",
"shortcuts.deselect-all": "모두 선택 해제",
"shortcuts.invert-selection": "선택 반전",
"shortcuts.add-to-selection": "선택 추가",
"shortcuts.remove-from-selection": "선택 제거",
"shortcuts.delete-selected-splats": "선택된 Splat 삭제",
"shortcuts.show": "표시",
"shortcuts.hide-selected-splats": "선택된 Splat 숨기기",
"shortcuts.unhide-all-splats": "모든 Splat 표시",
"shortcuts.toggle-data-panel": "데이터 패널 전환",
"shortcuts.other": "기타",
"shortcuts.select-next-splat": "다음 Splat 선택",
"shortcuts.undo": "실행 취소",
"shortcuts.redo": "다시 실행",
"shortcuts.toggle-splat-overlay": "Splat 오버레이 전환",
"shortcuts.focus-camera": "현재 선택에 초점 맞추기",
"shortcuts.toggle-camera-mode": "카메라 모드 전환",
"shortcuts.toggle-grid": "그리드 전환",
"shortcuts.toggle-gizmo-coordinate-space": "기즈모 좌표 공간 전환",

// Popup
"popup.ok": "확인",
"popup.cancel": "취소",
Expand Down Expand Up @@ -382,7 +478,39 @@ const localizeInit = () => {
"data.totals.selected": "选择",
"data.totals.hidden": "隐藏",
"data.totals.deleted": "删除",


// Shortcuts panel
"shortcuts.title": "键盘快捷键",
"shortcuts.tools": "工具",
"shortcuts.move": "移动",
"shortcuts.rotate": "旋转",
"shortcuts.scale": "缩放",
"shortcuts.rect-selection": "矩形选择",
"shortcuts.brush-selection": "画笔选择",
"shortcuts.picker-selection": "拾取选择",
"shortcuts.brush-size": "减小/增大画笔大小",
"shortcuts.deactivate-tool": "停用工具",
"shortcuts.selection": "选择",
"shortcuts.select-all": "全选",
"shortcuts.deselect-all": "取消全选",
"shortcuts.invert-selection": "反选",
"shortcuts.add-to-selection": "添加到选择",
"shortcuts.remove-from-selection": "从选择中移除",
"shortcuts.delete-selected-splats": "删除选择的 Splat",
"shortcuts.show": "显示",
"shortcuts.hide-selected-splats": "隐藏选择的 Splat",
"shortcuts.unhide-all-splats": "显示全部 Splat",
"shortcuts.toggle-data-panel": "切换数据面板",
"shortcuts.other": "其他",
"shortcuts.select-next-splat": "选择下一个 Splat",
"shortcuts.undo": "撤销",
"shortcuts.redo": "重做",
"shortcuts.toggle-splat-overlay": "切换 Splat 叠加",
"shortcuts.focus-camera": "聚焦当前选择",
"shortcuts.toggle-camera-mode": "切换相机模式",
"shortcuts.toggle-grid": "切换网格",
"shortcuts.toggle-gizmo-coordinate-space": "切换 Gizmo 坐标空间",

// Popup
"popup.ok": "确定",
"popup.cancel": "取消",
Expand Down
65 changes: 33 additions & 32 deletions src/ui/shortcuts-popup.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
import { Container, Label, Overlay, Panel } from 'pcui';
import { localize } from './localization';

const shortcutList = [
{ header: 'TOOLS' },
{ key: '1', action: 'Move' },
{ key: '2', action: 'Rotate' },
{ key: '3', action: 'Scale' },
{ key: 'R', action: 'Rect Selection' },
{ key: 'B', action: 'Brush Selection' },
{ key: 'P', action: 'Picker Selection' },
{ key: '[ ]', action: 'Decrease/Increase brush size' },
{ key: 'Esc', action: 'Deactivate Tool' },
{ header: 'SELECTION' },
{ key: 'A', action: 'Select All' },
{ key: 'Shift + A', action: 'Deselect All' },
{ key: 'I', action: 'Invert Selection' },
{ key: 'Shift', action: 'Add to Selection' },
{ key: 'Ctrl', action: 'Remove from Selection' },
{ key: 'Delete', action: 'Delete Selected Splats' },
{ header: 'SHOW' },
{ key: 'H', action: 'Hide Selected Splats' },
{ key: 'U', action: 'Unhide All Splats' },
{ key: 'D', action: 'Toggle Data Panel' },
{ header: 'OTHER' },
{ key: 'Tab', action: 'Select Next Splat' },
{ key: 'Ctrl + Z', action: 'Undo' },
{ key: 'Ctrl + Shift + Z', action: 'Redo' },
{ key: 'Space', action: 'Toggle Splat Overlay' },
{ key: 'F', action: 'Focus Camera on current selection' },
{ key: 'M', action: 'Toggle Camera Mode'},
{ key: 'G', action: 'Toggle Grid' },
{ key: 'C', action: 'Toggle Gizmo Coordinate Space' },
{ header: 'tools' },
{ key: '1', action: 'move' },
{ key: '2', action: 'rotate' },
{ key: '3', action: 'scale' },
{ key: 'R', action: 'rect-selection' },
{ key: 'B', action: 'brush-selection' },
{ key: 'P', action: 'picker-selection' },
{ key: '[ ]', action: 'brush-size' },
{ key: 'Esc', action: 'deactivate-tool' },
{ header: 'selection' },
{ key: 'A', action: 'select-all' },
{ key: 'Shift + A', action: 'deselect-all' },
{ key: 'I', action: 'invert-selection' },
{ key: 'Shift', action: 'add-to-selection' },
{ key: 'Ctrl', action: 'remove-from-selection' },
{ key: 'Delete', action: 'delete-selected-splats' },
{ header: 'show' },
{ key: 'H', action: 'hide-selected-splats' },
{ key: 'U', action: 'unhide-all-splats' },
{ key: 'D', action: 'toggle-data-panel' },
{ header: 'other' },
{ key: 'Tab', action: 'select-next-splat' },
{ key: 'Ctrl + Z', action: 'undo' },
{ key: 'Ctrl + Shift + Z', action: 'redo' },
{ key: 'Space', action: 'toggle-splat-overlay' },
{ key: 'F', action: 'focus-camera' },
{ key: 'M', action: 'toggle-camera-mode'},
{ key: 'G', action: 'toggle-grid' },
{ key: 'C', action: 'toggle-gizmo-coordinate-space' },
];

class ShortcutsPopup extends Overlay {
Expand All @@ -51,7 +52,7 @@ class ShortcutsPopup extends Overlay {
if (shortcut.header) {
const label = new Label({
class: 'shortcut-header-label',
text: shortcut.header
text: localize(`shortcuts.${shortcut.header}`)
});

const entry = new Container({
Expand All @@ -69,7 +70,7 @@ class ShortcutsPopup extends Overlay {

const action = new Label({
class: 'shortcut-action',
text: shortcut.action
text: localize(`shortcuts.${shortcut.action}`)
});

const entry = new Container({
Expand All @@ -85,7 +86,7 @@ class ShortcutsPopup extends Overlay {

const shortcutsPanel = new Panel({
id: 'shortcuts-panel',
headerText: 'KEYBOARD SHORTCUTS'
headerText: localize('shortcuts.title')
});

shortcutsPanel.append(shortcutsContainer);
Expand Down

0 comments on commit cdd829a

Please sign in to comment.