Skip to content

Commit 68d1d21

Browse files
Use useI18n in media asset actions (#7744)
Use useI18n for media asset action translations and fix missing translation string. ## What changed - Switch the media asset actions composable to use `useI18n()` instead of the global `t`. - Use the existing `mediaAsset.selection.downloadsStarted` key for the single-download toast to avoid missing strings. ## Why - Aligns translation usage with the composition API and avoids referencing a non-existent key. - Reuses existing translation keys without adding new strings. ## Evidence - Tests: `pnpm lint:fix`, `pnpm typecheck`, `pnpm knip` ## References - N/A ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7744-Use-useI18n-in-media-asset-actions-2d26d73d365081f79cd1c5af105fc59b) by [Unito](https://www.unito.io)
1 parent 53b1dd2 commit 68d1d21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/platform/assets/composables/useMediaAssetActions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useToast } from 'primevue/usetoast'
22
import { inject } from 'vue'
3+
import { useI18n } from 'vue-i18n'
34

45
import ConfirmationDialogContent from '@/components/dialog/content/ConfirmationDialogContent.vue'
56
import { downloadFile } from '@/base/common/downloadUtil'
67
import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
7-
import { t } from '@/i18n'
88
import { isCloud } from '@/platform/distribution/types'
99
import { useWorkflowActionsService } from '@/platform/workflow/core/services/workflowActionsService'
1010
import { extractWorkflowFromAsset } from '@/platform/workflow/utils/workflowExtractionUtil'
@@ -25,6 +25,7 @@ import { MediaAssetKey } from '../schemas/mediaAssetSchema'
2525
import { assetService } from '../services/assetService'
2626

2727
export function useMediaAssetActions() {
28+
const { t } = useI18n()
2829
const toast = useToast()
2930
const dialogStore = useDialogStore()
3031
const mediaContext = inject(MediaAssetKey, null)
@@ -79,7 +80,7 @@ export function useMediaAssetActions() {
7980
toast.add({
8081
severity: 'success',
8182
summary: t('g.success'),
82-
detail: t('g.downloadStarted'),
83+
detail: t('mediaAsset.selection.downloadsStarted', { count: 1 }),
8384
life: 2000
8485
})
8586
} catch (error) {

0 commit comments

Comments
 (0)