mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
[i18n] Translate toast messages (#3228)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import Load3DAnimation from '@/components/load3d/Load3DAnimation.vue'
|
||||
import Load3DConfiguration from '@/extensions/core/load3d/Load3DConfiguration'
|
||||
import Load3dAnimation from '@/extensions/core/load3d/Load3dAnimation'
|
||||
import Load3dUtils from '@/extensions/core/load3d/Load3dUtils'
|
||||
import { t } from '@/i18n'
|
||||
import { CustomInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
|
||||
import { api } from '@/scripts/api'
|
||||
import { ComponentWidgetImpl, addWidget } from '@/scripts/domWidget'
|
||||
@@ -38,7 +39,7 @@ useExtensionService().registerExtension({
|
||||
fileInput.files[0]
|
||||
).catch((error) => {
|
||||
console.error('File upload failed:', error)
|
||||
useToastStore().addAlert('File upload failed')
|
||||
useToastStore().addAlert(t('toastMessages.fileUploadFailed'))
|
||||
})
|
||||
|
||||
const modelUrl = api.apiURL(
|
||||
@@ -180,7 +181,7 @@ useExtensionService().registerExtension({
|
||||
fileInput.files[0]
|
||||
).catch((error) => {
|
||||
console.error('File upload failed:', error)
|
||||
useToastStore().addAlert('File upload failed')
|
||||
useToastStore().addAlert(t('toastMessages.fileUploadFailed'))
|
||||
})
|
||||
|
||||
const modelUrl = api.apiURL(
|
||||
@@ -352,10 +353,8 @@ useExtensionService().registerExtension({
|
||||
let filePath = message.model_file[0]
|
||||
|
||||
if (!filePath) {
|
||||
const msg = 'unable to get model file path.'
|
||||
|
||||
const msg = t('toastMessages.unableToGetModelFilePath')
|
||||
console.error(msg)
|
||||
|
||||
useToastStore().addAlert(msg)
|
||||
}
|
||||
|
||||
@@ -429,10 +428,8 @@ useExtensionService().registerExtension({
|
||||
let filePath = message.model_file[0]
|
||||
|
||||
if (!filePath) {
|
||||
const msg = 'unable to get model file path.'
|
||||
|
||||
const msg = t('toastMessages.unableToGetModelFilePath')
|
||||
console.error(msg)
|
||||
|
||||
useToastStore().addAlert(msg)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '@/i18n'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
@@ -55,7 +56,9 @@ class Load3dUtils {
|
||||
} catch (error) {
|
||||
console.error('Upload error:', error)
|
||||
useToastStore().addAlert(
|
||||
error instanceof Error ? error.message : 'Upload failed'
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: t('toastMessages.fileUploadFailed')
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
|
||||
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
|
||||
import { STLLoader } from 'three/examples/jsm/loaders/STLLoader'
|
||||
|
||||
import { t } from '@/i18n'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
|
||||
import {
|
||||
@@ -67,7 +68,7 @@ export class LoaderManager implements LoaderManagerInterface {
|
||||
}
|
||||
|
||||
if (!fileExtension) {
|
||||
useToastStore().addAlert('Could not determine file type')
|
||||
useToastStore().addAlert(t('toastMessages.couldNotDetermineFileType'))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ export class LoaderManager implements LoaderManagerInterface {
|
||||
} catch (error) {
|
||||
this.eventManager.emitEvent('modelLoadingEnd', null)
|
||||
console.error('Error loading model:', error)
|
||||
useToastStore().addAlert('Error loading model')
|
||||
useToastStore().addAlert(t('toastMessages.errorLoadingModel'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter'
|
||||
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter'
|
||||
import { STLExporter } from 'three/examples/jsm/exporters/STLExporter'
|
||||
|
||||
import { t } from '@/i18n'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
|
||||
export class ModelExporter {
|
||||
@@ -46,7 +47,7 @@ export class ModelExporter {
|
||||
URL.revokeObjectURL(link.href)
|
||||
} catch (error) {
|
||||
console.error('Error downloading from URL:', error)
|
||||
useToastStore().addAlert('Failed to download file from URL')
|
||||
useToastStore().addAlert(t('toastMessages.failedToDownloadFile'))
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -84,7 +85,9 @@ export class ModelExporter {
|
||||
ModelExporter.saveArrayBuffer(result, filename)
|
||||
} catch (error) {
|
||||
console.error('Error exporting GLB:', error)
|
||||
useToastStore().addAlert('Failed to export model as GLB')
|
||||
useToastStore().addAlert(
|
||||
t('toastMessages.failedToExportModel', { format: 'GLB' })
|
||||
)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -111,7 +114,9 @@ export class ModelExporter {
|
||||
ModelExporter.saveString(result, filename)
|
||||
} catch (error) {
|
||||
console.error('Error exporting OBJ:', error)
|
||||
useToastStore().addAlert('Failed to export model as OBJ')
|
||||
useToastStore().addAlert(
|
||||
t('toastMessages.failedToExportModel', { format: 'OBJ' })
|
||||
)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -138,7 +143,9 @@ export class ModelExporter {
|
||||
ModelExporter.saveString(result, filename)
|
||||
} catch (error) {
|
||||
console.error('Error exporting STL:', error)
|
||||
useToastStore().addAlert('Failed to export model as STL')
|
||||
useToastStore().addAlert(
|
||||
t('toastMessages.failedToExportModel', { format: 'STL' })
|
||||
)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class ManageTemplates extends ComfyDialog {
|
||||
|
||||
exportAll() {
|
||||
if (this.templates.length == 0) {
|
||||
useToastStore().addAlert('No templates to export.')
|
||||
useToastStore().addAlert(t('toastMessages.noTemplatesToExport'))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user