Skip to content

Commit c3fd97e

Browse files
committed
feat(gui): add localization for save file action
- Add localization messages for "Save File As" action in both English and Chinese - Refactor AutoDevSaveFileAction to use new localization messages - Remove unused imports and simplify code
1 parent 76a4703 commit c3fd97e

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/snippet/AutoDevSaveFileAction.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import cc.unitmesh.devti.AutoDevBundle
44
import com.intellij.openapi.actionSystem.ActionUpdateThread
55
import com.intellij.openapi.actionSystem.AnAction
66
import com.intellij.openapi.actionSystem.AnActionEvent
7-
import com.intellij.openapi.actionSystem.CommonDataKeys
87
import com.intellij.openapi.actionSystem.PlatformDataKeys
98
import com.intellij.openapi.fileEditor.FileDocumentManager
109
import com.intellij.openapi.fileChooser.FileChooserFactory
@@ -14,8 +13,6 @@ import com.intellij.openapi.vfs.VirtualFileWrapper
1413
import com.intellij.openapi.application.ApplicationManager
1514
import com.intellij.openapi.ui.Messages
1615
import com.intellij.openapi.vfs.LocalFileSystem
17-
import com.intellij.psi.PsiElement
18-
import com.intellij.psi.PsiManager
1916
import java.io.IOException
2017

2118
class AutoDevSaveFileAction : AnAction(AutoDevBundle.message("autodev.save.action")) {
@@ -35,11 +32,7 @@ class AutoDevSaveFileAction : AnAction(AutoDevBundle.message("autodev.save.actio
3532
val virtualFile = FileDocumentManager.getInstance().getFile(document) ?: return
3633
val content = virtualFile.contentsToByteArray().toString(Charsets.UTF_8)
3734

38-
val descriptor = FileSaverDescriptor(
39-
"Save File As",
40-
"Choose location to save the file",
41-
*arrayOf()
42-
)
35+
val descriptor = FileSaverDescriptor(AutoDevBundle.message("autodev.save.as.file"), AutoDevBundle.message("autodev.save.as.file.description"))
4336

4437
val dialog: FileSaverDialog = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, project)
4538
val dir = project.baseDir

core/src/main/resources/messages/AutoDevBundle_en.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,5 @@ sketch.patch.repaired=Repaired
180180
sketch.patch.repair=Repair
181181
sketch.patch.apply=Apply
182182
sketch.patch.view=View
183+
autodev.save.as.file=Save File As
184+
autodev.save.as.file.description=Choose location to save the file

core/src/main/resources/messages/AutoDevBundle_zh.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,5 @@ sketch.patch.repaired=已修复
180180
sketch.patch.repair=修复
181181
sketch.patch.apply=修复
182182
sketch.patch.view=查看
183+
autodev.save.as.file=保存文件
184+
autodev.save.as.file.description=选择待保存文件位置

0 commit comments

Comments
 (0)