diff --git a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/ZLSPanel.kt b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/ZLSPanel.kt index 259fbce7..2c166de2 100644 --- a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/ZLSPanel.kt +++ b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/ZLSPanel.kt @@ -22,6 +22,7 @@ package com.falsepattern.zigbrains.lsp.zls +import com.falsepattern.zigbrains.lsp.ZLSBundle import com.falsepattern.zigbrains.lsp.settings.ZLSSettingsPanel import com.falsepattern.zigbrains.project.toolchain.local.LocalZigToolchain import com.falsepattern.zigbrains.project.toolchain.ui.ImmutableNamedElementPanelBase @@ -49,7 +50,7 @@ import kotlin.io.path.pathString class ZLSPanel() : ImmutableNamedElementPanelBase() { private val pathToZLS = textFieldWithBrowseButton( null, - FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withTitle("Path to the zls executable") + FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withTitle(ZLSBundle.message("dialog.title.zls")) ).also { it.textField.document.addDocumentListener(object : DocumentAdapter() { override fun textChanged(e: DocumentEvent) { @@ -64,14 +65,14 @@ class ZLSPanel() : ImmutableNamedElementPanelBase() { override fun attach(p: Panel): Unit = with(p) { super.attach(p) - row("Path:") { + row(ZLSBundle.message("settings.panel.path.label")) { cell(pathToZLS).resizableColumn().align(AlignX.FILL) } - row("Version:") { + row(ZLSBundle.message("settings.panel.version.label")) { cell(zlsVersion) } val sp = ZLSSettingsPanel() - p.collapsibleGroup("Settings", indent = false) { + p.collapsibleGroup(ZLSBundle.message("settings.panel.settings.group.label"), indent = false) { sp.attach(this@collapsibleGroup) } settingsPanel = sp diff --git a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSDownloader.kt b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSDownloader.kt index 8671d551..b03fed30 100644 --- a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSDownloader.kt +++ b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSDownloader.kt @@ -22,22 +22,19 @@ package com.falsepattern.zigbrains.lsp.zls.downloader +import com.falsepattern.zigbrains.lsp.ZLSBundle import com.falsepattern.zigbrains.lsp.zls.ZLSVersion import com.falsepattern.zigbrains.lsp.zls.ui.getSuggestedZLSPath import com.falsepattern.zigbrains.project.settings.ZigProjectConfigurationProvider import com.falsepattern.zigbrains.project.settings.ZigProjectConfigurationProvider.IUserDataBridge import com.falsepattern.zigbrains.project.toolchain.base.ZigToolchainConfigurable import com.falsepattern.zigbrains.shared.downloader.Downloader -import com.intellij.openapi.util.io.toNioPathOrNull -import com.intellij.util.system.OS import java.awt.Component -import java.nio.file.Path -import kotlin.io.path.isDirectory class ZLSDownloader(component: Component, private val data: IUserDataBridge?) : Downloader(component) { - override val windowTitle get() = "Install ZLS" - override val versionInfoFetchTitle get() = "Fetching zls version information" - override fun downloadProgressTitle(version: ZLSVersionInfo) = "Installing ZLS ${version.version.rawVersion}" + override val windowTitle get() = ZLSBundle.message("settings.downloader.title") + override val versionInfoFetchTitle get() = ZLSBundle.message("settings.downloader.progress.fetch") + override fun downloadProgressTitle(version: ZLSVersionInfo) = ZLSBundle.message("settings.downloader.progress.install", version.version.rawVersion) override fun localSelector() = ZLSLocalSelector(component) override suspend fun downloadVersionList(): List { val toolchain = data?.getUserData(ZigToolchainConfigurable.TOOLCHAIN_KEY)?.get() diff --git a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSLocalSelector.kt b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSLocalSelector.kt index 1ef58bad..a3126e21 100644 --- a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSLocalSelector.kt +++ b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSLocalSelector.kt @@ -22,6 +22,7 @@ package com.falsepattern.zigbrains.lsp.zls.downloader +import com.falsepattern.zigbrains.lsp.ZLSBundle import com.falsepattern.zigbrains.lsp.zls.ZLSVersion import com.falsepattern.zigbrains.lsp.zls.zlsInstallations import com.falsepattern.zigbrains.shared.downloader.LocalSelector @@ -36,9 +37,9 @@ import kotlin.io.path.isDirectory class ZLSLocalSelector(component: Component) : LocalSelector(component) { override val windowTitle: String - get() = "Select ZLS from disk" + get() = ZLSBundle.message("settings.local-selector.title") override val descriptor: FileChooserDescriptor - get() = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withTitle("ZLS binary") + get() = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withTitle(ZLSBundle.message("settings.local-selector.chooser.title")) override suspend fun browse(preSelected: Path?): ZLSVersion? { if (preSelected?.isDirectory() == true) { @@ -54,12 +55,12 @@ class ZLSLocalSelector(component: Component) : LocalSelector(compone null, false, AllIcons.General.Error, - "Invalid ZLS path", + ZLSBundle.message("settings.local-selector.state.invalid"), ) else VerifyResult( null, true, AllIcons.General.Information, - "ZLS path OK" + ZLSBundle.message("settings.local-selector.state.ok") ) if (zls != null) { zls = zlsInstallations.withUniqueName(zls) diff --git a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSVersionInfo.kt b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSVersionInfo.kt index 40b942e0..08a2652c 100644 --- a/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSVersionInfo.kt +++ b/lsp/src/main/kotlin/com/falsepattern/zigbrains/lsp/zls/downloader/ZLSVersionInfo.kt @@ -22,6 +22,7 @@ package com.falsepattern.zigbrains.lsp.zls.downloader +import com.falsepattern.zigbrains.lsp.ZLSBundle import com.falsepattern.zigbrains.project.toolchain.base.ZigToolchain import com.falsepattern.zigbrains.project.toolchain.downloader.ZigVersionInfo import com.falsepattern.zigbrains.shared.downloader.VersionInfo @@ -64,7 +65,7 @@ data class ZLSVersionInfo( val service = DownloadableFileService.getInstance() val tempFile = FileUtil.createTempFile(tempPluginDir, "zls_version_info", ".json", false, false) val desc = service.createFileDescription(url, tempFile.name) - val downloader = service.createDownloader(listOf(desc), "ZLS version information") + val downloader = service.createDownloader(listOf(desc), ZLSBundle.message("settings.downloader.service.index")) val downloadResults = coroutineToIndicator { downloader.download(tempPluginDir) } diff --git a/lsp/src/main/resources/zigbrains/lsp/Bundle.properties b/lsp/src/main/resources/zigbrains/lsp/Bundle.properties index 2ab4818a..8a680305 100644 --- a/lsp/src/main/resources/zigbrains/lsp/Bundle.properties +++ b/lsp/src/main/resources/zigbrains/lsp/Bundle.properties @@ -1,8 +1,3 @@ -settings.group.title=ZLS Settings -settings.zls-path.label=Executable path -settings.zls-path.tooltip=Path to the ZLS Binary -settings.zls-path.browse.title=Path to the ZLS Binary -settings.zls-version.label=Detected ZLS version settings.zls-config-path.label=Config path settings.zls-config-path.tooltip=Leave empty to use built-in config generated from the settings below settings.zls-config-path.browse.title=Path to the Custom ZLS Config File (Optional) @@ -50,8 +45,6 @@ settings.build_runner_path.tooltip=Specify a custom build runner to resolve buil settings.global_cache_path.label=Global cache path settings.global_cache_path.tooltip=Path to a directory that will be used as zig's cache. Will default to `${KnownFolders.Cache}/zls`. notification.group.zigbrains-lsp=ZigBrains LSP Integration -notification.message.could-not-detect.content=Could not detect ZLS binary, please configure it -notification.message.zls-exe-path-invalid.content=ZLS executable path could not be parsed: {0} notification.message.zls-exe-not-exists.content=ZLS executable does not exist: {0} notification.message.zls-exe-not-executable.content=ZLS executable is not an executable file: {0} notification.message.zls-config-not-exists.content=ZLS config file does not exist: {0} @@ -61,7 +54,6 @@ notification.message.zls-config-autogen-failed.content=Failed to autogenerate ZL notification.banner.zls-not-running=Zig Language Server is not running. Check the [Language Servers] tool menu! notification.banner.zls-bad-config=Zig Language Server is misconfigured. Check [Settings | Languages \\& Frameworks | Zig]! progress.title.create-connection-provider=Creating ZLS connection provider -progress.title.validate=Validating ZLS # suppress inspection "UnusedProperty" lsp.zls.name=Zig Language Server # suppress inspection "UnusedProperty" @@ -72,4 +64,16 @@ settings.model.detected.separator=Detected ZLS versions settings.model.none.text= settings.model.loading.text=Loading\u2026 settings.model.from-disk.text=Add ZLS from disk\u2026 -settings.model.download.text=Download ZLS\u2026 \ No newline at end of file +settings.model.download.text=Download ZLS\u2026 +settings.downloader.title=Install ZLS +settings.downloader.progress.fetch=Fetching ZLS version information +settings.downloader.progress.install=Installing ZLS {} +settings.downloader.service.index=ZLS version information +settings.local-selector.title=Select ZLS from disk +settings.local-selector.chooser.title=ZLS Binary +settings.local-selector.state.invalid=Invalid ZLS path +settings.local-selector.state.ok=ZLS path OK +dialog.title.zls=Path to the ZLS Executable +settings.panel.path.label=Path: +settings.panel.version.label=Version: +settings.panel.settings.group.label=Settings: \ No newline at end of file