Skip to content

godetremy/translatejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Features

  • ✅ Easy to add new language
  • ✅ Jquery not required

How to use

  • 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>

Exemple

HTML

<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>

en.json

{
	"title": "Translate.js demonstration page",
	"paragraph": "Learn how to use Translate.js in your pages !"
}

fr.json

{
	"title": "Page de demonstration Translate.js",
	"paragraph": "Apprenez à utiliser Translate.js dans vos pages !"
}

About

Easily translate your HTML pages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published