Switch Different Languages On The Webpage - jQuery multilang

File Size: 23.6 KB
Views Total: 7470
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Switch Different Languages On The Webpage - jQuery multilang

Yet another jQuery plugin for multilingual websites that automatically generates links to translate your website by switching between languages without page refresh.

How to use it:

1. Load the necessary JavaScript files in the html document.

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 
<script src="src/langs.min.js"></script>
<script src="src/jquery.multilang.min.js"></script>

2. Define the strings to be translated.

<div id="example">
  <h1 class="multilang" lang="es">Título</h1>
  <h1 class="multilang" lang="en">Title</h1>
  <p class="multilang" lang="es">Hola Mundo!</p>
  <p class="multilang" lang="en">Hello World!</p>

3. Call the function on the top container. Done.

$(function () {

4. Set the initial language. Default: browser language.

  defaultLang: 'en'

5. Hide the language switcher and use URL to translate the webpage.

<div id="example">
  <p class="multilang" lang="es">Hola Mundo! <a href="?lang=en">EN Version</a></p>
  <p class="multilang" lang="en">Hello World! <a href="?lang=es">ES Version</a></p>
  menu: false

7. Customize the languages (Without the need of lang.js).


8. Use images instead of language links.


This awesome jQuery plugin is developed by gar-cad. For more Advanced Usages, please check the demo page or visit the official website.