I have implemented vue-lang from https://github.com/kvdmolen/vue-lang, but I am facing some issues.
PROBLEM
There is an example in the JSON file:
"messages": "You have {0} {1} messages"
Following this example, I added a filter to my code:
<p>{{$lang.messages | replace countmsg 'new'}}</p>
However, when I try to use it, I encounter an error:
[Vue warn]: Failed to resolve filter: replace countmsg 'new'
MY SETUP
In main.js:
import Vue from 'vue'
import Lang from 'vue-lang'
const locales = {
'cs': require('./lang/cs.json')
}
Vue.use(Lang, {lang: 'cs', locales: locales})
lang/cs.json contents:
{
"messages": "You have {0} {1} messages"
}
In views/login.vue:
<template>
<p>{{$lang.messages | replace countmsg 'new'}}</p>
</template>
<script>
export default {
name: 'Login',
data: function() {
return {
countmsg: 5
}
}
</script>
Despite these configurations, the functionality is still not working. What might be the issue?