<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app" >
<p>{{ $t("one.index", { mag: "ÎÒµÄ"}) }}</p>
</div>
</body>
<i18n>
cn: {
index: "ÄãºÃÊÀ½ç"
}
</i18n>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-i18n/dist/vue-i18n.js"></script>
<script>
new Vue({
i18n: new VueI18n({
locale: 'cn',
messages: {
cn: {
one: {
index: "ÄãºÃ {mag} ÊÀ½ç"
}
},
en: {
one: {
index: 'hello {0} world'
}
},
ja: {
one: {
index: '¤³¤ó¤Ë¤Á¤Ï¡¢ ÊÀ½ç | ÕâÊÇÎÒµÄÊÀ½ç | ÕâÊÇÄãµÄÊÀ½ç'
}
},
jw: {
one: {
index: '¤³¤ó¤Ë¤Á¤Ï¡¢ ÊÀ½ç | ÕâÊÇÎÒµÄÊÀ½ç | {mas}ÄãµÄÊÀ½ç'
}
}
}
})
}).$mount('#app')
</script>
</html>
$te(key, locale) ʹÓÃÖ¸¶¨µÄ locale ÓïÑÔ¿â
|