/Languager

Languager is ease to use JavaScript program that will make ease to create websites with multiple languages

Primary LanguageJavaScript

Languager

Languager is ease to use JavaScript program that will make ease to create websites with multiple languages

Installation

Download module.js and add the script to your webpage.

<script src='module.js'></script>

Usage

First you need to initialize a class.

var languager = new Languager({
    element: document.body,
    pageTitle: "homepage"
})

You need to set element which will be your main element where is your website located. If you have #root div, you can put it there.

Now you just run this command to load strings from json file that will be generated by editor.

Pagetitle is setting that is used to select string that should be in title. In this case it will select title with key "homepage".

languager.load("/strings.json")

Add string to your site

<h1>[titleMyWebsite]</h1>

This will add h1 with titleMyWebsite text from json that you loaded.

Language change button

If you want to add language change button you just put this button inside your html:

<button onclick="languager.changeLanguage('en')">English</button>

This button will change language to English.

Editor

HTML Editor

You can visit JSON Editor written in HTML, CSS and JavaScript here

Open

Python Editor

Editor is python program that will help you create your json file easily.

Run editor

To start editor you download editor.py file and run this command:

python3 editor.py