fix: localize upload status text

This commit is contained in:
Lan
2026-06-03 02:38:29 +08:00
parent 4fccffea7f
commit bef0d2ce3f
4 changed files with 32 additions and 11 deletions
+8 -7
View File
@@ -119,7 +119,7 @@
: 'bg-indigo-500 hover:bg-indigo-600 text-white' : 'bg-indigo-500 hover:bg-indigo-600 text-white'
]" ]"
> >
{{ retryText }} {{ retryLabel }}
</button> </button>
</div> </div>
</template> </template>
@@ -177,7 +177,7 @@ const props = withDefaults(defineProps<Props>(), {
totalBytes: 0, totalBytes: 0,
errorMessage: '', errorMessage: '',
allowRetry: true, allowRetry: true,
retryText: '重试', retryText: '',
showProgressDetails: true showProgressDetails: true
}) })
@@ -188,6 +188,7 @@ const isDarkMode = useInjectedDarkMode()
// 使用computed属性处理多语言文本 // 使用computed属性处理多语言文本
const placeholderText = computed(() => props.placeholder || t('send.uploadArea.placeholder')) const placeholderText = computed(() => props.placeholder || t('send.uploadArea.placeholder'))
const descriptionText = computed(() => props.description || t('send.uploadArea.description')) const descriptionText = computed(() => props.description || t('send.uploadArea.description'))
const retryLabel = computed(() => props.retryText || t('send.uploadArea.retry'))
const fileInput = ref<HTMLInputElement | null>(null) const fileInput = ref<HTMLInputElement | null>(null)
const isDragActive = ref(false) const isDragActive = ref(false)
@@ -204,7 +205,7 @@ const displayText = computed(() => {
return props.selectedFiles[0].name return props.selectedFiles[0].name
} }
if (props.selectedFiles && props.selectedFiles.length > 1) { if (props.selectedFiles && props.selectedFiles.length > 1) {
return `已选择 ${props.selectedFiles.length} 个文件` return t('send.uploadArea.selectedFiles', { count: props.selectedFiles.length })
} }
if (props.selectedFile) { if (props.selectedFile) {
return props.selectedFile.name return props.selectedFile.name
@@ -249,16 +250,16 @@ const statusDescription = computed(() => {
return props.errorMessage return props.errorMessage
} }
if (props.uploadStatus === 'initializing') { if (props.uploadStatus === 'initializing') {
return '正在初始化上传...' return t('send.uploadArea.status.initializing')
} }
if (props.uploadStatus === 'uploading') { if (props.uploadStatus === 'uploading') {
return '正在上传文件...' return t('send.uploadArea.status.uploading')
} }
if (props.uploadStatus === 'confirming') { if (props.uploadStatus === 'confirming') {
return '正在确认上传...' return t('send.uploadArea.status.confirming')
} }
if (isSuccess.value) { if (isSuccess.value) {
return '上传成功!' return t('send.uploadArea.status.success')
} }
return descriptionText.value return descriptionText.value
}) })
+4 -2
View File
@@ -32,8 +32,10 @@ export function useSendFlow() {
const isSubmitting = ref(false) const isSubmitting = ref(false)
const fileHash = ref('') const fileHash = ref('')
const sendRecords = computed(() => fileDataStore.shareData) const sendRecords = computed(() => fileDataStore.shareData)
const uploadDescription = computed( const uploadDescription = computed(() =>
() => `支持各种常见格式,最大${getStorageUnit(config.value.uploadSize)}` t('send.uploadArea.descriptionWithLimit', {
size: getStorageUnit(config.value.uploadSize)
})
) )
const expirationOptions = computed(() => const expirationOptions = computed(() =>
config.value.expireStyle.map((value) => ({ config.value.expireStyle.map((value) => ({
+10 -1
View File
@@ -215,7 +215,16 @@ export default {
clickText: 'click to select files', clickText: 'click to select files',
textInput: 'Enter text to send here...', textInput: 'Enter text to send here...',
placeholder: 'Click or drag files here to upload', placeholder: 'Click or drag files here to upload',
description: 'Supports various common formats' description: 'Supports various common formats',
descriptionWithLimit: 'Supports common formats, up to {size}',
retry: 'Retry',
selectedFiles: '{count} files selected',
status: {
initializing: 'Preparing upload...',
uploading: 'Uploading files...',
confirming: 'Confirming upload...',
success: 'Upload complete!'
}
}, },
submit: 'Secure Send', submit: 'Secure Send',
submitting: 'Sending...', submitting: 'Sending...',
+10 -1
View File
@@ -217,7 +217,16 @@ export default {
clickText: '点击选择文件', clickText: '点击选择文件',
textInput: '在此输入要发送的文本...', textInput: '在此输入要发送的文本...',
placeholder: '点击或拖放文件到此处上传', placeholder: '点击或拖放文件到此处上传',
description: '支持各种常见格式' description: '支持各种常见格式',
descriptionWithLimit: '支持各种常见格式,最大{size}',
retry: '重试',
selectedFiles: '已选择 {count} 个文件',
status: {
initializing: '正在初始化上传...',
uploading: '正在上传文件...',
confirming: '正在确认上传...',
success: '上传成功!'
}
}, },
submit: '安全寄送', submit: '安全寄送',
submitting: '发送中...', submitting: '发送中...',