我刚刚浏览了一些Vue.js代码HERE,并遇到了以下代码行:
.svg-icon.streak(v-html="icons.streak", v-b-tooltip.hover.bottom="$t('streakCounter')")
有这样的jQuery,就像语法$ t()一样,我不太理解,这个函数到底在做什么?它来自哪里?我没有imported
这样的功能吗?
有人可以解释这种类似于jQuery的语法在做什么吗?
答案 0 :(得分:2)
这来自i18n:https://github.com/HabitRPG/habitica/blob/develop/website/client/libs/i18n.js
// Vue plugin to globally expose a '$t' method that calls common/i18n.t.
// Can be anywhere inside vue as 'this.$t' or '$t' in templates.
您可以在此处找到streakCounter
:https://github.com/HabitRPG/habitica/blob/1135ab946e11300c2199c14cb5451f7370ed0b28/website/common/locales/en/tasks.json#L57(以及其他语言的其他翻译文件中)