Skip to content

Commit

Permalink
add replace rules
Browse files Browse the repository at this point in the history
  • Loading branch information
LewisTian committed May 20, 2019
1 parent a083180 commit 7317e8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion google-translate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ When I read papers, I used [Google Translate](https://translate.google.cn) to tr
3. window top. Checking this box will cause the window to remain at the top of all applications.

### replace rules
until today (19/05/16)
until today (19/05/18)
```
 ->
€ -> fi
 -> ffi
‚ -> ff
ƒ -> fl
‡ -> ft
‰ -> ft
Š -> tt
Œ -> th
```

Expand Down
4 changes: 2 additions & 2 deletions google-translate/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def transTextToZhCN(self):
text = re.sub(r'\n|\s+', ' ', text)
text = re.sub(r'', '', text)
# add on 19/05/16
text = text.replace('€', 'fi').replace('', 'ffi').replace('‚', 'ff').replace('ƒ', 'fl').replace('Œ', 'th')
text = text.replace('€', 'fi').replace('', 'ffi').replace('‚', 'ff').replace('ƒ', 'fl').replace('Œ', 'th').replace('‡', 'ft').replace('‰', 'ft').replace('Š', 'tt')
self.originText.setPlainText(text)
try:
# self.transText.setPlainText(trans_To_zh_CN(text))
Expand Down Expand Up @@ -185,10 +185,10 @@ def onClipboradChanged(self):
if text and self.isRealTimeTrans:
content = str(text)
# print(content)
content = content.replace('€', 'fi').replace('', 'ffi').replace('‚', 'ff').replace('ƒ', 'fl').replace('Œ', 'th').replace('‡', 'ft').replace('‰', 'ft').replace('Š', 'tt')
if self.paperMode.isChecked(): # if paper mode is true, line breaks will re replaced by blanks
content = re.sub(r'\n|\s+', ' ', content)
content = re.sub(r'', '', content)
content = content.replace('€', 'fi').replace('', 'ffi').replace('‚', 'ff').replace('ƒ', 'fl').replace('Œ', 'th')
self.originText.setPlainText(content)
self.transText.setPlainText(content)
try:
Expand Down

0 comments on commit 7317e8f

Please sign in to comment.