Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced JavaScript module from this repository #330

Closed
jerinphilip opened this issue Feb 5, 2022 · 3 comments
Closed

Enhanced JavaScript module from this repository #330

jerinphilip opened this issue Feb 5, 2022 · 3 comments

Comments

@jerinphilip
Copy link
Contributor

The current JavaScript "example" for the test page is perhaps not the best provision from here. There are a few common functions that can be abstracted here, potentially tested headless and seen by multiple eyes. Therefore, a better solution is a JavaScript library or module, ideally with an API consistent with the C++ from which it is derived.

The following are ideas of a few downstream applications of a JavaScript library that can do translation and is batteries included:

  1. The extension could be a consumer of this tested library eliminating human errors that come out of manual copying. (We got alignment:true and responseOptions.HTML correct here, but transfer to firefox-translations led to inconsistent config).
  2. Web based input method  jerinphilip/lemonade#56.
  3. A plugin that can be embedded on to sites to provide translation similar to a google offering: https://www.dummies.com/article/technology/notable-websites/google/how-to-install-google-translates-website-translator-plugin-145074

There are parts of this library already existing in sources across a few repositories. At the moment the extra work and duplication is convenient for faster development cycles. But at some point in the future, we should look at consolidating commonly used functionalities here co-located with the bindings and continuously tested. The JavaScript module can be part of the releases from this repository.

This issue is meant to investigate and discuss ideas, weigh the pros and cons of the approach.

@jerinphilip
Copy link
Contributor Author

jerinphilip commented Feb 11, 2022

OpenCV is a mature C++ library which exposes bindings to JavaScript and has JavaScript tests (https://docs.opencv.org/3.4/d4/da1/tutorial_js_setup.html) which we could potentially draw references/examples from. They also appear to be using WebAssembly SIMD and threads.

They allow automated testing variations of:

  1. Manually in browser
  2. Headless with Puppeteer
  3. Using Node.js.

@jerinphilip
Copy link
Contributor Author

There appears to be a headless mechanism to test JavaScript via Firefox of which an example can be found in mozilla/firefox-translations#106.

An incremental approach could be doing (1) manually in the browser and deploying to some health status Github page. This will prepare the test primitives and then we can look at the tests running headless.

@jerinphilip
Copy link
Contributor Author

@jelmervdl has successfully managed to run the WASM module via node.js in https://gist.github.com/jelmervdl/a4c8b6b92ad88a885e1cbd51c6ad4902. This opens up possibilities for headless testing.

@browsermt browsermt locked and limited conversation to collaborators Jun 29, 2022
@jerinphilip jerinphilip converted this issue into discussion #433 Jun 29, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant