diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2a31138..3cf1d448 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,14 @@
# ChangeLog
+## 0.0.33
+
+- Support google.com
+- Add Option for is translate page title in others panel
+- Fix chrome extension report errors in extension manager.
+- Support www.urbandictionary.com
+- Support answers.microsoft.com
+
## 0.0.32
- Fix popup More option, always translate site
diff --git a/Makefile b/Makefile
index 0c55b43d..05b79bf4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
.Phony: start
start:
- web-ext run -s ./src
+ web-ext run -s ./src -f firefoxdeveloperedition
.Phony: build
build:
diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.json
index 054f696d..e991fcca 100644
--- a/src/_locales/zh_CN/messages.json
+++ b/src/_locales/zh_CN/messages.json
@@ -534,6 +534,8 @@
},
"msgCommon":{
"message":"常用配置"
+ },
+ "optionIsTranslateTitle":{
+ "message":"是否翻译页面标题?"
}
-
}
diff --git a/src/_locales/zh_TW/messages.json b/src/_locales/zh_TW/messages.json
index 140e37f0..28997fb6 100644
--- a/src/_locales/zh_TW/messages.json
+++ b/src/_locales/zh_TW/messages.json
@@ -528,7 +528,8 @@
},
"msgCommon":{
"message":"常用設置"
+ },
+ "optionIsTranslateTitle":{
+ "message":"是否翻譯頁面標題?"
}
-
-
}
diff --git a/src/background/background.js b/src/background/background.js
index d696ad9b..db4cd5a4 100644
--- a/src/background/background.js
+++ b/src/background/background.js
@@ -181,6 +181,7 @@ function resetBrowserAction(forceShow = false) {
}
if (typeof chrome.contextMenus !== "undefined") {
+ chrome.contextMenus.removeAll()
chrome.contextMenus.create({
id: "browserAction-showPopup",
title: chrome.i18n.getMessage("btnShowPopup"),
diff --git a/src/background/chrome_background.js b/src/background/chrome_background.js
index d71fdc46..53bf1599 100644
--- a/src/background/chrome_background.js
+++ b/src/background/chrome_background.js
@@ -181,6 +181,7 @@ function resetBrowserAction(forceShow = false) {
}
if (typeof chrome.contextMenus !== "undefined") {
+ chrome.contextMenus.removeAll()
chrome.contextMenus.create({
id: "browserAction-showPopup",
title: chrome.i18n.getMessage("btnShowPopup"),
diff --git a/src/chrome_manifest.json b/src/chrome_manifest.json
index 81c524f3..63edce27 100644
--- a/src/chrome_manifest.json
+++ b/src/chrome_manifest.json
@@ -3,7 +3,7 @@
"default_locale": "en",
"name": "Immersive Translate",
"description": "Let's experience immersive web translation, with bilingual simultaneous display and translation of only the important content.",
- "version": "0.0.32",
+ "version": "0.0.33",
"homepage_url": "https://github.com/immersive-translate/immersive-translate",
"commands": {
diff --git a/src/contentScript/enhance.js b/src/contentScript/enhance.js
index b8df3165..a8ec2d8e 100644
--- a/src/contentScript/enhance.js
+++ b/src/contentScript/enhance.js
@@ -319,6 +319,7 @@ async function getNodesThatNeedToTranslate(root,ctx,options){
})
+
// check node language is target language, if yes, remove it
let newAllNodes = [];
@@ -366,7 +367,8 @@ async function getNodesThatNeedToTranslate(root,ctx,options){
if(!previousSibling || !previousSibling.hasAttribute || !previousSibling.hasAttribute(enhanceMarkAttributeName)){
// add
let copyNode = node.cloneNode(true);
-
+ // get original display value
+ let originalDisplay = node.style.display;
if(ctx.tabHostName==="www.reddit.com"){
// append child
if(copyNode.nodeName.toLowerCase() === "h3" || copyNode.nodeName.toLowerCase() === "h1"){
@@ -391,7 +393,14 @@ async function getNodesThatNeedToTranslate(root,ctx,options){
const br = document.createElement("br");
copyNode.appendChild(br);
}
+ }else if(pageSpecialConfig && pageSpecialConfig.name==='google'){
+ if(node.nodeName.toLowerCase() === "h3" ){
+ // check copy node display to block
+ originalDisplay = "block";
+ }
+
}
+
if(inlineElements.includes(copyNode.nodeName.toLowerCase())){
// add a space
@@ -403,8 +412,6 @@ async function getNodesThatNeedToTranslate(root,ctx,options){
copyNode.style.paddingBottom = "8px";
}
}
- // get original display value
- let originalDisplay = node.style.display;
// if nitter
if(pageSpecialConfig && pageSpecialConfig.name && pageSpecialConfig.name === "nitter"){
// display to block
diff --git a/src/contentScript/pageTranslator.js b/src/contentScript/pageTranslator.js
index 484daaf4..8189b4cb 100644
--- a/src/contentScript/pageTranslator.js
+++ b/src/contentScript/pageTranslator.js
@@ -872,9 +872,10 @@ Promise.all([twpConfig.onReady(), getTabUrl()])
})
pageLanguageStateObservers.forEach(callback => callback(pageLanguageState))
currentPageLanguage = currentTargetLanguage
-
- // do not translate title, it not need
- // translatePageTitle()
+ const isTranslateTitle = twpConfig.get("isTranslateTitle") == "yes" ? true : false
+ if (isTranslateTitle) {
+ translatePageTitle()
+ }
enableMutatinObserver()
diff --git a/src/lib/config.js b/src/lib/config.js
index 8cdc4300..51e9430d 100644
--- a/src/lib/config.js
+++ b/src/lib/config.js
@@ -13,6 +13,7 @@ const twpConfig = (function () {
textTranslatorService: "google", // google yandex bing deepl
ttsSpeed: 1.0,
enableDeepL: "yes",
+ isTranslateTitle: "no",
targetLanguage: null,
targetLanguageTextTranslation: null,
targetLanguages: [], // "en", "es", "de"
diff --git a/src/lib/specialRules.js b/src/lib/specialRules.js
index 8c266e24..d180c55e 100644
--- a/src/lib/specialRules.js
+++ b/src/lib/specialRules.js
@@ -296,5 +296,18 @@ const specialRules = [
"hostname":"app.daily.dev",
"selectors":["h1",".typo-body","article h3"],
"containerSelectors":"[class^=markdown_markdown]"
+ },{
+ "name":"google",
+ "regex":"^https:\/\/www\.google\.",
+ "selectors":["h2","a h3","div[data-content-feature='1'] > div","a [aria-level='3']","a [aria-level='3'] + div",".Uroaid"],
+ "detectLanguage":true
+
+ },{
+ "hostname":"www.urbandictionary.com",
+ "selectors":["div.meaning","div.example"],
+ },{
+ "hostname":"answers.microsoft.com",
+ "selectors":["h1","div.thread-message-content div.thread-message-content-body-text"],
+ "containerSelectors":["div.thread-message-content-body-text",]
}
]
diff --git a/src/manifest.json b/src/manifest.json
index 3d3883af..63823ac1 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -3,7 +3,7 @@
"default_locale": "en",
"name": "Immersive Translate",
"description": "Let's experience immersive web translation, with bilingual simultaneous display and translation of only the important content.",
- "version": "0.0.32",
+ "version": "0.0.33",
"homepage_url": "https://github.com/immersive-translate/immersive-translate",
"browser_specific_settings": {
diff --git a/src/options/options.html b/src/options/options.html
index e8cd2e46..448b562c 100644
--- a/src/options/options.html
+++ b/src/options/options.html
@@ -252,6 +252,15 @@
Translate Page Title?
+ +Show button in the address bar
diff --git a/src/options/options.js b/src/options/options.js index 9a20a61c..1d041751 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -760,6 +760,11 @@ twpConfig.onReady(function () { } $("#showPopupMobile").value = twpConfig.get("showPopupMobile") + $("#isTranslateTitle").onchange = e => { + twpConfig.set("isTranslateTitle", e.target.value) + } + $("#isTranslateTitle").value = twpConfig.get("isTranslateTitle") + $("#showTranslatePageContextMenu").onchange = e => { twpConfig.set("showTranslatePageContextMenu", e.target.value) }