Translate page using mutation observer
npm install translate-mutation-observer!test
!npm publish
!nycrc config on GitHub
Translate html page using mutation observer
This only work on certain type of DOM changes such as appendChild() search for MutationObserver for more info
https://hoshiyuki-tamako.github.io/translate-mutation-observer/guide/
``bash`
npm i translate-mutation-observer
`ts
import { TranslateMutationObserver } from 'translate-mutation-observer';
// some translate function that take a full string and translate it
const t = (str: string) => str;
TranslateMutationObserver.n(t);
`
`ts
import { NodeTranslator } from 'translate-mutation-observer';
const t = (str: string) => str;
const translateMutationObserver = new NodeTranslator(t);
await translateMutationObserver.translate(document.documentElement);
`
`html``