Fix page translation not working
This commit is contained in:
parent
2ff56c8b93
commit
6472b21de2
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue