Giter VIP home page Giter VIP logo

ext-saladict's Introduction

Saladict 沙拉查词

Version Chrome Web Store Chrome Web Store Mozilla Add-on Mozilla Add-on

Build Status Commitizen friendly Conventional Commits Standard - JavaScript Style Guide License

Chrome/Firefox WebExtension. Feature-rich inline translator with PDF support. Vimium compatible.

【中文】Chrome/Firefox 浏览器插件,网页划词翻译。

Downloads

Chrome Web Store / Firefox Add-ons / Github Release

Saladict 6 is a complete rewrite in React Typescript for both Chrome & Firefox. Built for speed, stability and customization.

CHANGELOG

More screenshots:

Development

Clone the repo and run yarn install.

UI Tweaking

yarn start --main=[entry id] to view a certain entry with WDS in a fake WebExtension environment.

Testing

yarn test to run Jest.

Toggle:

  • --coverage: Show coverage instead of watching.

Building

yarn devbuild to start a quick build without compression.

yarn build to start a full build.

Toggle:

  • --notypecheck: Skip TypeScript full check.
  • --analyze: Show detailed Webpack bundle analyzer.

Releasing

yarn release to bump version and generate CHANGELOG.

How to add a dictionary

  1. Register the dictionary in app config so that TypeScript generates the correct typings. Dict ID should follow alphabetical order.
  2. Create a directory at src/components/dictionaries/, with the name of the dict ID.
  3. Use Bing as guidance. Copy the files to the new directory.
  4. Replace the favicon with a new 32x32 png.
  5. Update _locales.json with the new dictionary name. Add locales for options, if any.
  6. engine.ts exports a search function which is responsible for fetching, parsing and returning dictionary results. See the typings for more detail.
    • If the dictionary supports pronunciation:
      1. Register the ID at config.autopron.
      2. Include an audio field in the object which search engine returns.
  7. Search result will ultimately be passed to a React PureComponent in View.tsx, which renders the result accordingly.
  8. Scope the styles in _style.scss following ECSS-ish naming convention.

Add Testing

  1. Add response samples at test/specs/components/dictionaries/[dictID]/response.
  2. Add engine.spec.ts to test the engine.

Develop the dictionary UI live

  1. Intercept ajax calls in config/fake-env/fake-ajax.js. Use the testing response samples.
  2. Edit src/components/__fake__/index.tsx.
  3. Run yarn start --main=components.

ext-saladict's People

Contributors

crimx avatar greenkeeper[bot] avatar greenkeeperio-bot avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.