cschiller / zhongwen

Official source code of the "Zhongwen" Chrome extension
https://chrome.google.com/webstore/detail/zhongwen-chinese-english/kkmlkkjojmombglmlpbpapmhcaljjkde
GNU General Public License v2.0
312 stars 52 forks source link

No longer working on Google Docs? #83

Open danielberni opened 3 years ago

danielberni commented 3 years ago

is it just me or it's no longer working on Google Docs anymore? Other sites are working fine, but on Docs on Chrome or Firefox it does nothing, no error message, just it's not showing the translation anymore? Any help here would be appreciated thanks Daniel

cschiller commented 3 years ago

Hi Daniel,

Google is making changes to how Google Docs documents are represented using HTML in your browser. As a result, Zhongwen is no longer working in Google Docs. These changes are currently being rolled out by Google and will soon affect every Google Docs user. Unfortunately, I can't think of a way to fix this, since the change fundamentally breaks how Zhongwen sees the page.

Maybe someone has found a workaround for this that they want to share?

cschiller commented 3 years ago

Here's some technical background information regarding the changes Google is making:

http://workspaceupdates.googleblog.com/2021/05/Google-Docs-Canvas-Based-Rendering-Update.html

danielberni commented 3 years ago

Christian, thank you for the information. It makes sense now. As a workaround, I started using Word on the web browser of Office 365 and it's still working, but it would be awesome see your extension working again on Docs, since most users don't use Word on the web (yet) because it's paid, while Docs is still free. Hope to see your extension working again soon.

Daniel Berni Diretor Comercial @.**@.> www.dmstor.com.brhttp://www.dmstor.com.br/


From: Christian Schiller @.> Sent: Saturday, September 4, 2021 3:17 PM To: cschiller/zhongwen @.> Cc: Daniel Berni @.>; Author @.> Subject: Re: [cschiller/zhongwen] No longer working on Google Docs? (#83)

Here's some technical background information regarding the changes Google is making:

http://workspaceupdates.googleblog.com/2021/05/Google-Docs-Canvas-Based-Rendering-Update.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cschiller/zhongwen/issues/83#issuecomment-913017052, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APUH2YD5ODATQRWT2Q7L3KLUAJPD7ANCNFSM5DNINLLA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

cschiller commented 3 years ago

Daniel, thanks for sharing your Office 365 workaround. I'm aware of the fact that many Zhongwen users are using it in combination with Google Docs. Unfortunately, the way things stand with the changes Google is making, it's near impossible to fix. I can't think of a way to make it work with the canvas element. Google managed to thoroughly break it. Maybe there's a way to write a new extension specifically for Google Docs. But as far as Zhongwen is concerned, it will sadly not be possible to use it with the redesigned Google Docs.

ecaivassar commented 2 years ago

The Rikaikun extension which has similar functions as this but for Japanese, seems to still work on Google Docs. When I launch the extension, it specifically says "rikaikun is forcing Google Docs to render using HTML instead of canvas. rikaikun can't work with canvas mode but if you need that mode, please disable rikaikun". Maybe a similar workaround can be implemented? Not sure how one might disable the canvas rendering, however.

As a workaround, you can install rikaikun, and the two extensions can work together, allowing you to use Zhongwen again.

chinese-words-separator commented 2 years ago

The Rikaikun extension which has similar functions as this but for Japanese, seems to still work on Google Docs. When I launch the extension, it specifically says "rikaikun is forcing Google Docs to render using HTML instead of canvas. rikaikun can't work with canvas mode but if you need that mode, please disable rikaikun". Maybe a similar workaround can be implemented? Not sure how one might disable the canvas rendering, however.

As a workaround, you can install rikaikun, and the two extensions can work together, allowing you to use Zhongwen again.

Checked the code, I wonder where rikaikun found the code to force HTML for Google Docs:

const injectedCode = `(function() {window['_docs_force_html_by_ext'] = '${chrome.runtime.id}';})();`;

const script = document.createElement('script');

script.textContent = injectedCode;

// Usually, `document.head` isn't guaranteed to be present when content_scripts run but in this case
// we're running inside a callback so it should be 100% safe.
document.head.appendChild(script);

https://github.com/melink14/rikaikun/blob/94b60a64303d60ff08a05e71ec706a33da346821/extension/docs-html-fallback.ts

Tried googling _docs_force_html_by_ext, nothing turns up. Seems like an undocumented API

And this does not work in manifest v3, error is about Content Security Policy:

document.head.appendChild(script);

Hope someone will make a Chrome extension (manifest v3 preferably) that forces HTML for Google Docs, just for this purpose :)

Problem though is even if someone make a Force HTML on Google Doc Chrome extension, Google might permanently stop supporting that undocumented API

cschiller commented 2 years ago

I've looked into this already. Unfortunately, this is a temporary feature that Google will remove once the rollout of canvas-based rendering is complete. So in the near future, Google Docs will stop working for Rikaikun in its current form as well.

LanguageLeanerJ commented 2 years ago

I am sad this extension is no longer working with Google Docs. Its such a good extension for language learners. So sad. I hope there is a new version in the future based on the Canvas based coding.

jmlarch commented 2 years ago

FWIW, I've moved the content of the google documents for which I needed Zhongwen to zoho.com. Functionally, I'd say it is richer than gdocs; but there are occasional slowdowns, especially for longer documents.

leoyangdiary commented 2 years ago

" Maybe there's a way to write a new extension specifically for Google Docs ". this method you mentioned , I just want it to work in google docs , if I were to hire a guy (perhaps you haha) to accomplish this purpose for me , just how much it will cost , if its not that much , Id love to do it . if its too much , I think you can start a fundraising , Id happy to help and I believe many others as well , this extension is so good and too bad to see it `s not working no more , thanks , looking forward to your reply .

cristobalwong commented 2 years ago

Does anyone know if this problem may be fixable in the future? Really love this program and bummed to see it not working!

chinese-words-separator commented 1 year ago

A work-around to use Chinese pop-up dictionary on Google Docs

To pop-up the dictionary, need to press Alt key ( option key on mac ) while hovering the mouse cursor on the pasted Chinese text in CWS's Notes

work-around-for-google-doc-move-to-canvas-tech

LanguageLeanerJ commented 1 year ago

As an alternative you can use Shimo which is like an Asian version of Google Docs. Zhongwen still works fine on Shimo. Sent from my iPhoneOn Oct 4, 2022, at 7:55 PM, chinese-words-separator @.***> wrote: A work-around to use Chinese pop-up dictionary on Google Docs

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

danielberni commented 1 year ago

on zoho writer also works fine, I believe there is a free version as well


From: LanguageLeanerJ @.> Sent: Thursday, October 13, 2022 9:12 PM To: cschiller/zhongwen @.> Cc: Daniel Berni @.>; Author @.> Subject: Re: [cschiller/zhongwen] No longer working on Google Docs? (#83)

As an alternative you can use Shimo which is like an Asian version of Google Docs. Zhongwen still works fine on Shimo. Sent from my iPhoneOn Oct 4, 2022, at 7:55 PM, chinese-words-separator @.***> wrote: A work-around to use Chinese pop-up dictionary on Google Docs

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/cschiller/zhongwen/issues/83#issuecomment-1278306389, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APUH2YD4CEJ6CYHRSGMETSTWDCQNZANCNFSM5DNINLLA. You are receiving this because you authored the thread.Message ID: @.***>

mkarang commented 1 year ago

I used Google Doc because it's a convenient way to paste chinese text into browser so that I can use ZhongWen extension. Now I found out I don't have to do that. Just save your txt file locally, and open it directly on the browser (drag the text file to Chrome window). You need to follow this instruction for the hover to work: https://github.com/cschiller/zhongwen/issues/85#issuecomment-1288034588

EDIT: please disregard the above. See workaround below ("Read Offline"); it's much better.

chinese-words-separator commented 1 year ago

I used Google Doc because it's a convenient way to paste chinese text into browser so that I can use ZhongWen extension. Now I found out I don't have to do that. Just save your txt file locally, and open it directly on the browser (drag the text file to Chrome window). You need to follow this instruction for the hover to work: #85 (comment)

If you were primarily using Google Docs to use pop-up dictionaries for reading Chinese text; and now that pop-up dictionaries can't work in Google Docs, you can use CWS's Read Offline functionality instead:

image

Here's how Read Offline works:

image

By the way, Read Offline has a Parallel Text functionality, wherein you can see the parallel English text of the Chinese text you pasted or typed. To activate parallel text, press this button: ||, it's next to this button New. See the left portion of screenshot above