mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 19:17:09 +03:00
Merge pull request #471 from pulsar-edit/revert-446-i18n
Revert "Create i18n API"
This commit is contained in:
commit
038b94e941
@ -1,9 +0,0 @@
|
||||
preserve_hierarchy: true
|
||||
commit_message: "[skip ci] Translations from Crowdin"
|
||||
append_commit_message: false
|
||||
|
||||
files:
|
||||
- source: /i18n/en.json
|
||||
translation: /i18n/%locale%.json
|
||||
- source: /packages/**/i18n/en.json
|
||||
translation: /packages/**/i18n/%locale%.json
|
169
i18n/en.json
169
i18n/en.json
@ -1,169 +0,0 @@
|
||||
{
|
||||
"menu": {
|
||||
"pulsar": {
|
||||
"about": "About Pulsar",
|
||||
"view-license": "View License",
|
||||
"version": "Version VERSION",
|
||||
"restart-and-install-update": "Restart and Install Update",
|
||||
"check-for-update": "Check for Update",
|
||||
"checking-for-update": "Checking for Update",
|
||||
"downloading-update": "Downloading Update",
|
||||
"preferences": "Preferences",
|
||||
"config": "Config",
|
||||
"init-script": "Init Script",
|
||||
"keymap": "Keymap",
|
||||
"snippets": "Snippets",
|
||||
"stylesheet": "Stylesheet",
|
||||
"install-shell-commands": "Install Shell Commands",
|
||||
"quit": "Quit Pulsar"
|
||||
},
|
||||
"macos": {
|
||||
"services": "Services",
|
||||
"hide-self": "Hide Pulsar",
|
||||
"hide-others": "Hide Others",
|
||||
"show-all": "Show All"
|
||||
},
|
||||
"file": {
|
||||
"self": "File",
|
||||
"new-window": "New Window",
|
||||
"new-file": "New File",
|
||||
"open": "Open...",
|
||||
"open-file": "Open File...",
|
||||
"open-folder": "Open Folder...",
|
||||
"add-project-folder": "Add Project Folder",
|
||||
"project-history": {
|
||||
"reopen-project": "Reopen Project",
|
||||
"clear": "Clear Project History"
|
||||
},
|
||||
"reopen-last-item": "Reopen Last Item",
|
||||
"save": "Save",
|
||||
"save-as": "Save As...",
|
||||
"save-all": "Save All",
|
||||
"close-tab": "Close Tab",
|
||||
"close-pane": "Close Pane",
|
||||
"close-window": "Close Window"
|
||||
},
|
||||
"edit": {
|
||||
"self": "Edit",
|
||||
"undo": "Undo",
|
||||
"redo": "Redo",
|
||||
"cut": "Cut",
|
||||
"copy": "Copy",
|
||||
"copy-path": "Copy Path",
|
||||
"paste": "Paste",
|
||||
"paste-without-reformatting": "Paste Without Reformatting",
|
||||
"select-all": "Select All",
|
||||
"toggle-comments": "Toggle Comments",
|
||||
"lines": {
|
||||
"self": "Lines",
|
||||
"indent": "Indent",
|
||||
"outdent": "Outdent",
|
||||
"auto-indent": "Auto Indent",
|
||||
"move-up": "Move Line Up",
|
||||
"move-down": "Move Line Down",
|
||||
"duplicate": "Duplicate Lines",
|
||||
"delete": "Delete Line",
|
||||
"join": "Join Lines"
|
||||
},
|
||||
"columns": {
|
||||
"self": "Columns",
|
||||
"move-selection-left": "Move Selection Left",
|
||||
"move-selection-right": "Move Selection Right"
|
||||
},
|
||||
"text": {
|
||||
"self": "Text",
|
||||
"upper-case": "Upper Case",
|
||||
"lower-case": "Lower Case",
|
||||
"delete-to-end-of-word": "Delete to End of Word",
|
||||
"delete-to-previous-word-boundary": "Delete to Previous Word Boundary",
|
||||
"delete-to-next-word-boundary": "Delete to Next Word Boundary",
|
||||
"delete-line": "Delete Line",
|
||||
"transpose": "Transpose"
|
||||
},
|
||||
"folding": {
|
||||
"self": "Folding",
|
||||
"fold": "Fold",
|
||||
"unfold": "Unfold",
|
||||
"fold-all": "Fold All",
|
||||
"unfold-all": "Unfold All",
|
||||
"fold-level-1": "Fold Level 1",
|
||||
"fold-level-2": "Fold Level 2",
|
||||
"fold-level-3": "Fold Level 3",
|
||||
"fold-level-4": "Fold Level 4",
|
||||
"fold-level-5": "Fold Level 5",
|
||||
"fold-level-6": "Fold Level 6",
|
||||
"fold-level-7": "Fold Level 7",
|
||||
"fold-level-8": "Fold Level 8",
|
||||
"fold-level-9": "Fold Level 9"
|
||||
}
|
||||
},
|
||||
"view": {
|
||||
"self": "View",
|
||||
"toggle-full-screen": "Toggle Full Screen",
|
||||
"toggle-menu-bar": "Toggle Menu Bar",
|
||||
"panes": {
|
||||
"self": "Panes",
|
||||
"split-up": "Split Up",
|
||||
"split-down": "Split Down",
|
||||
"split-left": "Split Left",
|
||||
"split-right": "Split Right",
|
||||
"focus-next": "Focus Next Pane",
|
||||
"focus-previous": "Focus Previous Pane",
|
||||
"focus-above": "Focus Pane Above",
|
||||
"focus-below": "Focus Pane Below",
|
||||
"focus-on-left": "Focus Pane On Left",
|
||||
"focus-on-right": "Focus Pane On Right",
|
||||
"close": "Close Pane"
|
||||
},
|
||||
"developer": {
|
||||
"self": "Developer",
|
||||
"open-in-dev-mode": "Open In Dev Mode",
|
||||
"reload-window": "Reload Window",
|
||||
"run-package-specs": "Run Package Specs",
|
||||
"toggle-dev-tools": "Toggle Developer Tools"
|
||||
},
|
||||
"increase-font-size": "Increase Font Size",
|
||||
"decrease-font-size": "Decrease Font Size",
|
||||
"reset-font-size": "Reset Font Size",
|
||||
"toggle-soft-wrap": "Toggle Soft Wrap"
|
||||
},
|
||||
"selection": {
|
||||
"self": "Selection",
|
||||
"add-above": "Add Selection Above",
|
||||
"add-below": "Add Selection Below",
|
||||
"single": "Single Selection",
|
||||
"split-into-lines": "Split into Lines",
|
||||
"to-top": "Select to Top",
|
||||
"to-bottom": "Select to Bottom",
|
||||
"line": "Select Line",
|
||||
"word": "Select Word",
|
||||
"to-beginning-of-word": "Select to Beginning of Word",
|
||||
"to-beginning-of-line": "Select to Beginning of Line",
|
||||
"to-first-char-of-line": "Select to First Character of Line",
|
||||
"to-end-of-word": "Select to End of Word",
|
||||
"to-end-of-line": "Select to End of Line"
|
||||
},
|
||||
"find": {
|
||||
"self": "Find"
|
||||
},
|
||||
"packages": {
|
||||
"self": "Packages",
|
||||
"open-package-manager": "Open Package Manager"
|
||||
},
|
||||
"window": {
|
||||
"self": "Window",
|
||||
"minimise": "Minimise",
|
||||
"zoom": "Zoom",
|
||||
"bring-all-to-front": "Bring All to Front"
|
||||
},
|
||||
"help": {
|
||||
"self": "Help",
|
||||
"terms-of-use": "Terms of Use",
|
||||
"docs": "Documentation",
|
||||
"faq": "Frequently Asked Questions",
|
||||
"community-discussions": "Community Discussions",
|
||||
"report-issue": "Report Issue",
|
||||
"search-issues": "Search Issues"
|
||||
}
|
||||
}
|
||||
}
|
@ -2,227 +2,227 @@
|
||||
{
|
||||
label: 'Pulsar'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.pulsar.about', command: 'application:about' }
|
||||
{ localisedLabel: 'core.menu.pulsar.view-license', command: 'application:open-license' }
|
||||
{ localisedLabel: 'core.menu.pulsar.version', enabled: false }
|
||||
{ localisedLabel: 'core.menu.pulsar.restart-and-install-update', command: 'application:install-update', visible: false }
|
||||
{ localisedLabel: 'core.menu.pulsar.check-for-update', command: 'application:check-for-update', visible: false }
|
||||
{ localisedLabel: 'core.menu.pulsar.checking-for-update', enabled: false, visible: false }
|
||||
{ localisedLabel: 'core.menu.pulsar.downloading-update', enabled: false, visible: false }
|
||||
{ label: 'About Pulsar', command: 'application:about' }
|
||||
{ label: 'View License', command: 'application:open-license' }
|
||||
{ label: 'VERSION', enabled: false }
|
||||
{ label: 'Restart and Install Update', command: 'application:install-update', visible: false}
|
||||
{ label: 'Check for Update', command: 'application:check-for-update', visible: false}
|
||||
{ label: 'Checking for Update', enabled: false, visible: false}
|
||||
{ label: 'Downloading Update', enabled: false, visible: false}
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.preferences', command: 'application:show-settings' }
|
||||
{ label: 'Preferences…', command: 'application:show-settings' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.config', command: 'application:open-your-config' }
|
||||
{ localisedLabel: 'core.menu.pulsar.init-script', command: 'application:open-your-init-script' }
|
||||
{ localisedLabel: 'core.menu.pulsar.keymap', command: 'application:open-your-keymap' }
|
||||
{ localisedLabel: 'core.menu.pulsar.snippets', command: 'application:open-your-snippets' }
|
||||
{ localisedLabel: 'core.menu.pulsar.stylesheet', command: 'application:open-your-stylesheet' }
|
||||
{ label: 'Config…', command: 'application:open-your-config' }
|
||||
{ label: 'Init Script…', command: 'application:open-your-init-script' }
|
||||
{ label: 'Keymap…', command: 'application:open-your-keymap' }
|
||||
{ label: 'Snippets…', command: 'application:open-your-snippets' }
|
||||
{ label: 'Stylesheet…', command: 'application:open-your-stylesheet' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.install-shell-commands', command: 'window:install-shell-commands' }
|
||||
{ label: 'Install Shell Commands', command: 'window:install-shell-commands' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.macos.services', role: 'services', submenu: [] }
|
||||
{ label: 'Services', role: 'services', submenu: [] }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.macos.hide-self', command: 'application:hide' }
|
||||
{ localisedLabel: 'core.menu.macos.hide-others', command: 'application:hide-other-applications' }
|
||||
{ localisedLabel: 'core.menu.macos.show-all', command: 'application:unhide-all-applications' }
|
||||
{ label: 'Hide Pulsar', command: 'application:hide' }
|
||||
{ label: 'Hide Others', command: 'application:hide-other-applications' }
|
||||
{ label: 'Show All', command: 'application:unhide-all-applications' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.quit', command: 'application:quit' }
|
||||
{ label: 'Quit Pulsar', command: 'application:quit' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.file.self'
|
||||
label: 'File'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.file.new-window', command: 'application:new-window' }
|
||||
{ localisedLabel: 'core.menu.file.new-file', command: 'application:new-file' }
|
||||
{ localisedLabel: 'core.menu.file.open', command: 'application:open' }
|
||||
{ localisedLabel: 'core.menu.file.add-project-folder', command: 'application:add-project-folder' }
|
||||
{ label: 'New Window', command: 'application:new-window' }
|
||||
{ label: 'New File', command: 'application:new-file' }
|
||||
{ label: 'Open…', command: 'application:open' }
|
||||
{ label: 'Add Project Folder…', command: 'application:add-project-folder' }
|
||||
{
|
||||
localisedLabel: 'core.menu.file.project-history.reopen-project'
|
||||
label: 'Reopen Project',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.file.project-history.clear', command: 'application:clear-project-history' }
|
||||
{ label: 'Clear Project History', command: 'application:clear-project-history' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
{ localisedLabel: 'core.menu.file.reopen-last-item', command: 'pane:reopen-closed-item' }
|
||||
{ label: 'Reopen Last Item', command: 'pane:reopen-closed-item' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.file.save', command: 'core:save' }
|
||||
{ localisedLabel: 'core.menu.file.save-as', command: 'core:save-as' }
|
||||
{ localisedLabel: 'core.menu.file.save-all', command: 'window:save-all' }
|
||||
{ label: 'Save', command: 'core:save' }
|
||||
{ label: 'Save As…', command: 'core:save-as' }
|
||||
{ label: 'Save All', command: 'window:save-all' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.file.close-tab', command: 'core:close' }
|
||||
{ localisedLabel: 'core.menu.file.close-pane', command: 'pane:close' }
|
||||
{ localisedLabel: 'core.menu.file.close-window', command: 'window:close' }
|
||||
{ label: 'Close Tab', command: 'core:close' }
|
||||
{ label: 'Close Pane', command: 'pane:close' }
|
||||
{ label: 'Close Window', command: 'window:close' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.self'
|
||||
label: 'Edit'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.undo', command: 'core:undo' }
|
||||
{ localisedLabel: 'core.menu.edit.redo', command: 'core:redo' }
|
||||
{ label: 'Undo', command: 'core:undo' }
|
||||
{ label: 'Redo', command: 'core:redo' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.cut', command: 'core:cut' }
|
||||
{ localisedLabel: 'core.menu.edit.copy', command: 'core:copy' }
|
||||
{ localisedLabel: 'core.menu.edit.copy-path', command: 'editor:copy-path' }
|
||||
{ localisedLabel: 'core.menu.edit.paste', command: 'core:paste' }
|
||||
{ localisedLabel: 'core.menu.edit.paste-without-reformatting', command: 'editor:paste-without-reformatting' }
|
||||
{ localisedLabel: 'core.menu.edit.select-all', command: 'core:select-all' }
|
||||
{ label: 'Cut', command: 'core:cut' }
|
||||
{ label: 'Copy', command: 'core:copy' }
|
||||
{ label: 'Copy Path', command: 'editor:copy-path' }
|
||||
{ label: 'Paste', command: 'core:paste' }
|
||||
{ label: 'Paste Without Reformatting', command: 'editor:paste-without-reformatting' }
|
||||
{ label: 'Select All', command: 'core:select-all' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.toggle-comments', command: 'editor:toggle-line-comments' }
|
||||
{ label: 'Toggle Comments', command: 'editor:toggle-line-comments' }
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.lines.self',
|
||||
label: 'Lines',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.lines.indent', command: 'editor:indent-selected-rows' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.outdent', command: 'editor:outdent-selected-rows' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.auto-indent', command: 'editor:auto-indent' }
|
||||
{ label: 'Indent', command: 'editor:indent-selected-rows' }
|
||||
{ label: 'Outdent', command: 'editor:outdent-selected-rows' }
|
||||
{ label: 'Auto Indent', command: 'editor:auto-indent' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.move-up', command: 'editor:move-line-up' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.move-down', command: 'editor:move-line-down' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.duplicate', command: 'editor:duplicate-lines' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.delete', command: 'editor:delete-line' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.join', command: 'editor:join-lines' }
|
||||
{ label: 'Move Line Up', command: 'editor:move-line-up' }
|
||||
{ label: 'Move Line Down', command: 'editor:move-line-down' }
|
||||
{ label: 'Duplicate Lines', command: 'editor:duplicate-lines' }
|
||||
{ label: 'Delete Line', command: 'editor:delete-line' }
|
||||
{ label: 'Join Lines', command: 'editor:join-lines' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.columns.self'
|
||||
label: 'Columns',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.columns.move-selection-left', command: 'editor:move-selection-left' }
|
||||
{ localisedLabel: 'core.menu.edit.columns.move-selection-right', command: 'editor:move-selection-right' }
|
||||
{ label: 'Move Selection Left', command: 'editor:move-selection-left' }
|
||||
{ label: 'Move Selection Right', command: 'editor:move-selection-right' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.text.self'
|
||||
label: 'Text',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.text.upper-case', command: 'editor:upper-case' }
|
||||
{ localisedLabel: 'core.menu.edit.text.lower-case', command: 'editor:lower-case' }
|
||||
{ label: 'Upper Case', command: 'editor:upper-case' }
|
||||
{ label: 'Lower Case', command: 'editor:lower-case' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-to-end-of-word', command: 'editor:delete-to-end-of-word' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-to-previous-word-boundary', command: 'editor:delete-to-previous-word-boundary' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-to-next-word-boundary', command: 'editor:delete-to-next-word-boundary' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-line', command: 'editor:delete-line' }
|
||||
{ label: 'Delete to End of Word', command: 'editor:delete-to-end-of-word' }
|
||||
{ label: 'Delete to Previous Word Boundary', command: 'editor:delete-to-previous-word-boundary' }
|
||||
{ label: 'Delete to Next Word Boundary', command: 'editor:delete-to-next-word-boundary' }
|
||||
{ label: 'Delete Line', command: 'editor:delete-line' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.text.transpose', command: 'editor:transpose' }
|
||||
{ label: 'Transpose', command: 'editor:transpose' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.folding.self'
|
||||
label: 'Folding',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold', command: 'editor:fold-current-row' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.unfold', command: 'editor:unfold-current-row' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-all', command: 'editor:fold-all' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.unfold-all', command: 'editor:unfold-all' }
|
||||
{ label: 'Fold', command: 'editor:fold-current-row' }
|
||||
{ label: 'Unfold', command: 'editor:unfold-current-row' }
|
||||
{ label: 'Fold All', command: 'editor:fold-all' }
|
||||
{ label: 'Unfold All', command: 'editor:unfold-all' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-1', command: 'editor:fold-at-indent-level-1' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-2', command: 'editor:fold-at-indent-level-2' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-3', command: 'editor:fold-at-indent-level-3' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-4', command: 'editor:fold-at-indent-level-4' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-5', command: 'editor:fold-at-indent-level-5' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-6', command: 'editor:fold-at-indent-level-6' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-7', command: 'editor:fold-at-indent-level-7' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-8', command: 'editor:fold-at-indent-level-8' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-9', command: 'editor:fold-at-indent-level-9' }
|
||||
{ label: 'Fold Level 1', command: 'editor:fold-at-indent-level-1' }
|
||||
{ label: 'Fold Level 2', command: 'editor:fold-at-indent-level-2' }
|
||||
{ label: 'Fold Level 3', command: 'editor:fold-at-indent-level-3' }
|
||||
{ label: 'Fold Level 4', command: 'editor:fold-at-indent-level-4' }
|
||||
{ label: 'Fold Level 5', command: 'editor:fold-at-indent-level-5' }
|
||||
{ label: 'Fold Level 6', command: 'editor:fold-at-indent-level-6' }
|
||||
{ label: 'Fold Level 7', command: 'editor:fold-at-indent-level-7' }
|
||||
{ label: 'Fold Level 8', command: 'editor:fold-at-indent-level-8' }
|
||||
{ label: 'Fold Level 9', command: 'editor:fold-at-indent-level-9' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.view.self'
|
||||
label: 'View'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.view.toggle-full-screen', command: 'window:toggle-full-screen' }
|
||||
{ label: 'Toggle Full Screen', command: 'window:toggle-full-screen' }
|
||||
{
|
||||
localisedLabel: 'core.menu.view.panes.self'
|
||||
label: 'Panes'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.view.panes.split-up', command: 'pane:split-up-and-copy-active-item' }
|
||||
{ localisedLabel: 'core.menu.view.panes.split-down', command: 'pane:split-down-and-copy-active-item' }
|
||||
{ localisedLabel: 'core.menu.view.panes.split-left', command: 'pane:split-left-and-copy-active-item' }
|
||||
{ localisedLabel: 'core.menu.view.panes.split-right', command: 'pane:split-right-and-copy-active-item' }
|
||||
{ label: 'Split Up', command: 'pane:split-up-and-copy-active-item' }
|
||||
{ label: 'Split Down', command: 'pane:split-down-and-copy-active-item' }
|
||||
{ label: 'Split Left', command: 'pane:split-left-and-copy-active-item' }
|
||||
{ label: 'Split Right', command: 'pane:split-right-and-copy-active-item' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-next', command: 'window:focus-next-pane' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-previous', command: 'window:focus-previous-pane' }
|
||||
{ label: 'Focus Next Pane', command: 'window:focus-next-pane' }
|
||||
{ label: 'Focus Previous Pane', command: 'window:focus-previous-pane' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-above', command: 'window:focus-pane-above' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-below', command: 'window:focus-pane-below' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-on-left', command: 'window:focus-pane-on-left' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-on-right', command: 'window:focus-pane-on-right' }
|
||||
{ label: 'Focus Pane Above', command: 'window:focus-pane-above' }
|
||||
{ label: 'Focus Pane Below', command: 'window:focus-pane-below' }
|
||||
{ label: 'Focus Pane On Left', command: 'window:focus-pane-on-left' }
|
||||
{ label: 'Focus Pane On Right', command: 'window:focus-pane-on-right' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.panes.close', command: 'pane:close' }
|
||||
{ label: 'Close Pane', command: 'pane:close' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.view.developer.self'
|
||||
label: 'Developer'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.view.developer.open-in-dev-mode', command: 'application:open-dev' }
|
||||
{ localisedLabel: 'core.menu.view.developer.reload-window', command: 'window:reload' }
|
||||
{ localisedLabel: 'core.menu.view.developer.run-package-specs', command: 'window:run-package-specs' }
|
||||
{ localisedLabel: 'core.menu.view.developer.toggle-dev-tools', command: 'window:toggle-dev-tools' }
|
||||
{ label: 'Open In Dev Mode…', command: 'application:open-dev' }
|
||||
{ label: 'Reload Window', command: 'window:reload' }
|
||||
{ label: 'Run Package Specs', command: 'window:run-package-specs' }
|
||||
{ label: 'Toggle Developer Tools', command: 'window:toggle-dev-tools' }
|
||||
]
|
||||
}
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.increase-font-size', command: 'window:increase-font-size' }
|
||||
{ localisedLabel: 'core.menu.view.decrease-font-size', command: 'window:decrease-font-size' }
|
||||
{ localisedLabel: 'core.menu.view.reset-font-size', command: 'window:reset-font-size' }
|
||||
{ label: 'Increase Font Size', command: 'window:increase-font-size' }
|
||||
{ label: 'Decrease Font Size', command: 'window:decrease-font-size' }
|
||||
{ label: 'Reset Font Size', command: 'window:reset-font-size' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.toggle-soft-wrap', command: 'editor:toggle-soft-wrap' }
|
||||
{ label: 'Toggle Soft Wrap', command: 'editor:toggle-soft-wrap' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.selection.self'
|
||||
label: 'Selection'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.selection.add-above', command: 'editor:add-selection-above' }
|
||||
{ localisedLabel: 'core.menu.selection.add-below', command: 'editor:add-selection-below' }
|
||||
{ localisedLabel: 'core.menu.selection.single', command: 'editor:consolidate-selections' }
|
||||
{ localisedLabel: 'core.menu.selection.split-into-lines', command: 'editor:split-selections-into-lines' }
|
||||
{ label: 'Add Selection Above', command: 'editor:add-selection-above' }
|
||||
{ label: 'Add Selection Below', command: 'editor:add-selection-below' }
|
||||
{ label: 'Single Selection', command: 'editor:consolidate-selections'}
|
||||
{ label: 'Split into Lines', command: 'editor:split-selections-into-lines'}
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.selection.to-top', command: 'core:select-to-top' }
|
||||
{ localisedLabel: 'core.menu.selection.to-bottom', command: 'core:select-to-bottom' }
|
||||
{ label: 'Select to Top', command: 'core:select-to-top' }
|
||||
{ label: 'Select to Bottom', command: 'core:select-to-bottom' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.selection.line', command: 'editor:select-line' }
|
||||
{ localisedLabel: 'core.menu.selection.word', command: 'editor:select-word' }
|
||||
{ localisedLabel: 'core.menu.selection.to-beginning-of-word', command: 'editor:select-to-beginning-of-word' }
|
||||
{ localisedLabel: 'core.menu.selection.to-beginning-of-line', command: 'editor:select-to-beginning-of-line' }
|
||||
{ localisedLabel: 'core.menu.selection.to-first-char-of-line', command: 'editor:select-to-first-character-of-line' }
|
||||
{ localisedLabel: 'core.menu.selection.to-end-of-word', command: 'editor:select-to-end-of-word' }
|
||||
{ localisedLabel: 'core.menu.selection.to-end-of-line', command: 'editor:select-to-end-of-line' }
|
||||
{ label: 'Select Line', command: 'editor:select-line' }
|
||||
{ label: 'Select Word', command: 'editor:select-word' }
|
||||
{ label: 'Select to Beginning of Word', command: 'editor:select-to-beginning-of-word' }
|
||||
{ label: 'Select to Beginning of Line', command: 'editor:select-to-beginning-of-line' }
|
||||
{ label: 'Select to First Character of Line', command: 'editor:select-to-first-character-of-line' }
|
||||
{ label: 'Select to End of Word', command: 'editor:select-to-end-of-word' }
|
||||
{ label: 'Select to End of Line', command: 'editor:select-to-end-of-line' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.find.self'
|
||||
label: 'Find'
|
||||
submenu: []
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.packages.self'
|
||||
label: 'Packages'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.packages.open-package-manager', command: 'settings-view:view-installed-packages' }
|
||||
{ label: 'Open Package Manager', command: 'settings-view:view-installed-packages' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.window.self'
|
||||
label: 'Window'
|
||||
role: 'window'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.window.minimise', command: 'application:minimize' }
|
||||
{ localisedLabel: 'core.menu.window.zoom', command: 'application:zoom' }
|
||||
{ label: 'Minimize', command: 'application:minimize' }
|
||||
{ label: 'Zoom', command: 'application:zoom' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.window.bring-all-to-front', command: 'application:bring-all-windows-to-front' }
|
||||
{ label: 'Bring All to Front', command: 'application:bring-all-windows-to-front' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.help.self'
|
||||
label: 'Help'
|
||||
role: 'help'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.help.terms-of-use', command: 'application:open-terms-of-use' }
|
||||
{ localisedLabel: 'core.menu.help.docs', command: 'application:open-documentation' }
|
||||
{ localisedLabel: 'core.menu.help.faq', command: 'application:open-faq' }
|
||||
{ label: 'Terms of Use', command: 'application:open-terms-of-use' }
|
||||
{ label: 'Documentation', command: 'application:open-documentation' }
|
||||
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.help.community-discussions', command: 'application:open-discussions' }
|
||||
{ localisedLabel: 'core.menu.help.report-issue', command: 'application:report-issue' }
|
||||
{ localisedLabel: 'core.menu.help.search-issues', command: 'application:search-issues' }
|
||||
{ label: 'Community Discussions', command: 'application:open-discussions' }
|
||||
{ label: 'Report Issue', command: 'application:report-issue' }
|
||||
{ label: 'Search Issues', command: 'application:search-issues' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
|
234
menus/linux.cson
234
menus/linux.cson
@ -1,204 +1,204 @@
|
||||
'menu': [
|
||||
{
|
||||
localisedLabel: 'core.menu.file.self' # accelerator F
|
||||
label: '&File'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.file.new-window', command: 'application:new-window' } # accelerator W
|
||||
{ localisedLabel: 'core.menu.file.new-file', command: 'application:new-file' } # accelerator N
|
||||
{ localisedLabel: 'core.menu.file.open-file', command: 'application:open-file' } # accelerator O
|
||||
{ localisedLabel: 'core.menu.file.open-folder', command: 'application:open-folder' }
|
||||
{ localisedLabel: 'core.menu.file.add-project-folder', command: 'application:add-project-folder' }
|
||||
{ label: 'New &Window', command: 'application:new-window' }
|
||||
{ label: '&New File', command: 'application:new-file' }
|
||||
{ label: '&Open File…', command: 'application:open-file' }
|
||||
{ label: 'Open Folder…', command: 'application:open-folder' }
|
||||
{ label: 'Add Project Folder…', command: 'application:add-project-folder' }
|
||||
{
|
||||
localisedLabel: 'core.menu.file.project-history.reopen-project'
|
||||
label: 'Reopen Project',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.file.project-history.clear', command: 'application:clear-project-history' }
|
||||
{ label: 'Clear Project History', command: 'application:clear-project-history' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
{ localisedLabel: 'core.menu.file.reopen-last-item', command: 'pane:reopen-closed-item' } # accelerator I
|
||||
{ label: 'Reopen Last &Item', command: 'pane:reopen-closed-item' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.file.save', command: 'core:save' } # accelerator S
|
||||
{ localisedLabel: 'core.menu.file.save-as', command: 'core:save-as' } # accelerator A
|
||||
{ localisedLabel: 'core.menu.file.save-all', command: 'window:save-all' } # accelerator L
|
||||
{ label: '&Save', command: 'core:save' }
|
||||
{ label: 'Save &As…', command: 'core:save-as' }
|
||||
{ label: 'Save A&ll', command: 'window:save-all' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.file.close-tab', command: 'core:close' } # accelerator C
|
||||
{ localisedLabel: 'core.menu.file.close-pane', command: 'pane:close' } # accelerator P
|
||||
{ localisedLabel: 'core.menu.file.close-window', command: 'window:close' } # accelerator E
|
||||
{ label: '&Close Tab', command: 'core:close' }
|
||||
{ label: 'Close &Pane', command: 'pane:close' }
|
||||
{ label: 'Clos&e Window', command: 'window:close' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.quit', command: 'application:quit' }
|
||||
{ label: 'Quit', command: 'application:quit' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.self' # accelerator E
|
||||
label: '&Edit'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.undo', command: 'core:undo' } # accelerator U
|
||||
{ localisedLabel: 'core.menu.edit.redo', command: 'core:redo' } # accelerator R
|
||||
{ label: '&Undo', command: 'core:undo' }
|
||||
{ label: '&Redo', command: 'core:redo' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.cut', command: 'core:cut' } # accelerator C
|
||||
{ localisedLabel: 'core.menu.edit.copy', command: 'core:copy' } # accelerator O
|
||||
{ localisedLabel: 'core.menu.edit.copy-path', command: 'editor:copy-path' } # accelerator H
|
||||
{ localisedLabel: 'core.menu.edit.paste', command: 'core:paste' } # accelerator P
|
||||
{ localisedLabel: 'core.menu.edit.paste-without-reformatting', command: 'editor:paste-without-reformatting' }
|
||||
{ localisedLabel: 'core.menu.edit.select-all', command: 'core:select-all' } # accelerator A
|
||||
{ label: '&Cut', command: 'core:cut' }
|
||||
{ label: 'C&opy', command: 'core:copy' }
|
||||
{ label: 'Copy Pat&h', command: 'editor:copy-path' }
|
||||
{ label: '&Paste', command: 'core:paste' }
|
||||
{ label: 'Paste Without Reformatting', command: 'editor:paste-without-reformatting' }
|
||||
{ label: 'Select &All', command: 'core:select-all' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.toggle-comments', command: 'editor:toggle-line-comments' } # accelerator T
|
||||
{ label: '&Toggle Comments', command: 'editor:toggle-line-comments' }
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.lines.self'
|
||||
label: 'Lines',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.lines.indent', command: 'editor:indent-selected-rows' } # accelerator I
|
||||
{ localisedLabel: 'core.menu.edit.lines.outdent', command: 'editor:outdent-selected-rows' } # accelerator O
|
||||
{ localisedLabel: 'core.menu.edit.lines.auto-indent', command: 'editor:auto-indent' } # accelerator A
|
||||
{ label: '&Indent', command: 'editor:indent-selected-rows' }
|
||||
{ label: '&Outdent', command: 'editor:outdent-selected-rows' }
|
||||
{ label: '&Auto Indent', command: 'editor:auto-indent' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.lines.move-up', command: 'editor:move-line-up' } # accelerator U
|
||||
{ localisedLabel: 'core.menu.edit.lines.move-down', command: 'editor:move-line-down' } # accelerator D
|
||||
{ localisedLabel: 'core.menu.edit.lines.duplicate', command: 'editor:duplicate-lines' } # accelerator P
|
||||
{ localisedLabel: 'core.menu.edit.lines.delete', command: 'editor:delete-line' } # accelerator E
|
||||
{ localisedLabel: 'core.menu.edit.lines.join', command: 'editor:join-lines' } # accelerator J
|
||||
{ label: 'Move Line &Up', command: 'editor:move-line-up' }
|
||||
{ label: 'Move Line &Down', command: 'editor:move-line-down' }
|
||||
{ label: 'Du&plicate Lines', command: 'editor:duplicate-lines' }
|
||||
{ label: 'D&elete Line', command: 'editor:delete-line' }
|
||||
{ label: '&Join Lines', command: 'editor:join-lines' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.columns.self'
|
||||
label: 'Columns',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.columns.move-selection-left', command: 'editor:move-selection-left' } # accelerator L
|
||||
{ localisedLabel: 'core.menu.edit.columns.move-selection-right', command: 'editor:move-selection-right' } # accelerator R
|
||||
{ label: 'Move Selection &Left', command: 'editor:move-selection-left' }
|
||||
{ label: 'Move Selection &Right', command: 'editor:move-selection-right' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.text.self'
|
||||
label: 'Text',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.text.upper-case', command: 'editor:upper-case' } # accelerator U
|
||||
{ localisedLabel: 'core.menu.edit.text.lower-case', command: 'editor:lower-case' } # accelerator L
|
||||
{ label: '&Upper Case', command: 'editor:upper-case' }
|
||||
{ label: '&Lower Case', command: 'editor:lower-case' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-to-end-of-word', command: 'editor:delete-to-end-of-word' } # accelerator W
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-to-previous-word-boundary', command: 'editor:delete-to-previous-word-boundary' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-to-next-word-boundary', command: 'editor:delete-to-next-word-boundary' }
|
||||
{ localisedLabel: 'core.menu.edit.text.delete-line', command: 'editor:delete-line' } # accelerator D
|
||||
{ label: 'Delete to End of &Word', command: 'editor:delete-to-end-of-word' }
|
||||
{ label: 'Delete to Previous Word Boundary', command: 'editor:delete-to-previous-word-boundary' }
|
||||
{ label: 'Delete to Next Word Boundary', command: 'editor:delete-to-next-word-boundary' }
|
||||
{ label: '&Delete Line', command: 'editor:delete-line' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.text.transpose', command: 'editor:transpose' } # accelerator T
|
||||
{ label: '&Transpose', command: 'editor:transpose' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.edit.folding.self'
|
||||
label: 'Folding',
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold', command: 'editor:fold-current-row' } # accelerator F
|
||||
{ localisedLabel: 'core.menu.edit.folding.unfold', command: 'editor:unfold-current-row' } # accelerator U
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-all', command: 'editor:fold-all' } # accelerator D
|
||||
{ localisedLabel: 'core.menu.edit.folding.unfold-all', command: 'editor:unfold-all' } # accelerator A
|
||||
{ label: '&Fold', command: 'editor:fold-current-row' }
|
||||
{ label: '&Unfold', command: 'editor:unfold-current-row' }
|
||||
{ label: 'Fol&d All', command: 'editor:fold-all' }
|
||||
{ label: 'Unfold &All', command: 'editor:unfold-all' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-1', command: 'editor:fold-at-indent-level-1' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-2', command: 'editor:fold-at-indent-level-2' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-3', command: 'editor:fold-at-indent-level-3' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-4', command: 'editor:fold-at-indent-level-4' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-5', command: 'editor:fold-at-indent-level-5' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-6', command: 'editor:fold-at-indent-level-6' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-7', command: 'editor:fold-at-indent-level-7' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-8', command: 'editor:fold-at-indent-level-8' }
|
||||
{ localisedLabel: 'core.menu.edit.folding.fold-level-9', command: 'editor:fold-at-indent-level-9' }
|
||||
{ label: 'Fold Level 1', command: 'editor:fold-at-indent-level-1' }
|
||||
{ label: 'Fold Level 2', command: 'editor:fold-at-indent-level-2' }
|
||||
{ label: 'Fold Level 3', command: 'editor:fold-at-indent-level-3' }
|
||||
{ label: 'Fold Level 4', command: 'editor:fold-at-indent-level-4' }
|
||||
{ label: 'Fold Level 5', command: 'editor:fold-at-indent-level-5' }
|
||||
{ label: 'Fold Level 6', command: 'editor:fold-at-indent-level-6' }
|
||||
{ label: 'Fold Level 7', command: 'editor:fold-at-indent-level-7' }
|
||||
{ label: 'Fold Level 8', command: 'editor:fold-at-indent-level-8' }
|
||||
{ label: 'Fold Level 9', command: 'editor:fold-at-indent-level-9' }
|
||||
]
|
||||
}
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.preferences', command: 'application:show-settings' } # accelerator P
|
||||
{ label: '&Preferences', command: 'application:show-settings' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.config', command: 'application:open-your-config' }
|
||||
{ localisedLabel: 'core.menu.pulsar.init-script', command: 'application:open-your-init-script' }
|
||||
{ localisedLabel: 'core.menu.pulsar.keymap', command: 'application:open-your-keymap' }
|
||||
{ localisedLabel: 'core.menu.pulsar.snippets', command: 'application:open-your-snippets' }
|
||||
{ localisedLabel: 'core.menu.pulsar.stylesheet', command: 'application:open-your-stylesheet' }
|
||||
{ label: 'Config…', command: 'application:open-your-config' }
|
||||
{ label: 'Init Script…', command: 'application:open-your-init-script' }
|
||||
{ label: 'Keymap…', command: 'application:open-your-keymap' }
|
||||
{ label: 'Snippets…', command: 'application:open-your-snippets' }
|
||||
{ label: 'Stylesheet…', command: 'application:open-your-stylesheet' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.view.self' # accelerator V
|
||||
label: '&View'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.view.toggle-full-screen', command: 'window:toggle-full-screen' } # accelerator F
|
||||
{ localisedLabel: 'core.menu.view.toggle-menu-bar', command: 'window:toggle-menu-bar' }
|
||||
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
|
||||
{ label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' }
|
||||
{
|
||||
localisedLabel: 'core.menu.view.panes.self'
|
||||
label: 'Panes'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.view.panes.split-up', command: 'pane:split-up-and-copy-active-item' }
|
||||
{ localisedLabel: 'core.menu.view.panes.split-down', command: 'pane:split-down-and-copy-active-item' }
|
||||
{ localisedLabel: 'core.menu.view.panes.split-left', command: 'pane:split-left-and-copy-active-item' }
|
||||
{ localisedLabel: 'core.menu.view.panes.split-right', command: 'pane:split-right-and-copy-active-item' }
|
||||
{ label: 'Split Up', command: 'pane:split-up-and-copy-active-item' }
|
||||
{ label: 'Split Down', command: 'pane:split-down-and-copy-active-item' }
|
||||
{ label: 'Split Left', command: 'pane:split-left-and-copy-active-item' }
|
||||
{ label: 'Split Right', command: 'pane:split-right-and-copy-active-item' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-next', command: 'window:focus-next-pane' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-previous', command: 'window:focus-previous-pane' }
|
||||
{ label: 'Focus Next Pane', command: 'window:focus-next-pane' }
|
||||
{ label: 'Focus Previous Pane', command: 'window:focus-previous-pane' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-above', command: 'window:focus-pane-above' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-below', command: 'window:focus-pane-below' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-on-left', command: 'window:focus-pane-on-left' }
|
||||
{ localisedLabel: 'core.menu.view.panes.focus-on-right', command: 'window:focus-pane-on-right' }
|
||||
{ label: 'Focus Pane Above', command: 'window:focus-pane-above' }
|
||||
{ label: 'Focus Pane Below', command: 'window:focus-pane-below' }
|
||||
{ label: 'Focus Pane On Left', command: 'window:focus-pane-on-left' }
|
||||
{ label: 'Focus Pane On Right', command: 'window:focus-pane-on-right' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.panes.close', command: 'pane:close' }
|
||||
{ label: 'Close Pane', command: 'pane:close' }
|
||||
]
|
||||
}
|
||||
{
|
||||
localisedLabel: 'core.menu.view.developer.self'
|
||||
label: 'Developer'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.view.developer.open-in-dev-mode', command: 'application:open-dev' } # accelerator D
|
||||
{ localisedLabel: 'core.menu.view.developer.reload-window', command: 'window:reload' } # accelerator R
|
||||
{ localisedLabel: 'core.menu.view.developer.run-package-specs', command: 'window:run-package-specs' } # accelerator S
|
||||
{ localisedLabel: 'core.menu.view.developer.toggle-dev-tools', command: 'window:toggle-dev-tools' } # accelerator T
|
||||
{ label: 'Open In &Dev Mode…', command: 'application:open-dev' }
|
||||
{ label: '&Reload Window', command: 'window:reload' }
|
||||
{ label: 'Run Package &Specs', command: 'window:run-package-specs' }
|
||||
{ label: 'Toggle Developer &Tools', command: 'window:toggle-dev-tools' }
|
||||
]
|
||||
}
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.increase-font-size', command: 'window:increase-font-size' } # accelerator I
|
||||
{ localisedLabel: 'core.menu.view.decrease-font-size', command: 'window:decrease-font-size' } # accelerator D
|
||||
{ localisedLabel: 'core.menu.view.reset-font-size', command: 'window:reset-font-size' } # accelerator S
|
||||
{ label: '&Increase Font Size', command: 'window:increase-font-size' }
|
||||
{ label: '&Decrease Font Size', command: 'window:decrease-font-size' }
|
||||
{ label: 'Re&set Font Size', command: 'window:reset-font-size' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.view.toggle-soft-wrap', command: 'editor:toggle-soft-wrap' } # accelerator W
|
||||
{ label: 'Toggle Soft &Wrap', command: 'editor:toggle-soft-wrap' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.selection.self' # accelerator S
|
||||
label: '&Selection'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.selection.add-above', command: 'editor:add-selection-above' } # accelerator A
|
||||
{ localisedLabel: 'core.menu.selection.add-below', command: 'editor:add-selection-below' } # accelerator B
|
||||
{ localisedLabel: 'core.menu.selection.single', command: 'editor:consolidate-selections' }
|
||||
{ localisedLabel: 'core.menu.selection.split-into-lines', command: 'editor:split-selections-into-lines' } # accelerator P
|
||||
{ label: 'Add Selection &Above', command: 'editor:add-selection-above' }
|
||||
{ label: 'Add Selection &Below', command: 'editor:add-selection-below' }
|
||||
{ label: 'S&plit into Lines', command: 'editor:split-selections-into-lines'}
|
||||
{ label: 'Single Selection', command: 'editor:consolidate-selections'}
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.selection.to-top', command: 'core:select-to-top' } # accelerator T
|
||||
{ localisedLabel: 'core.menu.selection.to-bottom', command: 'core:select-to-bottom' } # accelerator M
|
||||
{ label: 'Select to &Top', command: 'core:select-to-top' }
|
||||
{ label: 'Select to Botto&m', command: 'core:select-to-bottom' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.selection.line', command: 'editor:select-line' } # accelerator L
|
||||
{ localisedLabel: 'core.menu.selection.word', command: 'editor:select-word' } # accelerator W
|
||||
{ localisedLabel: 'core.menu.selection.to-beginning-of-word', command: 'editor:select-to-beginning-of-word' } # accelerator O
|
||||
{ localisedLabel: 'core.menu.selection.to-beginning-of-line', command: 'editor:select-to-beginning-of-line' } # accelerator I
|
||||
{ localisedLabel: 'core.menu.selection.to-first-char-of-line', command: 'editor:select-to-first-character-of-line' } # accelerator C
|
||||
{ localisedLabel: 'core.menu.selection.to-end-of-word', command: 'editor:select-to-end-of-word' } # accelerator D
|
||||
{ localisedLabel: 'core.menu.selection.to-end-of-line', command: 'editor:select-to-end-of-line' } # accelerator E
|
||||
{ label: 'Select &Line', command: 'editor:select-line' }
|
||||
{ label: 'Select &Word', command: 'editor:select-word' }
|
||||
{ label: 'Select to Beginning of W&ord', command: 'editor:select-to-beginning-of-word' }
|
||||
{ label: 'Select to Beginning of L&ine', command: 'editor:select-to-beginning-of-line' }
|
||||
{ label: 'Select to First &Character of Line', command: 'editor:select-to-first-character-of-line' }
|
||||
{ label: 'Select to End of Wor&d', command: 'editor:select-to-end-of-word' }
|
||||
{ label: 'Select to End of Lin&e', command: 'editor:select-to-end-of-line' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.find.self' # accelerator I
|
||||
label: 'F&ind'
|
||||
submenu: []
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.packages.self' # accelerator P
|
||||
label: '&Packages'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.packages.open-package-manager', command: 'settings-view:view-installed-packages' }
|
||||
{ label: 'Open Package Manager', command: 'settings-view:view-installed-packages' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
localisedLabel: 'core.menu.help.self' # accelerator H
|
||||
label: '&Help'
|
||||
submenu: [
|
||||
{ localisedLabel: 'core.menu.help.terms-of-use', command: 'application:open-terms-of-use' } # accelerator T
|
||||
{ localisedLabel: 'core.menu.pulsar.view-license', command: 'application:open-license' } # accelerator L
|
||||
{ localisedLabel: 'core.menu.pulsar.version', enabled: false }
|
||||
{ label: 'View &Terms of Use', command: 'application:open-terms-of-use' }
|
||||
{ label: 'View &License', command: 'application:open-license' }
|
||||
{ label: "VERSION", enabled: false }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.help.docs', command: 'application:open-documentation' } # accelerator D
|
||||
{ localisedLabel: 'core.menu.help.faq', command: 'application:open-faq' }
|
||||
{ label: '&Documentation', command: 'application:open-documentation' }
|
||||
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.help.community-discussions', command: 'application:open-discussions' }
|
||||
{ localisedLabel: 'core.menu.help.report-issue', 'application:report-issue' }
|
||||
{ localisedLabel: 'core.menu.help.search-issues', command: 'application:search-issues' }
|
||||
{ label: 'Community Discussions', command: 'application:open-discussions' }
|
||||
{ label: 'Report Issue', command: 'application:report-issue' }
|
||||
{ label: 'Search Issues', command: 'application:search-issues' }
|
||||
{ type: 'separator' }
|
||||
{ localisedLabel: 'core.menu.pulsar.about', command: 'application:about' }
|
||||
{ label: 'About Pulsar', command: 'application:about' }
|
||||
{ type: 'separator' }
|
||||
]
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
"dependencies": {
|
||||
"@atom/source-map-support": "^0.3.4",
|
||||
"@babel/core": "7.18.6",
|
||||
"@formatjs/icu-messageformat-parser": "^2.3.0",
|
||||
"about": "file:packages/about",
|
||||
"archive-view": "file:packages/archive-view",
|
||||
"async": "3.2.4",
|
||||
@ -78,7 +77,6 @@
|
||||
"grim": "2.0.3",
|
||||
"image-view": "file:packages/image-view",
|
||||
"incompatible-packages": "file:packages/incompatible-packages",
|
||||
"intl-messageformat": "^10.3.3",
|
||||
"jasmine-json": "~0.0",
|
||||
"jasmine-reporters": "1.1.0",
|
||||
"jasmine-tagged": "^1.1.4",
|
||||
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"title": "Welcome"
|
||||
}
|
@ -2,6 +2,4 @@
|
||||
|
||||
import WelcomePackage from './welcome-package';
|
||||
|
||||
export const t = atom.i18n.getT("welcome");
|
||||
|
||||
export default new WelcomePackage();
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
import etch from 'etch';
|
||||
import path from 'path';
|
||||
import { t } from "./main";
|
||||
|
||||
export default class WelcomeView {
|
||||
constructor(props) {
|
||||
@ -127,7 +126,7 @@ export default class WelcomeView {
|
||||
}
|
||||
|
||||
getTitle() {
|
||||
return t("title");
|
||||
return 'Welcome';
|
||||
}
|
||||
|
||||
isEqual(other) {
|
||||
|
@ -53,7 +53,6 @@ let options = {
|
||||
"package.json",
|
||||
"dot-atom/**/*",
|
||||
"exports/**/*",
|
||||
"i18n/**/*",
|
||||
"resources/**/*",
|
||||
"src/**/*",
|
||||
"static/**/*",
|
||||
|
@ -46,7 +46,6 @@ const TextEditorRegistry = require('./text-editor-registry');
|
||||
const AutoUpdateManager = require('./auto-update-manager');
|
||||
const StartupTime = require('./startup-time');
|
||||
const getReleaseChannel = require('./get-release-channel');
|
||||
const I18n = require("./i18n");
|
||||
const packagejson = require("../package.json");
|
||||
|
||||
const stat = util.promisify(fs.stat);
|
||||
@ -126,11 +125,6 @@ class AtomEnvironment {
|
||||
/** @type {StyleManager} */
|
||||
this.styles = new StyleManager();
|
||||
|
||||
this.i18n = new I18n({
|
||||
notificationManager: this.notifications,
|
||||
config: this.config
|
||||
});
|
||||
|
||||
/** @type {PackageManager} */
|
||||
this.packages = new PackageManager({
|
||||
config: this.config,
|
||||
@ -141,8 +135,7 @@ class AtomEnvironment {
|
||||
grammarRegistry: this.grammars,
|
||||
deserializerManager: this.deserializers,
|
||||
viewRegistry: this.views,
|
||||
uriHandlerRegistry: this.uriHandlerRegistry,
|
||||
i18n: this.i18n
|
||||
uriHandlerRegistry: this.uriHandlerRegistry
|
||||
});
|
||||
|
||||
/** @type {ThemeManager} */
|
||||
@ -156,7 +149,6 @@ class AtomEnvironment {
|
||||
|
||||
/** @type {MenuManager} */
|
||||
this.menu = new MenuManager({
|
||||
i18n: this.i18n,
|
||||
keymapManager: this.keymaps,
|
||||
packageManager: this.packages
|
||||
});
|
||||
@ -282,19 +274,6 @@ class AtomEnvironment {
|
||||
this.project.replace(projectSpecification);
|
||||
}
|
||||
|
||||
this.packages.initialize({
|
||||
devMode,
|
||||
configDirPath: this.configDirPath,
|
||||
resourcePath,
|
||||
safeMode
|
||||
});
|
||||
|
||||
this.i18n.initialize({
|
||||
configDirPath: this.configDirPath,
|
||||
packages: this.packages,
|
||||
resourcePath
|
||||
});
|
||||
|
||||
this.menu.initialize({ resourcePath });
|
||||
this.contextMenu.initialize({ resourcePath, devMode });
|
||||
|
||||
@ -308,6 +287,12 @@ class AtomEnvironment {
|
||||
this.commands.attach(this.window);
|
||||
|
||||
this.styles.initialize({ configDirPath: this.configDirPath });
|
||||
this.packages.initialize({
|
||||
devMode,
|
||||
configDirPath: this.configDirPath,
|
||||
resourcePath,
|
||||
safeMode
|
||||
});
|
||||
this.themes.initialize({
|
||||
configDirPath: this.configDirPath,
|
||||
resourcePath,
|
||||
|
@ -1,154 +0,0 @@
|
||||
const _ = require('underscore-plus');
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { parse } = require("@formatjs/icu-messageformat-parser");
|
||||
|
||||
class I18nCacheHelper {
|
||||
constructor({ configDirPath, i18n }) {
|
||||
/**
|
||||
* cachedASTs[ns][lang] = string objs
|
||||
* (same shape as registeredStrings but with ASTs instead of strings)
|
||||
*/
|
||||
this.cachedASTs = {};
|
||||
/** @type {string} */
|
||||
this.configDirPath = configDirPath;
|
||||
this.i18n = i18n;
|
||||
|
||||
this.loadCaches();
|
||||
|
||||
this.debouncedCleanAndSave = _.debounce(() => {
|
||||
this.cleanCaches(this.i18n.registeredStrings);
|
||||
this.saveCaches();
|
||||
}, 5_000);
|
||||
}
|
||||
|
||||
fetchAST(ns, _path, str, lang) {
|
||||
let path = [ns, lang, ..._path];
|
||||
|
||||
let ast = optionalTravelDownObjectPath(
|
||||
this.cachedASTs,
|
||||
path
|
||||
);
|
||||
if (ast && "_AST" in ast) return ast._AST;
|
||||
|
||||
ast = parse(str, {
|
||||
// requiresOtherClause
|
||||
});
|
||||
|
||||
let lastBit = path.pop();
|
||||
let cachePath = travelDownOrMakePath(this.cachedASTs, path);
|
||||
cachePath[lastBit] = { _AST: ast };
|
||||
|
||||
this.debouncedCleanAndSave();
|
||||
|
||||
return ast;
|
||||
}
|
||||
|
||||
/**
|
||||
* go through `this.cachedASTs`, find stuff that doesn't exist in `registeredStrings`,
|
||||
* then yeet them
|
||||
*/
|
||||
cleanCaches(registeredStrings, cachedASTs) {
|
||||
if (!cachedASTs) cachedASTs = this.cachedASTs;
|
||||
|
||||
Object.entries(cachedASTs).forEach(([k, cachedValue]) => {
|
||||
let registeredValue = registeredStrings[k];
|
||||
|
||||
// path doesn't exist
|
||||
if (!registeredValue) {
|
||||
delete cachedASTs[k];
|
||||
return;
|
||||
}
|
||||
|
||||
// path is an object
|
||||
if (typeof registeredValue === "object") {
|
||||
// cached is not AST (plain obj) (good)
|
||||
if (
|
||||
typeof cachedValue === "object"
|
||||
&& !("_AST" in cachedValue)
|
||||
) {
|
||||
this.cleanCaches(registeredValue, cachedValue);
|
||||
return;
|
||||
}
|
||||
// cached is AST (bad)
|
||||
delete cachedASTs[k];
|
||||
return;
|
||||
}
|
||||
|
||||
// path is a string
|
||||
if (typeof registeredValue === "string") {
|
||||
// cached is AST (good)
|
||||
if ("_AST" in cachedValue) return;
|
||||
// cached is not AST (bad)
|
||||
delete cachedASTs[k];
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
saveCaches() {
|
||||
let cachedir = path.join(
|
||||
this.configDirPath,
|
||||
"compile-cache",
|
||||
"i18n"
|
||||
);
|
||||
fs.mkdirSync(cachedir, { recursive: true });
|
||||
|
||||
let cachefile = path.join(cachedir, "strings.json");
|
||||
fs.writeFileSync(cachefile, JSON.stringify(this.cachedASTs));
|
||||
}
|
||||
|
||||
loadCaches() {
|
||||
let cachefile = path.join(
|
||||
this.configDirPath,
|
||||
"compile-cache",
|
||||
"i18n",
|
||||
"strings.json"
|
||||
);
|
||||
if (fs.existsSync(cachefile)) {
|
||||
this.cachedASTs = JSON.parse(fs.readFileSync(cachefile, "utf-8"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function walkStrings(strings, cb, accum = []) {
|
||||
Object.entries(strings).forEach(([k, v]) => {
|
||||
let path = [...accum, k];
|
||||
if (typeof v === "string") cb(path, v, true);
|
||||
else if (typeof v === "object") {
|
||||
cb(path, null, false);
|
||||
walkStrings(v, cb, path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function travelDownObjectPath(obj, path) {
|
||||
for (const pathFragment of path) {
|
||||
obj = obj[pathFragment];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function optionalTravelDownObjectPath(obj, path) {
|
||||
for (const pathFragment of path) {
|
||||
obj = obj[pathFragment];
|
||||
if (!obj) return undefined;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function travelDownOrMakePath(obj, path) {
|
||||
for (const pathFragment of path) {
|
||||
if (!obj[pathFragment]) obj[pathFragment] = {};
|
||||
obj = obj[pathFragment];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
I18nCacheHelper,
|
||||
walkStrings,
|
||||
travelDownObjectPath,
|
||||
optionalTravelDownObjectPath,
|
||||
travelDownOrMakePath
|
||||
};
|
253
src/i18n.js
253
src/i18n.js
@ -1,253 +0,0 @@
|
||||
const { splitKeyPath } = require("key-path-helpers");
|
||||
const fs = require("fs-plus");
|
||||
const path = require("path");
|
||||
const { default: IntlMessageFormat } = require("intl-messageformat");
|
||||
const {
|
||||
I18nCacheHelper,
|
||||
walkStrings,
|
||||
travelDownObjectPath,
|
||||
optionalTravelDownObjectPath,
|
||||
travelDownOrMakePath
|
||||
} = require("./i18n-helpers");
|
||||
|
||||
class I18n {
|
||||
constructor({ notificationManager, config }) {
|
||||
this.notificationManager = notificationManager;
|
||||
this.config = config;
|
||||
this.initialized = false;
|
||||
|
||||
/** registeredStrings[ns][lang] = string objs */
|
||||
this.registeredStrings = { core: {} };
|
||||
this.cachedFormatters = {};
|
||||
}
|
||||
|
||||
initialize({ configDirPath, packages, resourcePath }) {
|
||||
/** @type {string} */
|
||||
this.configDirPath = configDirPath;
|
||||
this.packages = packages;
|
||||
/** @type {string} */
|
||||
this.resourcePath = resourcePath;
|
||||
/** @type {I18nCacheHelper} */
|
||||
this.cacheHelper = new I18nCacheHelper({ configDirPath, i18n: this });
|
||||
|
||||
const ext = ".json";
|
||||
const extlen = ext.length;
|
||||
const dirpath = path.join(resourcePath, "i18n");
|
||||
const dircontents = fs.readdirSync(dirpath);
|
||||
|
||||
let languageTypes = dircontents.filter(p => p.endsWith(ext))
|
||||
.map(p => p.substring(0, p.length - extlen))
|
||||
.map(p => ({
|
||||
value: p,
|
||||
description: `${new Intl.DisplayNames(p, { type: "language" }).of(p)} (${p})`
|
||||
}));
|
||||
|
||||
this.config.setSchema("core.languageSettings", {
|
||||
type: "object",
|
||||
description: "These settings currently require a full restart of Pulsar to take effect.",
|
||||
properties: {
|
||||
primaryLanguage: {
|
||||
type: "string",
|
||||
order: 1,
|
||||
default: "en",
|
||||
enum: languageTypes
|
||||
},
|
||||
fallbackLanguages: {
|
||||
type: "array",
|
||||
order: 2,
|
||||
description: "List of fallback languages, if something can't be found in the primary language. Note; `en` is always the last fallback language, to ensure that things at least show up.",
|
||||
default: [],
|
||||
items: {
|
||||
// Array enum is meh, if you pause for the briefest moment and you
|
||||
// didn't stop at a valid enum value, the entry you just typed gets yeeted
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.updateConfigs();
|
||||
|
||||
// Preload languages (getting an obj would place it in the cache)
|
||||
// TODO reassess preloading the "en" fallback when we have more progress on translations
|
||||
this.getCoreLanguage(this.primaryLanguage);
|
||||
this.getCoreLanguage("en");
|
||||
this.packages.onDidActivatePackage(pkg => {
|
||||
this.getPkgLanguage(pkg.name, this.primaryLanguage);
|
||||
this.getPkgLanguage(pkg.name, "en");
|
||||
});
|
||||
|
||||
this.packages.onDidDeactivatePackage(pkg => {
|
||||
if (pkg.name in this.registeredStrings) {
|
||||
delete this.registeredStrings[pkg.name];
|
||||
}
|
||||
});
|
||||
|
||||
this.t = (key, opts) => {
|
||||
const path = splitKeyPath(key);
|
||||
const languagesToTry = [
|
||||
this.primaryLanguage,
|
||||
...this.fallbackLanguages,
|
||||
"en"
|
||||
];
|
||||
|
||||
for (const lang of languagesToTry) {
|
||||
const str = this.tSingleLanguage(lang, path, opts);
|
||||
if (typeof str === "string") return str;
|
||||
}
|
||||
|
||||
// key fallback
|
||||
let string_opts = opts
|
||||
? `: { ${
|
||||
Object.entries(opts)
|
||||
.map(o => `"${o[0]}": "${o[1]}"`)
|
||||
.join(", ")
|
||||
} }`
|
||||
: "";
|
||||
return `${key}${string_opts}`;
|
||||
}
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
updateConfigs() {
|
||||
this.primaryLanguage = this.config.get("core.languageSettings.primaryLanguage");
|
||||
this.fallbackLanguages = this.config.get("core.languageSettings.fallbackLanguages");
|
||||
}
|
||||
|
||||
registerStrings(packageId, strings) {
|
||||
if (!(typeof this.registeredStrings[packageId] === "object")) this.registeredStrings[packageId] = {};
|
||||
|
||||
walkStrings(strings, (path, string, isString) => {
|
||||
let last = path.pop();
|
||||
|
||||
let obj = travelDownObjectPath(this.registeredStrings[packageId], path);
|
||||
|
||||
if (isString) {
|
||||
obj[last] = string;
|
||||
} else if (!obj[last]) {
|
||||
obj[last] = {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getT(ns) {
|
||||
if (!ns) return this.t;
|
||||
return (key, formats) => this.t(`${ns}.${key}`, formats);
|
||||
}
|
||||
|
||||
/**
|
||||
* attempts to translate for a single language, given a preparsed path array.
|
||||
* @return undefined if the language or string cannot be found,
|
||||
* and throws an error if the path isn't right.
|
||||
*/
|
||||
tSingleLanguage(lang, _path, opts) {
|
||||
let path = [..._path];
|
||||
|
||||
const ns = path.shift();
|
||||
if (!ns) throw new Error(`key path seems invalid: [${_path.map(p => `"${p}"`).join(", ")}]`);
|
||||
|
||||
const languageObj = this.getLanguageObj(ns, lang);
|
||||
if (languageObj === undefined) return undefined;
|
||||
|
||||
const str = optionalTravelDownObjectPath(languageObj, path);
|
||||
if (str !== undefined) {
|
||||
return this.format(ns, path, str, lang, opts);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a language object from a specified namespace
|
||||
* @return undefined if it can't be found
|
||||
*/
|
||||
getLanguageObj(ns, lang) {
|
||||
return ns === "core"
|
||||
? this.getCoreLanguage(lang)
|
||||
: this.getPkgLanguage(ns, lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a language for `core`
|
||||
* @return undefined if it can't be found
|
||||
*/
|
||||
getCoreLanguage(lang) {
|
||||
const loaded = this.registeredStrings.core[lang]
|
||||
if (loaded !== undefined) return loaded;
|
||||
|
||||
const fetched = this.fetchCoreLanguageFile(lang);
|
||||
if (fetched === undefined) return undefined;
|
||||
|
||||
this.registeredStrings.core[lang] = fetched;
|
||||
return fetched;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a language for a specific namespace
|
||||
* @return undefined if it can't be found
|
||||
*/
|
||||
getPkgLanguage(ns, lang) {
|
||||
const loaded = this.registeredStrings[ns]?.[lang];
|
||||
if (loaded !== undefined) return loaded;
|
||||
|
||||
const fetched = this.fetchPkgLanguageFile(ns, lang);
|
||||
if (fetched === undefined) return fetched;
|
||||
|
||||
if (typeof this.registeredStrings[ns] !== "object" || this.registeredStrings[ns] === null) {
|
||||
this.registeredStrings[ns] = {};
|
||||
}
|
||||
this.registeredStrings[ns][lang] = fetched;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetches a core language from the disk
|
||||
* @return undefined if it can't be found
|
||||
*/
|
||||
fetchCoreLanguageFile(lang) {
|
||||
let filepath = path.join(this.resourcePath, "i18n", `${lang}.json`);
|
||||
let contents = JSON.parse(fs.readFileSync(filepath));
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetches a language for a specific namespace
|
||||
* @return undefined if it can't be found
|
||||
*/
|
||||
fetchPkgLanguageFile(ns, lang) {
|
||||
// TODO this could probably be optimised
|
||||
let packages = this.packages.getAvailablePackages();
|
||||
let foundPackage = packages.find(p => p.name === ns);
|
||||
|
||||
const i18nDir = path.join(foundPackage.path, "i18n");
|
||||
const langfile = path.join(i18nDir, `${lang}.json`);
|
||||
|
||||
if (!(fs.isDirectorySync(i18nDir) && fs.existsSync(langfile))) return;
|
||||
|
||||
let contents = JSON.parse(fs.readFileSync(langfile));
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* formats a string with opts,
|
||||
* and caches the message formatter for the provided path.
|
||||
*/
|
||||
format(ns, _path, str, lang, opts) {
|
||||
let path = [ns, lang, ..._path];
|
||||
|
||||
let cachedFormatter = optionalTravelDownObjectPath(this.cachedFormatters, path);
|
||||
if (cachedFormatter !== undefined) return cachedFormatter.format(opts);
|
||||
|
||||
let ast = this.cacheHelper.fetchAST(ns, _path, str, lang);
|
||||
let formatter = new IntlMessageFormat(ast, lang);
|
||||
|
||||
let last = path.pop();
|
||||
let cachePath = travelDownOrMakePath(this.cachedFormatters, path);
|
||||
cachePath[last] = formatter;
|
||||
return formatter.format(opts);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = I18n;
|
@ -106,10 +106,9 @@ module.exports = class ApplicationMenu {
|
||||
// Replaces VERSION with the current version.
|
||||
substituteVersion(template) {
|
||||
let item = this.flattenMenuTemplate(template).find(
|
||||
({ label }) => label?.includes("VERSION")
|
||||
({ label }) => label === 'VERSION'
|
||||
);
|
||||
// TODO maybe this can be done with the i18n API instead of custom replace?
|
||||
if (item) item.label = item.label.replace("VERSION", this.version);
|
||||
if (item) item.label = `Version ${this.version}`;
|
||||
}
|
||||
|
||||
// Sets the proper visible state the update menu items
|
||||
|
@ -12,8 +12,8 @@ function addItemToMenu(item, menu) {
|
||||
}
|
||||
}
|
||||
|
||||
function merge(menu, item, t, itemSpecificity = Infinity) {
|
||||
item = cloneAndLocaliseMenuItem(item, t);
|
||||
function merge(menu, item, itemSpecificity = Infinity) {
|
||||
item = cloneMenuItem(item);
|
||||
ItemSpecificities.set(item, itemSpecificity);
|
||||
const matchingItemIndex = findMatchingItemIndex(menu, item);
|
||||
|
||||
@ -25,7 +25,7 @@ function merge(menu, item, t, itemSpecificity = Infinity) {
|
||||
const matchingItem = menu[matchingItemIndex];
|
||||
if (item.submenu != null) {
|
||||
for (let submenuItem of item.submenu) {
|
||||
merge(matchingItem.submenu, submenuItem, t, itemSpecificity);
|
||||
merge(matchingItem.submenu, submenuItem, itemSpecificity);
|
||||
}
|
||||
} else if (
|
||||
itemSpecificity &&
|
||||
@ -35,9 +35,8 @@ function merge(menu, item, t, itemSpecificity = Infinity) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function unmerge(menu, item, t) {
|
||||
item = cloneAndLocaliseMenuItem(item, t);
|
||||
function unmerge(menu, item) {
|
||||
item = cloneMenuItem(item);
|
||||
const matchingItemIndex = findMatchingItemIndex(menu, item);
|
||||
if (matchingItemIndex === -1) {
|
||||
return;
|
||||
@ -75,12 +74,11 @@ function normalizeLabel(label) {
|
||||
return process.platform === 'darwin' ? label : label.replace(/&/g, '');
|
||||
}
|
||||
|
||||
function cloneAndLocaliseMenuItem(item, t) {
|
||||
function cloneMenuItem(item) {
|
||||
item = _.pick(
|
||||
item,
|
||||
'type',
|
||||
'label',
|
||||
'localisedLabel',
|
||||
'id',
|
||||
'enabled',
|
||||
'visible',
|
||||
@ -94,18 +92,11 @@ function cloneAndLocaliseMenuItem(item, t) {
|
||||
'beforeGroupContaining',
|
||||
'afterGroupContaining'
|
||||
);
|
||||
if (item.localisedLabel) {
|
||||
if (typeof item.localisedLabel === "string") {
|
||||
item.label = t(item.localisedLabel);
|
||||
} else {
|
||||
item.label = t(item.localisedLabel.key, item.localisedLabel.opts);
|
||||
}
|
||||
}
|
||||
if (item.id === null || item.id === undefined) {
|
||||
item.id = normalizeLabel(item.label);
|
||||
}
|
||||
if (item.submenu != null) {
|
||||
item.submenu = item.submenu.map(submenuItem => cloneAndLocaliseMenuItem(submenuItem, t));
|
||||
item.submenu = item.submenu.map(submenuItem => cloneMenuItem(submenuItem));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@ -142,6 +133,6 @@ module.exports = {
|
||||
merge,
|
||||
unmerge,
|
||||
normalizeLabel,
|
||||
cloneAndLocaliseMenuItem,
|
||||
cloneMenuItem,
|
||||
acceleratorForKeystroke
|
||||
};
|
||||
|
@ -60,8 +60,8 @@ if (buildMetadata) {
|
||||
//
|
||||
// See {::add} for more info about adding menu's directly.
|
||||
module.exports = MenuManager = class MenuManager {
|
||||
constructor({ i18n, keymapManager, packageManager }) {
|
||||
this.i18n = i18n;
|
||||
constructor({resourcePath, keymapManager, packageManager}) {
|
||||
this.resourcePath = resourcePath;
|
||||
this.keymapManager = keymapManager;
|
||||
this.packageManager = packageManager;
|
||||
this.initialized = false;
|
||||
@ -101,8 +101,9 @@ module.exports = MenuManager = class MenuManager {
|
||||
// added menu items.
|
||||
add(items) {
|
||||
items = _.deepClone(items);
|
||||
for (const item of items) {
|
||||
if (item.label == null && item.localisedLabel == null) {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
if (item.label == null) {
|
||||
continue; // TODO: Should we emit a warning here?
|
||||
}
|
||||
this.merge(this.template, item);
|
||||
@ -219,11 +220,11 @@ module.exports = MenuManager = class MenuManager {
|
||||
// Merges an item in a submenu aware way such that new items are always
|
||||
// appended to the bottom of existing menus where possible.
|
||||
merge(menu, item) {
|
||||
MenuHelpers.merge(menu, item, this.i18n.t);
|
||||
MenuHelpers.merge(menu, item);
|
||||
}
|
||||
|
||||
unmerge(menu, item) {
|
||||
MenuHelpers.unmerge(menu, item, this.i18n.t);
|
||||
MenuHelpers.unmerge(menu, item);
|
||||
}
|
||||
|
||||
sendToBrowserProcess(template, keystrokesByCommand) {
|
||||
@ -241,8 +242,7 @@ module.exports = MenuManager = class MenuManager {
|
||||
}
|
||||
|
||||
sortPackagesMenu() {
|
||||
let packagesLabel = this.i18n.t("core.menu.packages.self");
|
||||
const packagesMenu = _.find(this.template, ({id}) => MenuHelpers.normalizeLabel(id) === packagesLabel);
|
||||
const packagesMenu = _.find(this.template, ({id}) => MenuHelpers.normalizeLabel(id) === 'Packages');
|
||||
if (!(packagesMenu && packagesMenu.submenu != null)) {
|
||||
return;
|
||||
}
|
||||
@ -255,4 +255,5 @@ module.exports = MenuManager = class MenuManager {
|
||||
});
|
||||
return this.update();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -38,8 +38,7 @@ module.exports = class PackageManager {
|
||||
grammarRegistry: this.grammarRegistry,
|
||||
deserializerManager: this.deserializerManager,
|
||||
viewRegistry: this.viewRegistry,
|
||||
uriHandlerRegistry: this.uriHandlerRegistry,
|
||||
i18n: this.i18n
|
||||
uriHandlerRegistry: this.uriHandlerRegistry
|
||||
} = params);
|
||||
|
||||
this.emitter = new Emitter();
|
||||
@ -588,8 +587,7 @@ module.exports = class PackageManager {
|
||||
menuManager: this.menuManager,
|
||||
contextMenuManager: this.contextMenuManager,
|
||||
deserializerManager: this.deserializerManager,
|
||||
viewRegistry: this.viewRegistry,
|
||||
i18n: this.i18n
|
||||
viewRegistry: this.viewRegistry
|
||||
};
|
||||
|
||||
pack = metadata.theme ? new ThemePackage(options) : new Package(options);
|
||||
@ -694,8 +692,7 @@ module.exports = class PackageManager {
|
||||
menuManager: this.menuManager,
|
||||
contextMenuManager: this.contextMenuManager,
|
||||
deserializerManager: this.deserializerManager,
|
||||
viewRegistry: this.viewRegistry,
|
||||
i18n: this.i18n
|
||||
viewRegistry: this.viewRegistry
|
||||
};
|
||||
|
||||
const pack = metadata.theme
|
||||
|
@ -30,7 +30,6 @@ module.exports = class Package {
|
||||
this.contextMenuManager = params.contextMenuManager;
|
||||
this.deserializerManager = params.deserializerManager;
|
||||
this.viewRegistry = params.viewRegistry;
|
||||
this.i18n = params.i18n;
|
||||
this.emitter = new Emitter();
|
||||
|
||||
this.mainModule = null;
|
||||
@ -241,10 +240,7 @@ module.exports = class Package {
|
||||
}
|
||||
if (typeof this.mainModule.activate === 'function') {
|
||||
this.mainModule.activate(
|
||||
this.packageManager.getPackageState(this.name) || {},
|
||||
{
|
||||
t: this.i18n.getT(this.name)
|
||||
}
|
||||
this.packageManager.getPackageState(this.name) || {}
|
||||
);
|
||||
}
|
||||
this.mainActivated = true;
|
||||
|
54
yarn.lock
54
yarn.lock
@ -1438,45 +1438,6 @@
|
||||
minimatch "^3.1.2"
|
||||
strip-json-comments "^3.1.1"
|
||||
|
||||
"@formatjs/ecma402-abstract@1.14.3":
|
||||
version "1.14.3"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.14.3.tgz#6428f243538a11126180d121ce8d4b2f17465738"
|
||||
integrity sha512-SlsbRC/RX+/zg4AApWIFNDdkLtFbkq3LNoZWXZCE/nHVKqoIJyaoQyge/I0Y38vLxowUn9KTtXgusLD91+orbg==
|
||||
dependencies:
|
||||
"@formatjs/intl-localematcher" "0.2.32"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/fast-memoize@2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/fast-memoize/-/fast-memoize-2.0.1.tgz#f15aaa73caad5562899c69bdcad8db82adcd3b0b"
|
||||
integrity sha512-M2GgV+qJn5WJQAYewz7q2Cdl6fobQa69S1AzSM2y0P68ZDbK5cWrJIcPCO395Of1ksftGZoOt4LYCO/j9BKBSA==
|
||||
dependencies:
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/icu-messageformat-parser@2.3.0", "@formatjs/icu-messageformat-parser@^2.3.0":
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.3.0.tgz#8e8fd577c3e39454ef14bba4963f2e1d5f2cc46c"
|
||||
integrity sha512-xqtlqYAbfJDF4b6e4O828LBNOWXrFcuYadqAbYORlDRwhyJ2bH+xpUBPldZbzRGUN2mxlZ4Ykhm7jvERtmI8NQ==
|
||||
dependencies:
|
||||
"@formatjs/ecma402-abstract" "1.14.3"
|
||||
"@formatjs/icu-skeleton-parser" "1.3.18"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/icu-skeleton-parser@1.3.18":
|
||||
version "1.3.18"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.18.tgz#7aed3d60e718c8ad6b0e64820be44daa1e29eeeb"
|
||||
integrity sha512-ND1ZkZfmLPcHjAH1sVpkpQxA+QYfOX3py3SjKWMUVGDow18gZ0WPqz3F+pJLYQMpS2LnnQ5zYR2jPVYTbRwMpg==
|
||||
dependencies:
|
||||
"@formatjs/ecma402-abstract" "1.14.3"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/intl-localematcher@0.2.32":
|
||||
version "0.2.32"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.2.32.tgz#00d4d307cd7d514b298e15a11a369b86c8933ec1"
|
||||
integrity sha512-k/MEBstff4sttohyEpXxCmC3MqbUn9VvHGlZ8fauLzkbwXmVrEeyzS+4uhrvAk9DWU9/7otYWxyDox4nT/KVLQ==
|
||||
dependencies:
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
@ -5557,16 +5518,6 @@ internal-slot@^1.0.3:
|
||||
has "^1.0.3"
|
||||
side-channel "^1.0.4"
|
||||
|
||||
intl-messageformat@^10.3.3:
|
||||
version "10.3.3"
|
||||
resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.3.3.tgz#576798d31c9f8d90f9beadaa5a3878b8d30177a2"
|
||||
integrity sha512-un/f07/g2e/3Q8e1ghDKET+el22Bi49M7O/rHxd597R+oLpPOMykSv5s51cABVfu3FZW+fea4hrzf2MHu1W4hw==
|
||||
dependencies:
|
||||
"@formatjs/ecma402-abstract" "1.14.3"
|
||||
"@formatjs/fast-memoize" "2.0.1"
|
||||
"@formatjs/icu-messageformat-parser" "2.3.0"
|
||||
tslib "^2.4.0"
|
||||
|
||||
invert-kv@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
|
||||
@ -9555,11 +9506,6 @@ truncate-utf8-bytes@^1.0.0:
|
||||
dependencies:
|
||||
utf8-byte-length "^1.0.1"
|
||||
|
||||
tslib@^2.4.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
|
||||
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
|
||||
|
||||
tunnel-agent@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
|
||||
|
Loading…
Reference in New Issue
Block a user