mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-22 22:02:38 +03:00
i18n: useCopy messages
This commit is contained in:
1 parent
2cf9c75d96
commit
4351e57075
2 files changed
+7
-3
No files matched your search
@@ -7506,3 +7506,6 @@ tools:
|
|||||||
tag-link: Link
|
tag-link: Link
|
||||||
tag-status: Status
|
tag-status: Status
|
||||||
tag-open-url: Open Url
|
tag-open-url: Open Url
|
||||||
|
copy:
|
||||||
|
text:
|
||||||
|
copied-to-the-clipboard: Copied to the clipboard
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
import { useClipboard, useClipboardItems } from '@vueuse/core';
|
import { useClipboard, useClipboardItems } from '@vueuse/core';
|
||||||
import { useMessage } from 'naive-ui';
|
import { useMessage } from 'naive-ui';
|
||||||
import type { MaybeRefOrGetter } from 'vue';
|
import type { MaybeRefOrGetter } from 'vue';
|
||||||
|
import { translate as t } from '@/plugins/i18n.plugin';
|
||||||
|
|
||||||
export function useCopy({ source, text = 'Copied to the clipboard', createToast = true }: { source?: MaybeRefOrGetter<string>; text?: string; createToast?: boolean } = {}) {
|
export function useCopy({ source, text = t('tools.copy.text.copied-to-the-clipboard'), createToast = true }: { source?: MaybeRefOrGetter<string>; text?: string; createToast?: boolean } = {}) {
|
||||||
const { copy, copied, ...rest } = useClipboard({
|
const { copy, copied, ...rest } = useClipboard({
|
||||||
source,
|
source,
|
||||||
legacy: true,
|
legacy: true,
|
||||||
@@ -29,7 +30,7 @@ export function useCopy({ source, text = 'Copied to the clipboard', createToast
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useCopyClipboardItems({ source, text = 'Copied to the clipboard', createToast = true }: { source?: MaybeRefOrGetter<Array<{ mime: string; content: string }>>; text?: string; createToast?: boolean } = {}) {
|
export function useCopyClipboardItems({ source, text = t('tools.copy.text.copied-to-the-clipboard'), createToast = true }: { source?: MaybeRefOrGetter<Array<{ mime: string; content: string }>>; text?: string; createToast?: boolean } = {}) {
|
||||||
function toClipboardItem(item: { mime: string; content: string }) {
|
function toClipboardItem(item: { mime: string; content: string }) {
|
||||||
return new ClipboardItem({
|
return new ClipboardItem({
|
||||||
[item.mime]: new Blob([item.content], { type: item.mime }),
|
[item.mime]: new Blob([item.content], { type: item.mime }),
|
||||||
@@ -60,7 +61,7 @@ export function useCopyClipboardItems({ source, text = 'Copied to the clipboard'
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useCopyHtml({ sourceHtml, fallbackText, toastText = 'Copied to the clipboard', createToast = true }: { sourceHtml?: MaybeRefOrGetter<string>; fallbackText?: MaybeRefOrGetter<string>; toastText?: string; createToast?: boolean } = {}) {
|
export function useCopyHtml({ sourceHtml, fallbackText, toastText = t('tools.copy.text.copied-to-the-clipboard'), createToast = true }: { sourceHtml?: MaybeRefOrGetter<string>; fallbackText?: MaybeRefOrGetter<string>; toastText?: string; createToast?: boolean } = {}) {
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
|
|
||||||
const copied = ref(false);
|
const copied = ref(false);
|
||||||
|
|||||||
Reference in new issue
Block a user