forked from EdgeTranslate/EdgeTranslate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
742 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
### Project Structure | ||
``` | ||
+-- config | ||
| +-- webpack.base.config.js | ||
| +-- webpack.dev.config.js | ||
| +-- webpack.prod.config.js | ||
+-- src | ||
| +-- contents | ||
| | +-- pdf.js | ||
| | +-- select.js | ||
| +-- display | ||
| | +-- display.js | ||
| | +-- engine.js | ||
| | +-- template.js | ||
| +-- options | ||
| +-- popup | ||
| +-- background.js | ||
| +-- translate.js | ||
+-- static | ||
| +-- _locales | ||
| +-- icon | ||
``` | ||
#### config | ||
|
||
Store the three configuration files of the webpack, | ||
|
||
+ `webpack.base.config.js` common configuration | ||
|
||
+ `webpack.dev.config.js` development environment configuration | ||
|
||
+ `webpack.prod.config.js` production environment configuration | ||
|
||
#### contents | ||
|
||
Contains two content scripts for the extension | ||
|
||
+ pdf.js is used to automatically jump to the built-in pdf reader when the pdf files are read by the browser (introduced [pdf.js](https://github.com/mozilla/pdf.js)) | ||
|
||
+ select.js is used to implement word translation | ||
|
||
#### display | ||
|
||
Responsible for generating a sidebar in the current window to display translation results. | ||
In this module, We used our own simple template rendering engine, which is responsible for rendering the structured data and static pages of the translation results to generate html content for display. | ||
|
||
+ `engine.js` Simple rendering engine (render function). | ||
+ `tempalte.js` Store template content. | ||
|
||
+ `display.js` Use the `render()` function from `engine.js` to render the page in the sidebar. Responsible for generating the sidebar, popping up the sidebar and closing the sidebar. | ||
|
||
#### options | ||
|
||
Responsible for options page of the extension. | ||
|
||
#### popup | ||
|
||
Responsible for the popup page. | ||
Includes the input box for querying words and options for source and target languages. | ||
|
||
#### background.js | ||
|
||
Responsible for initializing the default settings when the extension is installed and forwarding messages between the various parts of the extension during the runtime. | ||
|
||
#### translate.js | ||
|
||
Responsible for the main translation function | ||
|
||
+ Send translation requests. | ||
|
||
+ Process the received data and pack it up. | ||
|
||
+ Pass the translation result object to the displaying module. | ||
|
||
#### _locales | ||
Responsible for the internationalization of the extension. | ||
|
||
Chinese Simplified, Chinese Traditional and English are currently supported. | ||
|
||
#### icon | ||
|
||
Store icon files. | ||
|
||
|
||
Store files of [pdf.js](https://github.com/mozilla/pdf.js). They will be introduced as static files during packaging. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
## Edge Translate Instructions | ||
|
||
### Word Translation | ||
|
||
* Method 1: Mouse select the word or sentence that needs to be translated, click the right mouse button to pop up the menu, select `Translate 'xxx'` to view the translation result. | ||
|
||
![selecting_translate_1](../../images/selecting_translate_1.gif) | ||
|
||
* Method 2: Mouse select the word or sentence that needs to be translated, and click the [icon](../../images/icon.png) flag that pops up near the mouse cursor to translate. | ||
|
||
![selecting_translate_2](../../images/selecting_translate_2.gif) | ||
|
||
* Method 3: Mouse select the word or sentence that needs to be translated, press the shortcut key to translate (this shortcut key must be customized in [Quick Key Settings] (chrome://extensions/shortcuts) if you want to use it. ) | ||
|
||
#### About the selected words immediately translated | ||
|
||
If you feel that it is too much trouble to see the translation after clicking the word again, we offer two more radical translations: | ||
|
||
* Double-click the word to translate immediately: Open the 'Double-click word to translate immediately' in the settings of this extension, just double-click the word you want to translate, and the translation result will be displayed immediately, no more operations are needed. | ||
|
||
* Translate immediately after wording: If you can't meet your needs by double-clicking the word, you can conEdger enabling 'Translate immediately after wording'. When enabled, the translation result will be displayed immediately regardless of the way you select the text. | ||
|
||
### Word Query | ||
|
||
Click the ![icon](../../images/icon.png) flag in the upper right corner of the browser or use the shortcut key (default `Alt + Q`) to enter the word you want to query in the input box of the pop-up page. Or sentence, then click the `Translate` button or press `Enter` to view the translation results. | ||
|
||
![inputing_translate](../../images/inputing_translate.gif) | ||
|
||
### Fixed translation results | ||
|
||
* Method 1: If you want to keep the translation result display bar always displayed, you can click the pushpin flag in the upper right corner of the translation result display bar to fix the display bar. After fixing it, clicking again will cancel the fixation. | ||
|
||
![keep_showing](../../images/keep_showing.gif) | ||
|
||
* Method 2: Press the shortcut key (default `Alt + X`) to fix the display bar. After fixing it, press the shortcut key again (default `Alt + X`) will cancel the fixed | ||
|
||
### Setting the translation language | ||
|
||
Method 1: Click the ![icon](../../images/icon.png) flag in the upper right corner of the browser. There is a downward arrow below the input box in the pop-up page. Click the arrow to expand the language setting. page. | ||
|
||
![language_setting](../../images/language_setting.gif) | ||
|
||
Method 2: Click the ![icon](../../images/icon.png) logo in the upper right corner of the browser and press the shortcut key (default `Alt + W`) to expand the language setting page. If you press again Under (default `Alt + W`) to hide the language setting interface | ||
|
||
Method 3: Click the ![icon](../../images/icon.png) flag in the upper right corner of the browser and press the shortcut key (default `Alt + S`) to complete the language exchange (__recommended) use__) | ||
|
||
### Website Translation | ||
|
||
* Have a web page translation | ||
|
||
Using a web page translation interface with a channel translation, the effect is as follows: | ||
|
||
![youdao_page_translate](../../images/youdao_page_translate.gif) | ||
|
||
The advantage of a good translation is that there is no webpage restriction, and almost any page can be translated (except for pdf documents); the disadvantage is that it can only be translated into Chinese and the target language cannot be changed. | ||
|
||
* Google web page translation | ||
|
||
Using the web translation interface of Google Translate, the effect is as follows: | ||
|
||
![google_page_translate](../../images/google_page_translate.gif) | ||
|
||
The advantage of Google Translate is that you can freely choose the target language, and the translation speed is usually faster than the way. The disadvantage is that it cannot be translated on some pages, such as Github. | ||
|
||
* Precautions | ||
|
||
- Whether you have a web page translation or a Google web page translation, you can only translate web pages, __can't translate pdf files!__ | ||
|
||
- Due to the domestic network environment, Google's webpage translation may be unusable. Please use a webpage translation. | ||
|
||
### Blacklist setting | ||
|
||
Right click on the ![icon](../../images/icon.png) flag in the top right corner of the browser and in the expanded options you can see `Add the current page to the blacklist' and `Add the current domain name to Blacklist`. Clicking 'Add current page to blacklist' will disable word translation and double-click translation on the current page; clicking `Add current domain to blacklist' will disable word translation on all pages with the same domain as the current page. Double click on the translation function. | ||
|
||
If the ![icon_forbidden](../../images/icon_forbidden.png) flag is displayed in the upper right corner of the browser, the domain name of the current page or the current page is in the blacklist. Right click on this flag will see Go to 'Move the current page out of the blacklist' or `Move the current domain name out of the blacklist', and click to re-enable the word translation and double-click translation on the current page. | ||
|
||
### other settings | ||
|
||
Right click on the ![icon](../../images/icon.png) logo in the top right corner of the browser and click on 'Options' in the pop-up menu to go to the plugin settings page. Here you can set what needs to be displayed in the translation results and enable and disable word translation. | ||
|
||
![options](../../images/options.gif) | ||
|
||
### Advanced usage scenarios | ||
|
||
In order to further achieve the goal of convenient translation, we have added a number of shortcuts for Edge translation. Learn these shortcuts to turn your browser into a convenient word-searching software. | ||
|
||
A typical usage scenario is: | ||
|
||
1. On any non-initial page of the browser, press `Alt + Q` to open the search input box. | ||
|
||
* You may need to use `Alt + S` to exchange source and target languages | ||
|
||
+ When the source language is `Automatically detect', the exchange is not supported. Please use the following method to set it manually. | ||
|
||
* Alternatively, you may need to use `Alt + W` to further set the source and target languages. | ||
|
||
+ After setting the source or target language, press `Alt + W` again to turn off the language setting and return focus to the input box. | ||
|
||
2. Type or paste the word you want to check and press `Enter` to view the translation result. | ||
|
||
3. Press `Alt + X` to fix the translation result. Press `Alt + C` to close the translation result. | ||
|
||
4. If you are not used to such a shortcut key combination, you can right-click on the ![icon](../../images/icon.png) logo in the upper right corner of the browser and click `Shortcut Key Settings in the pop-up options. `Enter the shortcut key settings page, where you can customize all the shortcut keys for the Edge translation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Please refresh the page that needs to be translated after installation or update! | ||
|
||
## Please refresh the page that needs to be translated after installation or update! ! | ||
|
||
## Please refresh the page that needs to be translated after installation or update! ! ! | ||
|
||
## Introduction | ||
|
||
Welcome to Edge Translate! | ||
|
||
Edge Translate is a simple and practical translation plugin that supports mainstream browsers such as [Chrome](https://chrome.google.com/webstore/detail/bocbaocobfecmglnmeaeppambideimao), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/edge_translate), and [360 Secure Browser](https://ext.se.360.cn/webstore/detail/aajldohlagodeegngemjjgmabejbejli) . The main purpose of our plugin is to assist users in reading foreign literature. To this end, we have followed the principle of the user's reading experience first, and made the following efforts: | ||
|
||
* We use the API provided by Google Translate to translate words and sentences, which guarantees the accuracy of translation results to a certain extent; | ||
|
||
* We support the translation of wording in PDF files, which breaks the dyslexia of many users when reading PDF documents (due to the Firefox browser's bug, this feature is temporarily unavailable on Firefox browser); | ||
|
||
* We chose the friendly side pop-up to show the translation results. The pop-up display bar will push the user reading content to avoid blocking the content from affecting the reading; | ||
|
||
* We designed a simple and clear translation result display column, highlighting important content, and ensuring that the user's attention is focused on the content displayed rather than the insignificant things such as the display box; | ||
|
||
* If the frequency of the your translation is relatively high, you can choose to fix the display bar to avoid frequent pop-ups affecting reading. | ||
|
||
* We allow users to decide for themselves which content in the translation results they need to display. For example, if you just want to know the meaning of the word, you can choose to view only the common meaning of the word. If you also want to learn the specific usage of a word, we also provide the pronunciation, definition, detailed explanation, example sentence, etc. of the word in more detail. Content for you to view; | ||
|
||
* We have provided a wealth of shortcut keys to make the operation efficiency greatly improved. Now you only need to use the keyboard to complete the translation of selected words, expand the search panel, fix and unpin the translation results; | ||
|
||
* We provide a useful blacklist feature that allows you to easily add a page you are browsing to a blacklist to disable wording translations and double-click translations on the page, or to remove the page being viewed from the blacklist to re-enable word translation and double click translation on this page. | ||
|
||
* We support web page translation and can translate the entire web page directly into the language you need. And you are free to choose YouDao web page translation or Google web page translation to fully meet your translation needs. | ||
|
||
The birth of Edge Translate is inseparable from the open source community. In the development process of Edge Translate, we used [Mozilla](https://github.com/mozilla)'s [pdf.js](https://github.com/mozilla/pdf.js) as a built-in PDF reader to support word translation in PDF files. We refered to [crimx](https://github.com/crimx)'s [saladict](https://github.com/crimx/ext-saladict) for solutions of some problems. We also used [gulp](https://github.com/gulpjs/gulp), [webpack](https://github.com/webpack/webpack) and other excellent open source tools to assist in development. And we would like to express our gratitude. | ||
|
||
We are also grateful to users who have used Edge Translate since 0.2.0 and provided us with feedback. You have provided us with a lot of very good comments and suggestions. Without you, there may no be the current Edge Translate. | ||
|
||
## Instructions | ||
|
||
[Edge Translate instructions](./Instructions.md) | ||
|
||
## Precautions | ||
|
||
[Edge Translate precautions](./Precautions.md) | ||
|
||
## Questions and Feedback | ||
|
||
Edge Translate were developed by us ( [nickyc975](https://github.com/nickyc975) and [Mark-Fritz](https://github.com/Mark-Fritz) ) in our spare time, and there are inevitably some problems. If you have any comments or suggestions, please feel free to give us feedback at the first time and help us to make it better. | ||
|
||
Email: [nickyc975](mailto:[email protected]), [Mark-Fritz](mailto:[email protected]) | ||
|
||
Chrome App Store: [Edge Translate](https://chrome.google.com/webstore/detail/%E4%BE%A7%E8%BE%B9%E7%BF%BB%E8%AF%91/bocbaocobfecmglnmeaeppambideimao/reviews) | ||
|
||
Firefox Add-ons Store: [Edge Translate](https://addons.mozilla.org/en-US/firefox/addon/edge_translate/reviews) | ||
|
||
In addition, developers are welcome to give us issues and pull requests. If you like this project, welcome to fork & star. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Side translation considerations | ||
|
||
* __ After installing or updating the extension, you must first refresh the page that needs to be translated, and the translation function can be used normally; __ | ||
|
||
* __Selection word translation method 2 needs to enable "word translation" in the settings, the default is turned on; __ | ||
|
||
* __Selection translation method 2 implementation in the pdf file depends on the built-in pdf file reader of this extension, so you must enable "Use built-in pdf viewer" in the settings of this extension, the default is turned on; __ | ||
|
||
* __Translate the contents of the pdf file. You need to allow the application to access the file link in the settings. The method of opening is as shown in Figure 1; if you open the file access permission for the first time, you need to reload the page to use the extension __ | ||
|
||
* __ Due to the security settings of some websites, there will be some problems in the Firefox browser that cannot be translated on the side of the website; __ | ||
|
||
### Figure 1: Allow side translation to access file links | ||
|
||
![grant_access](../../images/grant_access.gif) |
Oops, something went wrong.