One way solution to convert text between multiple languages in browser. No any dependencies required.
- Install the npm
npm install jquery-come-translate --save
- Import the script tag after the jQuery
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- JQuery extension `Come Translate` -->
<script src="js/languages.pack.js"></script>
<script src="dist/js/jquery-come-translate.js"></script>
<script>
$(function () {
$.translate(function() {}, {debug: true, translation: dict, language: 'zhTW', attribute: 'my-data'});
//$.translate(function() {}, {debug: true, translation: dict, language: $.language('enUS'), attribute: 'my-data'});
});
</script>
<body>
<div><my-data id="test"></my-data></div>
</body>
npm install -g lite-server
lite-server
MIT