diff --git a/app/javascript/dashboard/composables/useI18n.js b/app/javascript/dashboard/composables/useI18n.js new file mode 100644 index 000000000..9bcdfe020 --- /dev/null +++ b/app/javascript/dashboard/composables/useI18n.js @@ -0,0 +1,32 @@ +import { computed, getCurrentInstance } from 'vue'; +import Vue from 'vue'; +import VueI18n from 'vue-i18n'; + +let i18nInstance = VueI18n; + +export function useI18n() { + if (!i18nInstance) throw new Error('vue-i18n not initialized'); + + const i18n = i18nInstance; + + const instance = getCurrentInstance(); + const vm = instance?.proxy || instance || new Vue({}); + + const locale = computed({ + get() { + return i18n.locale; + }, + set(v) { + i18n.locale = v; + }, + }); + + return { + locale, + t: vm.$t.bind(vm), + tc: vm.$tc.bind(vm), + d: vm.$d.bind(vm), + te: vm.$te.bind(vm), + n: vm.$n.bind(vm), + }; +} diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue index fb7e7b5eb..6f28dabb5 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue @@ -1,308 +1,173 @@ + + - - -