0.0.4 • Published 6 years ago
detect-translation v0.0.4
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).
Installation
yarn add detect-translationYou 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