diff --git a/src/composables/settings-i18n.js b/src/composables/settings-i18n.js deleted file mode 100644 index 97eb6e46b0..0000000000 --- a/src/composables/settings-i18n.js +++ /dev/null @@ -1,34 +0,0 @@ -import { computed } from 'vue' -import { useI18n } from 'vue-i18n' -const SORT_ORDER_KEY = Object.freeze({ - ASC: 'asc', - DESC: 'desc' -}) -const SORT_TYPE_KEY = Object.freeze({ - DEFAULT: 'default', - ALPHA: 'alpha', - NUMBER: 'number', - QUANTITY: 'quantity', - DATE: 'date' -}) - -export function useSettingsI18n() { - const { t } = useI18n() - const sortByLabel = computed(() => t('settingsI18n.sortBy.label')) - - function tSortByOption(name, order = SORT_ORDER_KEY.ASC, type = SORT_TYPE_KEY.DEFAULT) { - return computed(() => - t(`settingsI18n.sortBy.format`, { - name: t(`settingsI18n.options.${name}`), - order: t(`settingsI18n.order.${type}.${order}`) - }) - ) - } - const tLayout = { - label: computed((_) => t('settingsI18n.view.label')), - grid: computed((_) => t('settingsI18n.view.grid')), - table: computed((_) => t('settingsI18n.view.table')) - } - const perPageLabel = (titleKey) => computed((_) => t('settingsI18n.perPage', { title: t(titleKey) })) - return { SORT_ORDER_KEY, SORT_TYPE_KEY, tSortByOption, sortByLabel, tLayout, perPageLabel } -} diff --git a/src/composables/view-settings.js b/src/composables/view-settings.js new file mode 100644 index 0000000000..3666d8b5b8 --- /dev/null +++ b/src/composables/view-settings.js @@ -0,0 +1,35 @@ +import { computed } from 'vue' +import { useI18n } from 'vue-i18n' +const SORT_ORDER_KEY = Object.freeze({ + ASC: 'asc', + DESC: 'desc' +}) +const SORT_TYPE_KEY = Object.freeze({ + DEFAULT: 'default', + ALPHA: 'alpha', + NUMBER: 'number', + QUANTITY: 'quantity', + DATE: 'date' +}) + +export function useViewSettings() { + const { t } = useI18n() + const sortByLabel = computed(() => t('viewSettings.sortBy.label')) + const visiblePropertiesLabel = computed(() => t('viewSettings.properties')) + + function tSortByOption(name, order = SORT_ORDER_KEY.ASC, type = SORT_TYPE_KEY.DEFAULT) { + return computed(() => + t(`viewSettings.sortBy.format`, { + name: t(`viewSettings.options.${name}`), + order: t(`viewSettings.order.${type}.${order}`) + }) + ) + } + const tLayout = { + label: computed((_) => t('viewSettings.view.label')), + grid: computed((_) => t('viewSettings.view.grid')), + table: computed((_) => t('viewSettings.view.table')) + } + const perPageLabel = (titleKey) => computed((_) => t('viewSettings.perPage', { title: t(titleKey) })) + return { SORT_ORDER_KEY, SORT_TYPE_KEY, tSortByOption, sortByLabel, visiblePropertiesLabel, tLayout, perPageLabel } +} diff --git a/src/views/Task/TasksListSettings.vue b/src/views/Task/TasksListSettings.vue index 4ade3af260..880a208a34 100644 --- a/src/views/Task/TasksListSettings.vue +++ b/src/views/Task/TasksListSettings.vue @@ -1,18 +1,20 @@