(Vue, options)
| 129 | |
| 130 | const VueI18Next = { |
| 131 | install (Vue, options) { |
| 132 | /* determine options */ |
| 133 | |
| 134 | let opts = {} |
| 135 | Vue.util.extend(opts, options) |
| 136 | |
| 137 | /* expose a global API method */ |
| 138 | |
| 139 | Vue.t = function (key, options) { |
| 140 | opts = {} |
| 141 | let lng = store.state.me.preferredLanguage || 'en' |
| 142 | if (!store.state.localesLoaded[lng]) { |
| 143 | lng = 'en' |
| 144 | } |
| 145 | if ((typeof lng === 'string') && (lng !== '')) { |
| 146 | opts.lng = lng |
| 147 | } |
| 148 | Vue.util.extend(opts, options) |
| 149 | return $.i18n.t(key, opts) |
| 150 | } |
| 151 | |
| 152 | /* expose a local API method */ |
| 153 | |
| 154 | Vue.prototype.$t = function (key, options) { |
| 155 | opts = {} |
| 156 | let lng = store.state.me.preferredLanguage || 'en' |
| 157 | if (!store.state.localesLoaded[lng]) { |
| 158 | lng = 'en' |
| 159 | } |
| 160 | if ((typeof lng === 'string') && (lng !== '')) { |
| 161 | opts.lng = lng |
| 162 | } |
| 163 | const ns = this.$options.i18nextNamespace |
| 164 | if ((typeof ns === 'string') && (ns !== '')) { |
| 165 | opts.ns = ns |
| 166 | } |
| 167 | Vue.util.extend(opts, options) |
| 168 | return $.i18n.t(key, opts) |
| 169 | } |
| 170 | |
| 171 | Vue.prototype.$dbt = function (source, key, options) { |
| 172 | if (options == null) { options = {} } |
| 173 | return utils.i18n(source, key, options.language, options.fallback) |
| 174 | } |
| 175 | }, |
| 176 | } |
| 177 | |
| 178 | return Vue.use(VueI18Next) |
nothing calls this directly
no outgoing calls
no test coverage detected