Skip to content

Commit

Permalink
✨ Feature: finish i18n system
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Aug 20, 2022
1 parent 86012c0 commit 428ffc7
Show file tree
Hide file tree
Showing 35 changed files with 1,035 additions and 538 deletions.
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## 贡献指南

### 安装与启动

1. 使用 [yarn](https://yarnpkg.com/) 安装依赖

```bash
yarn install
```

然后通过

```bash
yarn dev
```

启动项目。

2. 只跟 Electron 主进程相关的代码请在 `src/main` 目录下添加。只跟渲染进程相关的代码请在 `src/renderer` 目录下添加。两个进程都能使用的代码请在 `src/universal` 目录下添加。 **注意**:渲染进程没有 `Node.js` 能力,所有渲染进程需要用到 `Node.js` 模块相关的代码请在 `src/main/events/picgoCoreIPC.ts` 下添加事件进行处理。

3. 所有的跨进程事件名请在 `src/universal/events/constants.ts` 里添加。

4. 所有的全局类型定义请在 `src/universal/types/` 里添加,如果是 `enum`,请在 `src/universal/types/enum.ts` 里添加。


### i18n

`public/i18n/` 下面创建一种语言的 `yml` 文件,例如 `zh-Hans.yml`。然后参考 `zh-CN.yml` 或者 `en.yml` 编写语言文件。并注意,PicGo 会通过语言文件中的 `LANG_DISPLAY_LABEL` 向用户展示该语言的名称。

### 提交代码

1. 请检查代码没有多余的注释、`console.log` 等调试代码。
2. 提交代码前,请执行命令 `git add . && yarn cz`,唤起 PicGo 的[代码提交规范工具](https://github.com/PicGo/bump-version)。通过该工具提交代码。
33 changes: 33 additions & 0 deletions CONTRIBUTING_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Contribution Guidelines

### Installation and startup

1. Use [yarn](https://yarnpkg.com/) to install dependencies

```bash
yarn install
```

then pass

```bash
yarn dev
```

Startup project.

2. Please add code only related to the main process of Electron in the `src/main` directory. Code only related to the rendering process should be added in the `src/renderer` directory. Add code that can be used by both processes in the `src/universal` directory. **Note**: The rendering process does not have the `Node.js` capability. All rendering processes need to use `Node.js modules` related code, please add events under `src/main/events/picgoCoreIPC.ts` for processing.

3. Please add all cross-process event names in `src/universal/events/constants.ts`.

4. Please add all global type definitions in `src/universal/types/`, if it is `enum`, please add it in `src/universal/types/enum.ts`.


### i18n

Create a `yml` file for a language under `public/i18n/`, e.g. `zh-Hans.yml`. Then refer to `zh-CN.yml` or `en.yml` to write language files. Also note that PicGo will display the name of the language to the user via `LANG_DISPLAY_LABEL` in the language file.

### Submit code

1. Please check that the code has no extra comments, `console.log` and other debugging code.
2. Before submitting the code, please execute the command `git add . && yarn cz` to invoke PicGo's [Code Submission Specification Tool](https://github.com/PicGo/bump-version). Submit code through this tool.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Linux 用户请下载 `AppImage` 文件。
2. `git clone https://github.com/Molunerfinn/PicGo.git` 并进入项目。
3. `yarn` 下载依赖。注意如果你没有 `yarn`,请去 [官网](https://classic.yarnpkg.com/en/docs/install) 下载安装后再使用。 **`npm install` 将导致未知错误!**
4. Mac 需要有 Xcode 环境,Windows 需要有 VS 环境。
5. 如果需要贡献代码,可以参考[贡献指南](./CONTRIBUTING.md)

### 开发模式

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"cz": "git-cz",
"bump": "bump-version",
"release": "vue-cli-service electron:build --publish always",
"upload-dist": "node ./scripts/upload-dist-to-cos.js"
"upload-dist": "node ./scripts/upload-dist-to-cos.js",
"gen-i18n": "node ./scripts/gen-i18n-types.js"
},
"main": "background.js",
"husky": {
Expand Down
236 changes: 236 additions & 0 deletions public/i18n/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
LANG_DISPLAY_LABEL: 'English'
ABOUT: About
OPEN_MAIN_WINDOW: Open Main Window
CHOOSE_DEFAULT_PICBED: Choose Default Picbed
OPEN_UPDATE_HELPER: Open Update Helper
PRIVACY_AGREEMENT: Privacy Agreement
RELOAD_APP: Reload App
UPLOAD_FAILED: Upload Failed
UPLOAD_SUCCEED: Upload Succeed
UPLOAD_PROGRESS: Upload Progress
OPERATION_FAILED: Operation Failed
OPERATION_SUCCEED: Operation Succeed
UPLOADING: Uploading
QUICK_UPLOAD: Quick Upload
UPLOAD_BY_CLIPBOARD: Upload by Clipboard
HIDE_WINDOW: Hide Window
SPONSOR_PICGO: Sponsor PicGo
SHOW_PICBED_QRCODE: Show Picbed Qrcode
PICBED_QRCODE: Picbed Qrcode
ENABLE: Enable
DISABLE: Disable
CONFIG_THING: Config ${c}
FIND_NEW_VERSION: Find New Version
NO_MORE_NOTICE: No More Notice
SHOW_DEVTOOLS: Show Devtools

# ---renderer i18n begin---

CHOOSE_YOUR_DEFAULT_PICBED: 'Choose ${d} as your default picbed:'
UPLOAD_AREA: Upload Area
GALLERY: Gallery
PICBEDS_SETTINGS: Picbeds Settings
PICGO_SETTINGS: PicGo Settings
PLUGIN_SETTINGS: Plugins Settings
PICGO_SPONSOR_TEXT: PicGo is a free software, if you like it, please don't forget to buy me a cup of coffee.
ALIPAY: Alipay
WECHATPAY: Wechat Pay
CHOOSE_PICBED: Choose Picbed
COPY_PICBED_CONFIG: Copy Picbed Config
COPY_PICBED_CONFIG_SUCCEED: Copy Picbed Config Succeed
INPUT: Input
CANCEL: Cancel
CONFIRM: Confirm
CHOOSE_SHOWED_PICBED: Choose Showed Picbed
CHOOSE_PASTE_FORMAT: Choose Paste Format
SEARCH: Search
COPY: Copy
DELETE: Delete
SELECT_ALL: Select All
CHANGE_IMAGE_URL: Change Image URL
CHANGE_IMAGE_URL_SUCCEED: Change Image URL Succeed
COPY_LINK_SUCCEED: Copy Link Succeed
BATCH_COPY_LINK_SUCCEED: Batch Copy Link Succeed
FILE_RENAME: File Rename

# settings

SETTINGS: Settings
SETTINGS_OPEN_CONFIG_FILE: Open Config File
SETTINGS_CLICK_TO_OPEN: Click to Open
SETTINGS_SET_LOG_FILE: Set Log File
SETTINGS_CLICK_TO_SET: Click to Set
SETTINGS_CLICK_TO_CHECK: Click to Check
SETTINGS_SET_SHORTCUT: Set Shortcut
SETTINGS_CUSTOM_LINK_FORMAT: Custom Link Format
SETTINGS_SET_PROXY_AND_MIRROR: Set Proxy and Mirror
SETTINGS_SET_SERVER: Set Server
SETTINGS_CHECK_UPDATE: Check Update
SETTINGS_OPEN_UPDATE_HELPER: Open Update Helper
SETTINGS_OPEN: Open
SETTINGS_CLOSE: Close
SETTINGS_ACCEPT_BETA_UPDATE: Accept Beta Update
SETTINGS_LAUNCH_ON_BOOT: Launch On Boot
SETTINGS_RENAME_BEFORE_UPLOAD: Rename Before Upload
SETTINGS_TIMESTAMP_RENAME: Timestamp Rename
SETTINGS_OPEN_UPLOAD_TIPS: Open Upload Tips
SETTINGS_MINI_WINDOW_ON_TOP: Mini Window On Top
SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD: Auto Copy URL After Upload
SETTINGS_TIPS_PLACEHOLDER_URL: Use $url to represent url position
SETTINGS_TIPS_PLACEHOLDER_FILENAME: Use $fileName to represent file name position
SETTINGS_TIPS_SUCH_AS: 'Such as: $url/$fileName'
SETTINGS_UPLOAD_PROXY: Upload Proxy
SETTINGS_PLUGIN_INSTALL_PROXY: Proxy for Plugin Install
SETTINGS_PLUGIN_INSTALL_MIRROR: Mirror for Plugin Install
SETTINGS_CURRENT_VERSION: Current Version
SETTINGS_NEWEST_VERSION: Newest Version
SETTINGS_GETING: Getting...
SETTINGS_TIPS_HAS_NEW_VERSION: PicGo has a new version, please click confirm to open download page
SETTINGS_LOG_FILE: Log File
SETTINGS_LOG_LEVEL: Log Level
SETTINGS_LOG_FILE_SIZE: Log File Size
SETTINGS_SET_PICGO_SERVER: Set PicGo Server
SETTINGS_TIPS_SERVER_NOTICE: If you don't know what is the server's function, please read the document, or don't modify the configuration.
SETTINGS_ENABLE_SERVER: Enable Server
SETTINGS_SET_SERVER_HOST: Set Server Host
SETTINGS_SET_SERVER_PORT: Set Server Port
SETTINGS_TIP_PLACEHOLDER_HOST: Default:127.0.0.1
SETTINGS_TIP_PLACEHOLDER_PORT: Default:36677
SETTINGS_LOG_LEVEL_ALL: All
SETTINGS_LOG_LEVEL_SUCCESS: Success
SETTINGS_LOG_LEVEL_ERROR: Error
SETTINGS_LOG_LEVEL_INFO: Info
SETTINGS_LOG_LEVEL_WARN: Warn
SETTINGS_LOG_LEVEL_NONE: None
SETTINGS_RESULT: Result
SETTINGS_DEFAULT_PICBED: Default Picbed
SETTINGS_SET_DEFAULT_PICBED: Set Default Picbed
SETTINGS_NOT_CONFIG_OPTIONS: Not Config Options
SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD: Use Builtin Clipboard to Upload
SETTINGS_CHOOSE_LANGUAGE: Choose Language

# shortcut-page

BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts
SHORTCUT_NAME: Shortcut Name
SHORTCUT_BIND: Shortcut Binding
SHORTCUT_STATUS: Status
SHORTCUT_ENABLED: Enabled
SHORTCUT_DISABLED: Disabled
SHORTCUT_SOURCE: Source
SHORTCUT_HANDLE: Handle
SHORTCUT_ENABLE: Enable
SHORTCUT_DISABLE: Disable
SHORTCUT_EDIT: Edit
SHORTCUT_CHANGE_UPLOAD: Change Upload Shortcut

# tray-page

WAIT_TO_UPLOAD: Wait to Upload
ALREADY_UPLOAD: Already Upload

# upload-page

PICTURE_UPLOAD: Picture Upload
DRAG_FILE_TO_HERE: Drag file to here, or
CLICK_TO_UPLOAD: click to upload
LINK_FORMAT: Link Format
CUSTOM: Custom
CLIPBOARD_PICTURE: Clipboard
TIPS_DRAG_VALID_PICTURE_OR_URL: Drag valid picture or url to here
TIPS_INPUT_URL: Input URL
TIPS_HTTP_PREFIX: http:// or https://
TIPS_INPUT_VALID_URL: Input valid URL

# plugins

PLUGIN_SEARCH_PLACEHOLDER: Search picgo plugins on npm, or click the button to view the awesome plugins list
PLUGIN_INSTALL: Install
PLUGIN_INSTALLING: Installing...
PLUGIN_INSTALLED: Installed
PLUGIN_DOING_SOMETHING: Doing...
PLUGIN_LIST: Plugin List
PLUGIN_IMPORT_LOCAL: Import Local Plugins

# tips

TIPS_REMOVE_LINK: This operation will remove the picture from the album, continue?
TIPS_WILL_REMOVE_CHOOSED_IMAGES: This operation will remove the picture from the album, continue?
TIPS_MUST_CONTAINS_URL: Must contains $url
TIPS_NETWORK_ERROR: Network Error
TIPS_NEED_RELOAD: Need Reload App
TIPS_PLEASE_CHOOSE_LOG_LEVEL: Please choose log level
TIPS_SET_SUCCEED: Set successfully
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: This plugin is not optimized for the GUI, continue?
TIPS_CLICK_NOTIFICATION_TO_RELOAD: Click notification to reload app
TIPS_GET_PLUGIN_LIST_FAILED: Get plugin list failed

# ---renderer i18n end---

# plugins
PLUGIN_INSTALL_SUCCEED: Plugin install succeed
PLUGIN_INSTALL_FAILED: Plugin install failed
PLUGIN_UNINSTALL_SUCCEED: Plugin uninstall succeed
PLUGIN_UNINSTALL_FAILED: Plugin uninstall failed
PLUGIN_UPDATE_SUCCEED: Plugin update succeed
PLUGIN_UPDATE_FAILED: Plugin update failed
PLUGIN_IMPORT_SUCCEED: Plugin import succeed
PLUGIN_IMPORT_FAILED: Plugin import failed
ENABLE_PLUGIN: Enable Plugin
DISABLE_PLUGIN: Disable Plugin
UNINSTALL_PLUGIN: Uninstall Plugin
UPDATE_PLUGIN: Update Plugin

# tips
TIPS_NOTICE: Tips
TIPS_WARNING: Warning
TIPS_ERROR: Error
TIPS_INSTALL_NODE_AND_RELOAD_PICGO: Please install Node.js and restart PicGo to continue
TIPS_PLUGIN_REMOVE_GALLERY_ITEM: Plugin is trying to remove some images from the album gallery, continue?
TIPS_PLUGIN_OVERWRITE_GALLERY: Plugin is trying to overwrite the album gallery, continue?
TIPS_UPLOAD_NOT_PICTURES: The latest clipboard item is not a picture
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: PicGo config file broken, has been restored to default
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: PicGo config file broken, has been restored to backup
TIPS_PICGO_BACKUP_FILE_VERSION: 'Backup file version: ${v}'
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: Custom config file parse error, please check the path content
TIPS_SHORTCUT_MODIFIED_SUCCEED: Shortcut modified successfully
TIPS_SHORTCUT_MODIFIED_CONFLICT: Shortcut conflict, please reset
TIPS_CUSTOM_LINK_STYLE_MODIFIED_SUCCEED: Custom link style modified successfully
TIPS_FIND_NEW_VERSION: Find new version ${v},update many new features, do you want to download the latest version?

# privacy
PRIVACY: >
This software respects and protects the personal privacy of all users who use the service. In order to provide you with more accurate and better services, this software will use and collect some of your behavioral information in accordance with the provisions of this Privacy Policy. When you agree to the software service use agreement, you are deemed to have agreed to the entire content of this privacy policy. This privacy policy is an integral part of the software service use agreement, and it will not be used if you do not agree.
This Agreement will be updated periodically.
1. Scope of application
a) When you use this software, this software will record some information about your operation behavior of this software, including but not limited to the time-consuming, type, quantity and other information of your use of this software to upload files.
2. Use of Information
a) After obtaining your usage data, the software will upload it to the data analysis server so as to provide you with better services after analyzing the data.
3. Information disclosure
a) This software will not disclose your information to untrusted third parties.
b) In accordance with the relevant provisions of the law, or the requirements of administrative or judicial institutions, disclose to third parties or administrative or judicial institutions;
c) If you violate relevant Chinese laws, regulations or relevant rules, you need to disclose it to a third party;
4. Information Security
a) This software does not collect your personal information, key information and other private information, and the collected information is only used for improving the software, optimizing the experience, and understanding the daily activities of the software.
PRIVACY_TIPS: Please agree the privacy policy to upload
QUIT: Quit
Loading

0 comments on commit 428ffc7

Please sign in to comment.