Multi Language Website with jQuery π¬π§πΉππ¨π³
Letβs make multi language website 

Get Ready 
A Simple Guide to implement Multi Language into your website. Here is the list of what is in use for this guide.
- HTML5
- Bootstrap
- jQuery
- JSON
Create βindex.htmlβ with language switch button 
βindex.htmlβ file that includes Bootstrap, jQuery, and custom script
Copy to Clipboard
It will look like this

<Head> where we include Bootstrap
Copy to Clipboard
<body> where we create the <h1> for text and button for each language
Copy to Clipboard
The end of <body> where we include jQuery, Bootstrap Script, and Our Custom Script
Copy to Clipboard
Create JSON files for each language 


Create folder call βlangβ and create .json file for each language

Code for th.json πΉπ
Copy to Clipboard
Code for en.json π¬π§
Copy to Clipboard
Code for ch.json π¨π³
Copy to Clipboard
Create script.js to handle language switching 
βscript.jsβ file
Copy to Clipboard
getLang() function to define a default language and fetch for json file according to selected language.
Copy to Clipboard
setLang(lang) function handle a language change when user click on the buttons β Parameter βlangβ define what language to change into.
Copy to Clipboard
English Button will call setLang(βenβ) when clicked.
Copy to Clipboard
Call a getLang() function and apply text into <h1> tag with id=βtextβ when a webpage is loaded.
Copy to Clipboard
Now your website can say βHelloβ in English
Thai
and Chinese
β
YAY! 
P.S. LocalStorage in javascript is not clear even when user close the program. LocalStorage is connect with the domain name. Therefore, next time the visitor connect to your website the selected language will be there by default.