- ✅ Easy to add new language
- ✅ Jquery not required
- In your HTML page, add script
<script src="https://raw.githubusercontent.com/DJremixOff/translatejs/main/translate.js" type="text/javascript"></script>
- Create new JSON file for translation
{
"key": "translation",
"key": "translation",
...
}
- Add meta property to your HTML page
<meta property="fr-lang" content="/fr.json"/>
- Change your text in your HTML page
<p>translate.key</p>
<html>
<head>
<title>Translate.js</title>
<script src="https://raw.githubusercontent.com/DJremixOff/translatejs/main/translate.js"></script>
<meta property="fr-lang" content="/fr.json"/>
<meta property="en-lang" content="/en.json"/>
</head>
<body>
<h1>translate.title</h1>
<p>translate.paragraph</p>
</body>
</html>
{
"title": "Translate.js demonstration page",
"paragraph": "Learn how to use Translate.js in your pages !"
}
{
"title": "Page de demonstration Translate.js",
"paragraph": "Apprenez à utiliser Translate.js dans vos pages !"
}