This is a fork from stevenjoezhang/live2d-widget waifu-js tips that support i18n.
Original Documentation: https://github.com/stevenjoezhang/live2d-widget
For a full documentation, please check the above link.
NOTE: I tried my best to translate it to English. Some of them are still from Google Translate. Contribution for translations are welcome in all languages.
https://nonsoft-dev.github.io/live2d-widget-i18n/demo/demo.html
Fontawesome (same as original project):
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css">
i18n-js: https://github.com/fnando/i18n-js
<!-- Must include this BEFORE autoload.js. Ideally in <head> -->
<script src="https://cdn.jsdelivr.net/npm/i18n-js@3.8.0/app/assets/javascripts/i18n.min.js"></script>
Add i18n-js cdn as instructed above.
From our default autoload.js
, put this script in the bottom:
I18n.defaultLocale = "en-US";
I18n.locale = "en-US";
I18n.translations = {};
fetch("../i18n.json").then(res => res.json()).then(data => {
Object.keys(data).forEach(key => {
console.log("key", key)
I18n.translations[key] = data[key];
})
});
For a list of complete locale, click here.
Replace waifu-tips.json
the same as waifu-tips.json in this repo.
This will load up i18n syntax. Modify this file as you needed.
Replace waifu-tips.js
the same as waifu-tips.js in this repo.
This will modify the script to work with i18n.
i18n.json
will be the files contain our main conversations. Add more languages and modify as you wished.
Contribution are very welcome. You send a pull request.