diff --git a/src/background/keyboardShortcuts.js b/src/background/keyboardShortcuts.js index 0236fc7..6a04f6e 100644 --- a/src/background/keyboardShortcuts.js +++ b/src/background/keyboardShortcuts.js @@ -54,7 +54,7 @@ const translatePage = async () => { const targetLang = getSettings("targetLang"); const encodedPageUrl = encodeURIComponent(tabUrl); - const translationUrl = `https://translate.google.com/translate?hl=${targetLang}&sl=auto&u=${encodedPageUrl}`; + const translationUrl = `https://translate.google.com/translate?hl=${targetLang}&tl=${targetLang}&sl=auto&u=${encodedPageUrl}`; browser.tabs.create({ url: translationUrl, diff --git a/src/background/menus.js b/src/background/menus.js index f2c4e9a..6b3b518 100644 --- a/src/background/menus.js +++ b/src/background/menus.js @@ -81,7 +81,7 @@ function translateText(tab) { function translatePage(info, tab) { const targetLang = getSettings("targetLang"); const encodedPageUrl = encodeURIComponent(info.pageUrl); - const translationUrl = `https://translate.google.com/translate?hl=${targetLang}&sl=auto&u=${encodedPageUrl}`; + const translationUrl = `https://translate.google.com/translate?hl=${targetLang}&tl=${targetLang}&sl=auto&u=${encodedPageUrl}`; browser.tabs.create({ url: translationUrl, @@ -93,7 +93,7 @@ function translatePage(info, tab) { function translateLink(info, tab) { const targetLang = getSettings("targetLang"); const encodedLinkUrl = encodeURIComponent(info.linkUrl); - const translationUrl = `https://translate.google.com/translate?hl=${targetLang}&sl=auto&u=${encodedLinkUrl}`; + const translationUrl = `https://translate.google.com/translate?hl=${targetLang}&tl=${targetLang}&sl=auto&u=${encodedLinkUrl}`; browser.tabs.create({ url: translationUrl, diff --git a/src/popup/components/Footer.js b/src/popup/components/Footer.js index 02805cf..ba627e4 100644 --- a/src/popup/components/Footer.js +++ b/src/popup/components/Footer.js @@ -13,7 +13,7 @@ export default class Footer extends Component { handleLinkClick = async () => { const { tabUrl, targetLang } = this.props; const encodedUrl = encodeURIComponent(tabUrl); - const translateUrl = `https://translate.google.com/translate?hl=${targetLang}&sl=auto&u=${encodedUrl}`; + const translateUrl = `https://translate.google.com/translate?hl=${targetLang}&tl=${targetLang}&sl=auto&u=${encodedUrl}`; openUrl(translateUrl); };