0.0.4 • Published 4 years ago

detect-translation v0.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

detect-translation

This package attempts to detect when a website was translated on the client (using, for example, Google Translate in Chrome) or via a proxy (like using translate.google.com directly).

npm version Build Status

Installation

yarn add detect-translation

You can use npm if you prefer

The package was written in Typescript, so no need to install types separately.


Example Usage

import { observe } from 'detect-translation';

observe({
  onClient: (service, lang) => {
    console.log(`Client translation using ${service}, language ${lang}`);
  },
  onProxy: (service, lang) => {
    console.log(`Proxy translation using ${service}, language ${lang}`);
  }
});

detect-translation can currently detect the following services:

lang is the value of the <html> lang attribute - this gets set by the translation service.


MIT @ Claudiu Ceia