Translate HTML Page Into Different Languages – Translatorjs

Category: Javascript , Text | December 9, 2020
Author: EOussama
Views Total: 2,338 views
Official Page: Go to website
Last Update: December 9, 2020
License: MIT


Translate HTML Page Into Different Languages – Translatorjs


Yet another page translation library which can be used to translate the HTML page into any languages defined in a JSON dictionary.

How to use it:

Download and import the Translatorjs library.

<script src="/path/to/translate.min.js"></script>

Add the CSS class trnsjs to strings which will be translated into other languages.

<p class="trnsjs">Hello</p>
<p class="trnsjs">About</p>

Define the strings in different languages as follows:

const dictionary = {
      "About": {
        'fr': 'A propos',
        'es': 'nos'
      "Hello": {
        'fr': 'Bonjour',
        'es': 'Hola',

Initialize the Translatorjs library.

const translator = new Translator(dictionary);

Switch between languages.



v3.1.0 (12/09/2020)

  • This release allows for HTML parsing and adds full typing support for available methods and properties.

You Might Be Interested In:

Leave a Reply