From 2809b9054e5965c0fe430f606e698142e57e8b06 Mon Sep 17 00:00:00 2001 From: Echowxsy Date: Sun, 16 Feb 2020 00:26:26 +0800 Subject: [PATCH 1/5] use i18n --- .../snippet-detail-multi-file/index.jsx | 2 +- .../list-and-detail/snippet-detail/index.jsx | 2 +- .../original/snippet-item-multi-files/index.jsx | 4 ++-- .../layouts/original/snippet-item/index.jsx | 2 +- .../modals/create-multi-files-snippet/index.jsx | 2 +- browser/render/modals/modal-skeleton.jsx | 3 ++- browser/render/modals/setting/tabs/about.jsx | 16 ++++++++++------ 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/browser/render/layouts/list-and-detail/snippet-detail-multi-file/index.jsx b/browser/render/layouts/list-and-detail/snippet-detail-multi-file/index.jsx index 90a74ef..4139d62 100644 --- a/browser/render/layouts/list-and-detail/snippet-detail-multi-file/index.jsx +++ b/browser/render/layouts/list-and-detail/snippet-detail-multi-file/index.jsx @@ -577,7 +577,7 @@ export default class SnippetDetailMultiFile extends React.Component { )) ) : ( - 'No tag' + i18n.__('No tag') )} ) diff --git a/browser/render/layouts/list-and-detail/snippet-detail/index.jsx b/browser/render/layouts/list-and-detail/snippet-detail/index.jsx index 87dda49..bfc2cb0 100644 --- a/browser/render/layouts/list-and-detail/snippet-detail/index.jsx +++ b/browser/render/layouts/list-and-detail/snippet-detail/index.jsx @@ -372,7 +372,7 @@ export default class SnippetDetail extends React.Component { )) ) : ( - 'No tag' + i18n.__('No tag') )} ) diff --git a/browser/render/layouts/original/snippet-item-multi-files/index.jsx b/browser/render/layouts/original/snippet-item-multi-files/index.jsx index 7a4bb12..5d873ed 100644 --- a/browser/render/layouts/original/snippet-item-multi-files/index.jsx +++ b/browser/render/layouts/original/snippet-item-multi-files/index.jsx @@ -296,7 +296,7 @@ export default class SnippetItemMultiFiles extends React.Component { )) ) : ( - 'No tag' + i18n.__('No tag') )} ) @@ -395,7 +395,7 @@ export default class SnippetItemMultiFiles extends React.Component { type="text" ref="newFile" onFocus={this.handleNewFileFocus.bind(this)} - placeholder="New file" + placeholder={i18n.__('New file')} /> )} diff --git a/browser/render/layouts/original/snippet-item/index.jsx b/browser/render/layouts/original/snippet-item/index.jsx index 04ba84b..9dfebd5 100644 --- a/browser/render/layouts/original/snippet-item/index.jsx +++ b/browser/render/layouts/original/snippet-item/index.jsx @@ -311,7 +311,7 @@ export default class SnippetItem extends React.Component { )) ) : ( - 'No tag' + i18n.__('No tag') )} ) diff --git a/browser/render/modals/create-multi-files-snippet/index.jsx b/browser/render/modals/create-multi-files-snippet/index.jsx index 8a5691d..1eef91a 100644 --- a/browser/render/modals/create-multi-files-snippet/index.jsx +++ b/browser/render/modals/create-multi-files-snippet/index.jsx @@ -169,7 +169,7 @@ export default class CreateMultiFilesSnippetModal extends React.Component { type="text" ref="newFile" onFocus={this.handleNewFileFocus.bind(this)} - placeholder="New file" + placeholder={i18n.__('New file')} /> } diff --git a/browser/render/modals/modal-skeleton.jsx b/browser/render/modals/modal-skeleton.jsx index c6640be..28bd08f 100644 --- a/browser/render/modals/modal-skeleton.jsx +++ b/browser/render/modals/modal-skeleton.jsx @@ -1,6 +1,7 @@ import React from 'react' import FAIcon from '@fortawesome/react-fontawesome' import eventEmitter from 'lib/event-emitter' +import i18n from 'render/lib/i18n' import './modal' export default class ModalSkeleton extends React.Component { @@ -16,7 +17,7 @@ export default class ModalSkeleton extends React.Component { {closeBtn !== false && (
- ESC + {i18n.__('ESC')}
)} {this.props.children} diff --git a/browser/render/modals/setting/tabs/about.jsx b/browser/render/modals/setting/tabs/about.jsx index 04d8f8f..077eadc 100644 --- a/browser/render/modals/setting/tabs/about.jsx +++ b/browser/render/modals/setting/tabs/about.jsx @@ -39,14 +39,14 @@ export default class About extends React.Component {

-

Author

+

{i18n.__('Author')}

Nguyen Viet Hung ( @ZeroX-DG )

Email: viethungax@gmail.com

-

Donate

+

{i18n.__('Donate')}

{i18n.__( `If this app help you with your work and you wish to say thanks to me, you can donate me through Buy Me A Coffee. Your donation will be a huge motivation for me to continue to add more features and bugfixes in the future.` @@ -57,21 +57,25 @@ export default class About extends React.Component { Buy Me A Coffee

-

Analytics

+

{i18n.__('Analytics')}

{i18n.__( 'SnippetStore collects anonymous data for only 1 reason' + '-improve user experience. We will never collects your private ' + 'information such as your code snippets. If you wish to know ' + 'how it work, here is its source code:' - )}  - github + )} +   + Github

this.onAnalyticsChange(checked)} defaultValue={config.allowAnalytics} - />Enable analytics to help improve SnippetStore + /> + {i18n.__( + 'Enable analytics to help improve SnippetStore' + )}

From e764eb3bc19079aaade58f4c9c25a6cbb987e3af Mon Sep 17 00:00:00 2001 From: Echowxsy Date: Sun, 16 Feb 2020 00:26:59 +0800 Subject: [PATCH 2/5] different key for language --- browser/render/modals/setting/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/render/modals/setting/index.jsx b/browser/render/modals/setting/index.jsx index f5a7c28..4269018 100644 --- a/browser/render/modals/setting/index.jsx +++ b/browser/render/modals/setting/index.jsx @@ -79,7 +79,7 @@ export default class SettingModal extends React.Component { onClick={() => this.switchTab('language')} className={tab === 'language' ? 'active' : ''} > -
{i18n.__('Language')}
+
{i18n.__('Programming Language')}
) From dea5952c79c973ff6283ee1cdebaccde90c1b2af Mon Sep 17 00:00:00 2001 From: Echowxsy Date: Sun, 16 Feb 2020 00:27:13 +0800 Subject: [PATCH 3/5] add zh-cn --- languages/zh-cn.json | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 languages/zh-cn.json diff --git a/languages/zh-cn.json b/languages/zh-cn.json new file mode 100644 index 0000000..48e29e4 --- /dev/null +++ b/languages/zh-cn.json @@ -0,0 +1,85 @@ +{ + "LANGUAGES": "编程语言", + "Create at": "创建时间", + "Last update": "最后更新时间", + "Copy": "复制次数", + "No snippet found!": "没有找到代码片段!", + "Create new snippet using ": "创建新的代码片段:", + "Create": "创建", + "SORT": "排序", + "Sort by create time (newest)": "创建时间降序(最新)", + "Sort by create time (oldest)": "创建时间升序(最早)", + "Sort by update time (newest)": "更新时间降序(最新)", + "Sort by update time (oldest)": "更新时间升序(最早)", + "Sort by copy count (ascending)": "使用次数升序(最少)", + "Sort by copy count (descending)": "使用次数降序(最多)", + "Snippet name": "代码片段名称", + "Snippet language": "编程语言", + "Snippet content": "代码片段内容", + "About": "关于", + "SnippetStore is a snippet management app developers": "SnippetStore 是一个代码片段管理软件", + "Show line number": "行号", + "Theme": "主题", + "Editor font family": "字体", + "Editor font size": "字体大小", + "Editor indent style": "缩进", + "Editor tab size": "Tab 大小", + "Editor setting saved": "编辑器设置已保存", + "Save": "保存", + "HotKeys": "快捷键", + "Create snippet": "创建代码片段", + "Open setting": "打开设置", + "Hotkeys setting saved": "快捷键设置已保存", + "Language": "界面语言", + "Show notification when copy": "复制提示", + "Show confirm dialog when delete": "删除确认提示", + "Show snippet create time": "展示创建时间", + "Show snippet update time": "展示更新时间", + "Show snippet copy count": "展示复制次数", + "Date format": "日期格式", + "Interface setting saved": "界面设置已保存", + "Interface": "界面", + "Editor": "编辑器", + "Hotkeys": "快捷键", + "Dark": "黑暗 Dark", + "Light": "明亮 Light", + "Toggle small sidebar": "收起侧边栏", + "copy": "复制", + "save changes": "保存修改", + "edit": "编辑", + "delete snippet": "删除", + "times": "次", + "Are you sure to delete this snippet?": "你确定要删除这个代码片段吗?", + "Copied to clipboard": "已复制到剪贴板", + "TAGS": "标签", + "Snippet description": "代码片段介绍", + "Create new snippet": "创建代码片段", + "Single-file snippet": "单文件代码片段", + "Multi-file snippet": "多文件代码片段", + "This is the type of snippet where you will only store 1 piece of code. This type of snippet is suitable for storing small functions": "这是只有一种文件类型的代码片段,例如一个简单的函数", + "This type of snippet can groups multiple files into 1 snippet and suitable for storing simple code snippet with more than 1 file": "这是包含多种文件类型的代码片段,这种代码片段包含多个类型的文件", + "The snippet must have at least 1 file": "这种代码片段至少包含一个文件", + "discard changes": "撤销修改", + "Are you sure to delete this file?": "你确定要删除这个文件吗?", + "Pick a snippet from list": "选择一个代码片段", + "Snippet list layout": "列表样式", + "Highlight current line": "高亮光标所在行", + "Export JSON": "导出 JSON", + "SnippetStore collects anonymous data for only 1 reason-improve user experience. We will never collects your private information such as your code snippets. If you wish to know how it work, here is its source code:": "SnippetStore 只为一个目的收集匿名信息——提高用户体验。我们从来不会收集您你的私人信息 例如您的代码片段。如果您想知道这是如何工作的,这里是源代码:", + "If this app help you with your work and you wish to say thanks to me, you can donate me through Buy Me A Coffee. Your donation will be a huge motivation for me to continue to add more features and bugfixes in the future.": "如果这个软件有帮助到您,或是您想表示您的感谢,您可以赞助我,请我喝一杯咖啡。您的赞助是我修改 Bug 和增加新的功能的巨大的动力。", + "Storage": "存储", + "Snippet storage path:": "保存位置:", + "Browse": "浏览", + "Use default": "使用默认位置", + "Tag color": "标签颜色", + "Programming Language": "编程语言", + "Enable analytics to help improve SnippetStore": "允许收集程序匿名信息用于提高 SnippetStore 的体验", + "Donate": "赞助", + "Author": "作者", + "ESC": "关闭", + "Analytics": "分析", + "Search...": "搜索……", + "Tags": "标签", + "New file": "添加文件", + "No tag" : "无标签" +} From 3996807fb91e227551ac560112dc5e946755fa0d Mon Sep 17 00:00:00 2001 From: Echowxsy Date: Sun, 16 Feb 2020 00:28:33 +0800 Subject: [PATCH 4/5] import zh-cn --- browser/render/lib/languages.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/browser/render/lib/languages.js b/browser/render/lib/languages.js index fc62e94..fdb0d5d 100644 --- a/browser/render/lib/languages.js +++ b/browser/render/lib/languages.js @@ -1,6 +1,9 @@ const languages = [ { name: 'English', code: 'en' }, - { name: 'Tiếng Việt', code: 'vi' } + { name: 'Tiếng Việt', code: 'vi' }, + // thanks @zbahadir for Turkish translation + { name: 'Turkish', code: 'tr' }, + { name: '简体中文', code: 'zh-cn' } ] module.exports = { From 925759a671f7507d2a53ff0ee5c9030c3b48d352 Mon Sep 17 00:00:00 2001 From: Echowxsy Date: Sun, 16 Feb 2020 00:30:01 +0800 Subject: [PATCH 5/5] fix build err in macOS (https://github.com/electron-userland/electron-builder/issues/3990) --- package.json | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index ee79488..bb05766 100644 --- a/package.json +++ b/package.json @@ -39,24 +39,10 @@ "LICENSE", "THIRD-PARTY-LICENSES.txt" ], - "dmg": { - "contents": [ - { - "x": 438, - "y": 275, - "type": "link", - "path": "/Applications" - }, - { - "x": 192, - "y": 275, - "type": "file" - } - ] - }, "mac": { "category": "public.app-category.developer-tools", - "icon": "resources/icon/icon512.png" + "icon": "resources/icon/icon512.png", + "target":"pkg" }, "linux": { "category": "Development",