Author: | EOussama |
---|---|
Views Total: | 8,351 views |
Official Page: | Go to website |
Last Update: | December 9, 2020 |
License: | MIT |
Preview:

Description:
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.
translator.translate('fr'); translator.translate('es');
Changelog:
v3.1.0 (12/09/2020)
- This release allows for HTML parsing and adds full typing support for available methods and properties.