Creating a translation helper mixin

parent ad4c6437
export default {
methods: {
trans(string) {
// Makes a string: page.
let array = string.split('.');
if (array.length < 2) { return this.$t(string) }
let first = array.splice(0,1);
let key = array.join('.');
return this.$t(`${first}['${key}']`);
},
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment