Skip to content

Commit

Permalink
feat: rename settings to preference
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Mar 9, 2021
1 parent e0f0bbe commit 7bf394d
Show file tree
Hide file tree
Showing 26 changed files with 382 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
registry=https://registry.npmjs.org
message=release: v%s
# Electron's version.
target=12.0.0
target=11.3.0
# The architecture of Electron, can be ia32 or x64.
arch=x64
target_arch=x64
Expand Down
4 changes: 2 additions & 2 deletions addons/landscape/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"Background URL#!user-settings.label.landscape.background.url": "背景图片 URL",
"URL of landscape background image#!user-settings.comments.0.landscape.background.url": "Landscape 背景图片的 URL"
"Background URL#!settings.label.landscape.background.url": "背景图片 URL",
"URL of landscape background image#!settings.comments.0.landscape.background.url": "Landscape 背景图片的 URL"
}
4 changes: 4 additions & 0 deletions addons/preference/commas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description": "Provide entries for various features",
"author": "commas"
}
37 changes: 37 additions & 0 deletions addons/preference/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = function (commas) {
if (commas.app.isMainProcess()) {

const path = require('path')
const { ipcMain } = require('electron')

commas.i18n.addTranslationDirectory(path.join(__dirname, 'locales'))

ipcMain.removeHandler('open-settings')

commas.ipcMain.handle('open-settings', () => {
const frame = commas.frame.getFocusedWindow()
frame.webContents.send('open-preference-pane')
})

commas.app.onCleanup(() => {
ipcMain.handle('open-settings', () => {
return commas.settings.openFile()
})
})

} else {

commas.workspace.registerTabPane('preference', {
title: 'Preference#!preference.1',
component: commas.bundler.extract('preference/preference-pane.vue').default,
icon: {
name: 'feather-icon icon-settings',
},
})

commas.ipcRenderer.on('open-preference-pane', () => {
commas.workspace.openPaneTab('preference')
})

}
}
14 changes: 14 additions & 0 deletions addons/preference/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Preference#!preference.1": "首选项",
"General#!preference.2": "通用",
"Features#!preference.3": "特性",
"Customization#!preference.4": "个性化",
"About#!preference.5": "关于",
"Open user directory#!preference.6": "打开用户目录",
"Open default settings#!preference.7": "打开默认配置",
"Edit %F#!preference.8": "编辑 %F",
"Current version: %V#!preference.9": "当前版本: %V",
"Visit our website#!preference.10": "访问网站",
"Search#!preference.11": "搜索",
"Reset to default#!preference.12": "重置为默认值"
}
2 changes: 1 addition & 1 deletion addons/proxy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = function (commas) {
commas.bundler.extract('proxy/proxy-anchor.vue').default
)

