3636 @dragleave =" handleDragLeave"
3737 @dragover.prevent
3838 @drop.prevent.stop =" handleDrop"
39- placeholder =" 选择图片文件或拖拽到此处 "
39+ : placeholder =" $t('apps.image_path_placeholder') "
4040 />
4141 <button
4242 class =" btn btn-outline-secondary"
5151 <!-- 图片预览 -->
5252 <div v-if =" !isDesktopImage && imagePath" class =" image-preview-container mt-3" >
5353 <div class =" image-preview" >
54- <img :src =" previewUrl" alt =" 图片预览 " @error =" handleImageError" />
54+ <img :src =" previewUrl" : alt =" $t('apps.image_preview') " @error =" handleImageError" />
5555 </div >
5656 <div class =" image-preview-circle" >
57- <img :src =" previewUrl" alt =" 图片预览 " @error =" handleImageError" />
57+ <img :src =" previewUrl" : alt =" $t('apps.image_preview') " @error =" handleImageError" />
5858 </div >
5959 </div >
6060
@@ -139,7 +139,7 @@ export default {
139139 handleDragEnter (event ) {
140140 event .preventDefault ()
141141 this .dragCounter ++
142- this .$emit (' image-error' , ' 杂鱼~快放进来呀~ ' )
142+ this .$emit (' image-error' , this . $t ( ' apps.image_drop_hint ' ) )
143143 },
144144
145145 /**
@@ -162,7 +162,7 @@ export default {
162162
163163 const file = event .dataTransfer .files [0 ]
164164 if (! file) {
165- this .$emit (' image-error' , ' 其他地方不可以! ' )
165+ this .$emit (' image-error' , this . $t ( ' apps.image_drop_empty ' ) )
166166 return
167167 }
168168
@@ -173,20 +173,20 @@ export default {
173173 * 处理文件上传
174174 */
175175 async processFile (file ) {
176- const validation = validateFile (file)
176+ const validation = validateFile (file, { translate : this . $t } )
177177 if (! validation .isValid ) {
178178 this .$emit (' image-error' , validation .message )
179179 return
180180 }
181181
182182 try {
183- this .$emit (' image-error' , ' 正在上传图片... ' )
183+ this .$emit (' image-error' , this . $t ( ' apps.image_uploading ' ) )
184184 const path = await this .uploadImageToSunshine (file)
185185 this .$emit (' update-image' , path)
186186 this .$emit (' image-error' , ' ' )
187187 } catch (error) {
188188 console .error (' 上传图片失败:' , error)
189- this .$emit (' image-error' , ` 上传图片失败: ${ error .message } ` )
189+ this .$emit (' image-error' , this . $t ( ' apps.image_upload_failed ' , { error: error .message }) )
190190 }
191191 },
192192
@@ -235,15 +235,15 @@ export default {
235235 * 处理图片加载错误
236236 */
237237 handleImageError () {
238- this .$emit (' image-error' , ' 图片加载失败,请检查文件路径 ' )
238+ this .$emit (' image-error' , this . $t ( ' apps.image_load_failed ' ) )
239239 },
240240
241241 /**
242242 * 打开封面查找器
243243 */
244244 openCoverFinder () {
245245 if (! this .appName ) {
246- this .$emit (' image-error' , ' 请先输入应用名称 ' )
246+ this .$emit (' image-error' , this . $t ( ' apps.image_app_name_required ' ) )
247247 return
248248 }
249249 this .showCoverFinder = true
0 commit comments