[Feature] 插件契约向后端、构建提供者和语言服务器传递界面语言(initialize.locale)

Open
#2,144 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Start by reading the plugin contract's initialize definitions for backends, build providers, and language servers, then check how the host passes the current locale to Core. Update the contract, all three official SDKs, and the protocol update record to expose the LSP locale value. Done when each component receives the current BCP 47 interface language at startup and the contract changes are recorded.

Written by the indexing model from the issue text.

Description

review: high
Problem to solve / 要解决的问题

插件契约 v0 没有任何途径把 Lithe 的界面语言告诉插件后端、构建提供者和语言服务器。插件的 l10n/*.json 只能翻译清单里的静态文字;提供者在运行时返回给用户的错误说明(例如 Tomcat 插件的“没有设置 Tomcat,请在设置中选择安装目录”、Maven 插件的构建失败说明)只能用一种语言写死。中文界面的用户会看到英文提示,插件作者即使写了中文文案也无法按用户的界面语言选择。

目前只有插件网页(lithe.context.locale)能拿到界面语言;后端和提供者的 initialize 没有 locale,环境变量和启动参数变量里也没有。

Proposed solution / 建议方案

在契约中规定,Core 在后端、构建提供者和语言服务器的 initialize 参数里带上 LSP 标准字段 locale(Lithe 当前的界面语言,BCP 47 标记,如 zh-Hans、en),界面语言切换后按现有设置生效规则在下一次启动时更新;三个官方 SDK 暴露这个值,并在协议更新记录登记。宿主把当前界面语言传给 Core。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Extensions / 扩展

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案
  • 插件读取操作系统语言(如 JVM 的 Locale.getDefault()):Lithe 的界面语言可以和系统语言不同,结果会和界面不一致,不采用。
  • 提供者只返回错误码,由宿主翻译:错误种类由各插件定义,宿主无法为第三方插件维护文案。
Additional context / 补充信息

由 Tomcat 社区插件(lithe-plugin-tomcat)的宿主端到端测试发现。该插件已经按 initialize.locale 选择中英文,契约补上后无需修改即可生效;在此之前一律显示英文。

Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Dominant language
TypeScript
Stars
1.8k
Forks
151
Avg merge
3h 48m
Merged PRs (30d)
571

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1lck/Lithe-IDEA

All issues in 1lck/Lithe-IDEA

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.