commas.reactive.provide('settings', {
commas.reactive.provide('preference', {
component: commas.bundler.extract('proxy/proxy-link.vue').default,
group: 'feature',
})
Expand Down
4 changes: 2 additions & 2 deletions addons/proxy/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"Configure proxy rules#!proxy.2": "配置代理规则",
"Enable system proxy#!proxy.3": "启用系统代理",
"Proxy to...#!proxy.4": "代理至...",
"Proxy Server Port#!user-settings.label.proxy.server.port": "代理服务器端口",
"Specify HTTP port for development proxy server#!user-settings.comments.0.proxy.server.port": "为开发代理服务器指定 HTTP 端口"
"Proxy Server Port#!settings.label.proxy.server.port": "代理服务器端口",
"Specify HTTP port for development proxy server#!settings.comments.0.proxy.server.port": "为开发代理服务器指定 HTTP 端口"
}
2 changes: 1 addition & 1 deletion addons/settings/commas.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"description": "Provide entries for various features",
"description": "User interface for custom settings",
"author": "commas"
}
21 changes: 4 additions & 17 deletions addons/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,22 @@ module.exports = function (commas) {
if (commas.app.isMainProcess()) {

const path = require('path')
const { ipcMain } = require('electron')

commas.i18n.addTranslationDirectory(path.join(__dirname, 'locales'))

ipcMain.removeHandler('open-settings')

commas.ipcMain.handle('open-settings', () => {
const frame = commas.frame.getFocusedWindow()
frame.webContents.send('open-settings-pane')
})

commas.app.onCleanup(() => {
ipcMain.handle('open-settings', () => {
return commas.settings.openFile()
})
})

} else {

commas.workspace.registerTabPane('settings', {
title: 'Settings#!settings.1',
component: commas.bundler.extract('settings/settings-pane.vue').default,
icon: {
name: 'feather-icon icon-settings',
name: 'feather-icon icon-sliders',
},
})

commas.ipcRenderer.on('open-settings-pane', () => {
commas.workspace.openPaneTab('settings')
commas.reactive.provide('preference', {
component: commas.bundler.extract('settings/settings-link.vue').default,
group: 'general',
})

}
Expand Down
59 changes: 48 additions & 11 deletions addons/settings/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,51 @@
{
"Shell Path#!settings.label.terminal.shell.path": "Shell 路径",
"Path of shell, $SHELL or %COMSPEC% by default#!settings.comments.0.terminal.shell.path": "Shell 的路径, 默认使用 $SHELL 或 %COMSPEC%",
"Shell Args#!settings.label.terminal.shell.args": "Shell 命令行参数",
"Arguments of shell command line#!settings.comments.0.terminal.shell.args": "Shell 命令行的参数",
"Shell Args#!settings.label.terminal.shell.args.windows": "Shell 命令行参数",
"Arguments of shell command line (for Windows)#!settings.label.terminal.shell.args.windows": "Shell 命令行的参数 (用于 Windows)",
"Extra environment variables#!settings.label.terminal.shell.env": "额外环境变量",
"Extra environment variables#!settings.comments.0.terminal.shell.env": "额外的环境变量",
"External Explorer#!settings.label.terminal.external.explorer": "外部资源管理程序",
"Absolute path (or with args as array) of external file manager#!settings.comments.0.terminal.external.explorer": "外部文件管理器的绝对路径 (或者以数组形式携带参数)",
"(or code editor, etc) for launchers#!settings.comments.1.terminal.external.explorer": "(也可以指定代码编辑器等) 用于启动项",
"Open in system file manager by default#!settings.comments.2.terminal.external.explorer": "默认使用系统文件管理器打开",
"Enable Live CWD#!settings.label.terminal.tab.liveCwd": "启用动态工作路径",
"Support dynamic \\w and \\W in formatting#!settings.comments.0.terminal.tab.liveCwd": "在格式中支持动态的 \\w 和 \\W",
"Disabling this feature will slightly improved performance.#!settings.comments.1.terminal.tab.liveCwd": "禁用此特性将略微提升性能",
"Tab Title Format#!settings.label.terminal.tab.titleFormat": "标签页标题格式",
"Title format of terminal tab in grammer of bash prompt#!settings.comments.0.terminal.tab.titleFormat": "以 Bash 提示符语法描述的终端标签页标题格式",
"It will not work if title is set from OSC 0 or OSC 2#!settings.comments.1.terminal.tab.titleFormat": "当标题从 OSC 0 或 OSC 2 设置时将不起作用",
"Supported identifiers: \\h \\H \\l \\u \\v \\w \\W#!settings.comments.2.terminal.tab.titleFormat": "支持的标识符: \\h \\H \\l \\u \\v \\w \\W",
"Link Modifier#!settings.label.terminal.link.modifier": "链接修饰键",
"Keyboard modifier for opening link by click#!settings.comments.0.terminal.link.modifier": "点击打开链接时的键盘修饰键",
"Options: 'CmdOrCtrl' or 'Alt'#!settings.comments.1.terminal.link.modifier": "可选项: 'CmdOrCtrl' 或 'Alt'",
"Renderer Type#!settings.label.terminal.renderer.type": "渲染方式",
"Specify how to render the terminal#!settings.comments.0.terminal.renderer.type": "声明如何渲染终端",
"Options: 'dom', 'canvas' or 'webgl'#!settings.comments.1.terminal.renderer.type": "可选项: 'dom', 'canvas' 或 'webgl'",
"Notice that 'webgl' does not support opacity currently#!settings.comments.2.terminal.renderer.type": "注意目前 'webgl' 不支持透明度",
"Background Opacity#!settings.label.terminal.style.opacity": "背景不透明度",
"Background opacity of window#!settings.comments.0.terminal.style.opacity": "窗口的背景不透明度",
"It will not work if RGBA background is specified in theme file#!settings.comments.1.terminal.style.opacity": "当主题文件中声明了 RGBA 格式的背景时将不起作用",
"Font Size#!settings.label.terminal.style.fontSize": "字体大小",
"Font size for window in pixels#!settings.comments.0.terminal.style.fontSize": "窗口的字体尺寸像素数",
"Font Family#!settings.label.terminal.style.fontFamily": "字体名称",
"Font family names for window#!settings.comments.0.terminal.style.fontFamily": "窗口的字体族名称",
"Enable Font Ligatures#!settings.label.terminal.style.fontLigatures": "启用字体连字",
"Enable font ligatures (if specified font family supports, like Fira Code or Iosevka)#!settings.comments.0.terminal.style.fontLigatures": "启用字体连字 (需要指定的字体族支持,例如 Fira Code 或 Iosevka)",
"Window Frame Type#!settings.label.terminal.style.frame": "窗口框架类型",
"Specify the frame type for all windows of application#!settings.comments.0.terminal.style.frame": "为应用的所有窗口指定框架类型",
"Options: 'system' or 'commas'#!settings.comments.1.terminal.style.frame": "可选项: 'system' 或 'commas'",
"Theme Name#!settings.label.terminal.theme.name": "主题名称",
"File name of built-in theme or files in `themes/` folder#!settings.comments.0.terminal.theme.name": "内置主题或 themes/ 文件夹下的文件名称",
"Support `oceanic-next`, `tomorrow` by default#!settings.comments.1.terminal.theme.name": "默认支持 `oceanic-next`, `tomorrow`",
"Custom Theme Colors#!settings.label.terminal.theme.customization": "自定义主题颜色",
"Overwrite colors in the theme file#!settings.comments.0.terminal.theme.customization": "覆盖主题文件中的颜色",
"Enable Auto Updating#!settings.label.terminal.updater.enabled": "启用自动更新",
"Check for updates automatically#!settings.comments.0.terminal.updater.enabled": "自动检查更新",
"Enabled Addons#!settings.label.terminal.addon.includes": "启用的附加功能",
"List of enabled addon name#!settings.comments.0.terminal.addon.includes": "启用的附加功能名称列表",
"Settings#!settings.1": "设置",
"General#!settings.2": "通用",
"Features#!settings.3": "特性",
"Customization#!settings.4": "个性化",
"About#!settings.5": "关于",
"Open user directory#!settings.6": "打开用户目录",
"Open default settings#!settings.7": "打开默认配置",
"Edit %F#!settings.8": "编辑 %F",
"Current version: %V#!settings.9": "当前版本: %V",
"Visit our website#!settings.10": "访问网站",
"Search#!settings.11": "搜索",
"Reset to default#!settings.12": "重置为默认值"
"Configure Settings#!settings.2": "配置设置"
}
2 changes: 1 addition & 1 deletion addons/shell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module.exports = function (commas) {
},
})

commas.reactive.provide('settings', {
commas.reactive.provide('preference', {
component: commas.bundler.extract('shell/shell-link.vue').default,
group: 'feature',
})
Expand Down
4 changes: 2 additions & 2 deletions addons/shell/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Shell#!shell.1": "Shell",
"Open shell#!shell.2": "打开 Shell",
"External URL Commands#!user-settings.label.shell.command.externalURLs": "外部网址命令",
"Shortcut commands for external URLs#!user-settings.comments.0.shell.command.externalURLs": "外部网址的快捷命令"
"External URL Commands#!settings.label.shell.command.externalURLs": "外部网址命令",
"Shortcut commands for external URLs#!settings.comments.0.shell.command.externalURLs": "外部网址的快捷命令"
}
2 changes: 1 addition & 1 deletion addons/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function (commas) {
},
})

commas.reactive.provide('settings', {
commas.reactive.provide('preference', {
component: commas.bundler.extract('theme/theme-link.vue').default,
group: 'general',
})
Expand Down
4 changes: 0 additions & 4 deletions addons/user-settings/commas.json

This file was deleted.

24 changes: 0 additions & 24 deletions addons/user-settings/index.js

This file was deleted.

51 changes: 0 additions & 51 deletions addons/user-settings/locales/zh-CN.json

This file was deleted.

16 changes: 12 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@typescript-eslint/parser": "^4.17.0",
"@vue/compiler-sfc": "^3.0.7",
"css-loader": "^5.1.1",
"electron": "^12.0.0",
"electron": "^11.3.0",
"electron-packager": "^15.2.0",
"eslint": "^7.21.0",
"eslint-plugin-galaxy": "^1.1.0",
Expand Down
Loading

0 comments on commit 7bf394d

Please sign in to comment.