0๐
You can directly use Vue external functions like you did. Here is a short working example:
new Vue({
el: '#content',
data: {
text: t('hello_world')
}
})
function t(text) {
return 'Hello World' // simulate output for demonstration purposes
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.min.js"></script>
<div id="content">
{{ text }}
</div>
0๐
I think you should use Vue-i18n, it can solve you problem.
Source:stackexchange.com