<script type="text/javascript" src="./node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="./node_modules/i18next/i18next.min.js"></script>
<script type="text/javascript">
i18next.init({
lng: 'en',
resources: {
en: {
translation: {
"key": "hello world"
}
}
}
}, (err, t) => {
// initialized and ready to go!
const hw = i18next.t('key'); // hw = 'hello world'
});
</script>
</head>
<body>
<ul class="nav">
<li><a href="#" data-i18next="translation.hw"></a></li>
<li><a href="#" data-i18n="nav.page1"></a></li>
<li><a href="#" data-i18n="nav.page2"></a></li>
</ul>
</body>
最简单的demo,可是出不来国际化的东东,文档看的也不是很明白,不知道有没有大神可以指点指点,万分感谢!!!
呃,类似这种,我比较推荐通用的静态资源国际化方案 https://github.com/kenberkele...