diff --git a/changelog/unreleased/change-update-vue b/changelog/unreleased/change-update-vue index 80e495d3a62..d5dfc1d0651 100644 --- a/changelog/unreleased/change-update-vue +++ b/changelog/unreleased/change-update-vue @@ -16,4 +16,5 @@ https://github.com/owncloud/web/pull/8213 https://github.com/owncloud/web/pull/8214 https://github.com/owncloud/web/pull/8221 https://github.com/owncloud/web/pull/8256 +https://github.com/owncloud/web/pull/8257 https://github.com/owncloud/web/pull/8258 diff --git a/package.json b/package.json index 9f4f9c48d23..0a2c25bea36 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "url-search-params-polyfill": "8.1.1", "vite": "4.0.4", "vite-plugin-environment": "^1.1.3", - "vue-gettext": "2.1.12", + "vue3-gettext": "^2.3.3", "vue-tsc": "1.0.20", "wait-for-expect": "3.0.2" }, @@ -146,7 +146,6 @@ "patchedDependencies": { "@adobe/leonardo-contrast-colors@1.0.0-alpha.16": "patches/@adobe__leonardo-contrast-colors@1.0.0-alpha.16.patch", "jest-serializer-vue-tjw@3.19.0": "patches/jest-serializer-vue-tjw@3.19.0.patch", - "vue-gettext@2.1.12": "patches/vue-gettext@2.1.12.patch", "keycode@2.2.1": "patches/keycode@2.2.1.patch", "vue-inline-svg@3.1.0": "patches/vue-inline-svg@3.1.0.patch" } diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 197f25ff9fc..ba11543584c 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -107,7 +107,7 @@ "typescript": "^4.3.2", "url-loader": "^4.1.1", "v-calendar": "github:dschmidt/v-calendar#3ce6e3b8afd5491cb53ee811281d5fa8a45b044d", - "vue-gettext": "^2.1.12", + "vue3-gettext": "^2.3.3", "vue-inline-svg": "^3.1.0", "vue-jest": "^3.0.4", "vue-loader": "^15.9.0", diff --git a/packages/design-system/src/components/OcSearchBar/OcSearchBar.spec.ts b/packages/design-system/src/components/OcSearchBar/OcSearchBar.spec.ts index 49f85881940..ebbcbe0bd7d 100644 --- a/packages/design-system/src/components/OcSearchBar/OcSearchBar.spec.ts +++ b/packages/design-system/src/components/OcSearchBar/OcSearchBar.spec.ts @@ -228,5 +228,10 @@ function getWrapper(props = {}) { }) } function getMountedWrapper() { - return mount(OcSearchBar, { props: { label: 'abc' } }) + return mount(OcSearchBar, { + props: { label: 'abc' }, + global: { + plugins: [...defaultPlugins()] + } + }) } diff --git a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts index 5458d8a5906..8c258db49c2 100644 --- a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts +++ b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts @@ -1,5 +1,5 @@ import StatusIndicators from './OcStatusIndicators.vue' -import { mount } from 'web-test-helpers' +import { defaultPlugins, mount } from 'web-test-helpers' const fileResource = { name: 'forest.jpg', @@ -24,6 +24,9 @@ describe('OcStatusIndicators', () => { resource: fileResource, indicators: [indicator], target: 'test' + }, + global: { + plugins: [...defaultPlugins()] } }) wrapper.find('.oc-status-indicators-indicator').trigger('click') @@ -35,6 +38,9 @@ describe('OcStatusIndicators', () => { resource: fileResource, indicators: [indicator], target: 'test' + }, + global: { + plugins: [...defaultPlugins()] } }) expect(wrapper.find(`#${indicator.id}`).exists()).toBeTruthy() diff --git a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue index 127a92ba180..259cb3ac35f 100644 --- a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue +++ b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue @@ -5,9 +5,9 @@ v-if="hasHandler(indicator)" :id="indicator.id" :key="indicator.id" - v-oc-tooltip="indicator.label" + v-oc-tooltip="$gettext(indicator.label)" class="oc-status-indicators-indicator oc-background-primary-gradient oc-p-xs oc-ml-xs" - :aria-label="indicator.label" + :aria-label="$gettext(indicator.label)" :aria-describedby="getIndicatorDescriptionId(indicator)" appearance="raw" variation="inverse" @@ -21,13 +21,13 @@ v-else :id="indicator.id" :key="indicator.id" - v-oc-tooltip="indicator.label" + v-oc-tooltip="$gettext(indicator.label)" tabindex="-1" size="small" class="oc-status-indicators-indicator" :name="indicator.icon" :fill-type="indicator.fillType" - :accessible-label="indicator.label" + :accessible-label="$gettext(indicator.label)" :aria-describedby="getIndicatorDescriptionId(indicator)" :data-testid="indicator.id" :data-test-indicator-type="indicator.type" @@ -37,7 +37,7 @@ :id="getIndicatorDescriptionId(indicator)" :key="getIndicatorDescriptionId(indicator)" class="oc-invisible-sr" - v-text="indicator.accessibleDescription" + v-text="$gettext(indicator.accessibleDescription)" /> diff --git a/packages/design-system/src/components/OcTable/OcTable.sort.spec.ts b/packages/design-system/src/components/OcTable/OcTable.sort.spec.ts index ce004c1f7c2..ac0a2f7782d 100644 --- a/packages/design-system/src/components/OcTable/OcTable.sort.spec.ts +++ b/packages/design-system/src/components/OcTable/OcTable.sort.spec.ts @@ -128,6 +128,7 @@ describe('OcTable.sort', () => { data }, global: { + plugins: [...defaultPlugins()], stubs: { 'oc-icon': true } @@ -175,6 +176,7 @@ describe('OcTable.sort', () => { sortDir: sortDirOld }, global: { + plugins: [...defaultPlugins()], stubs: { 'oc-icon': true } diff --git a/packages/design-system/src/components/OcTextInput/OcTextInput.spec.ts b/packages/design-system/src/components/OcTextInput/OcTextInput.spec.ts index c2c8fb99502..ba8883afac5 100644 --- a/packages/design-system/src/components/OcTextInput/OcTextInput.spec.ts +++ b/packages/design-system/src/components/OcTextInput/OcTextInput.spec.ts @@ -17,7 +17,12 @@ describe('OcTextInput', () => { } function getMountedWrapper(options = {}) { - return mount(OcTextInput, options) + return mount(OcTextInput, { + ...options, + global: { + plugins: [...defaultPlugins()] + } + }) } const selectors = { diff --git a/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue b/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue index 02e23bd30ea..f2e5f65c45a 100644 --- a/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue +++ b/packages/web-app-admin-settings/src/components/Spaces/SpacesList.vue @@ -136,10 +136,10 @@ import { } from 'web-pkg/src/helpers' import { computed, defineComponent, nextTick, onMounted, PropType, ref, unref, watch } from 'vue' import { extractDomSelector, SpaceResource } from 'web-client/src/helpers' -import { useTranslations } from 'web-pkg/src/composables' import { spaceRoleEditor, spaceRoleManager, spaceRoleViewer } from 'web-client/src/helpers/share' import Mark from 'mark.js' import Fuse from 'fuse.js' +import { useGettext } from 'vue3-gettext' export default defineComponent({ name: 'SpacesList', @@ -159,7 +159,7 @@ export default defineComponent({ }, emits: ['toggleSelectSpace', 'toggleSelectAllSpaces', 'toggleUnSelectAllSpaces'], setup: function (props, { emit }) { - const { $gettext, $gettextInterpolate, $language } = useTranslations() + const { $gettext, interpolate: $gettextInterpolate, current: currentLanguage } = useGettext() const contextMenuButton = ref(undefined) const sortBy = ref('name') const sortDir = ref('asc') @@ -321,25 +321,25 @@ export default defineComponent({ return managerStr } const formatDate = (date) => { - return formatDateFromJSDate(new Date(date), $language.current) + return formatDateFromJSDate(new Date(date), currentLanguage) } const formatDateRelative = (date) => { - return formatRelativeDateFromJSDate(new Date(date), $language.current) + return formatRelativeDateFromJSDate(new Date(date), currentLanguage) } const getTotalQuota = (space: SpaceResource) => { - return formatFileSize(space.spaceQuota.total, $language.current) + return formatFileSize(space.spaceQuota.total, currentLanguage) } const getUsedQuota = (space: SpaceResource) => { if (space.spaceQuota.used === undefined) { return '-' } - return formatFileSize(space.spaceQuota.used, $language.current) + return formatFileSize(space.spaceQuota.used, currentLanguage) } const getRemainingQuota = (space: SpaceResource) => { if (space.spaceQuota.remaining === undefined) { return '-' } - return formatFileSize(space.spaceQuota.remaining, $language.current) + return formatFileSize(space.spaceQuota.remaining, currentLanguage) } const getMemberCount = (space: SpaceResource) => { return ( diff --git a/packages/web-app-admin-settings/src/views/Spaces.vue b/packages/web-app-admin-settings/src/views/Spaces.vue index 6aba7b57a60..4af57509df2 100644 --- a/packages/web-app-admin-settings/src/views/Spaces.vue +++ b/packages/web-app-admin-settings/src/views/Spaces.vue @@ -63,7 +63,7 @@