[Feature] 插件翻译文件支持构建系统的显示文字(运行项名称、构建选项和任务标题)

Open
#2,139 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
json, typescript

Research direction

Start by reading the plugin contract README’s Translations section and the localization schema and fixtures; the issue says all need updates. Trace how Core loads translations and how the host displays build system names, run names, option titles, and task titles. Done means those fields can be translated by ID, invalid files are rejected as specified, and the protocol update is recorded.

Written by the indexing model from the issue text.

Description

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

插件的翻译文件(契约 README.md 的 Translations 一节,l10n/<locale>.json)目前只能翻译 settings、sections 和 settingActions。构建系统里同样会显示给用户的文字没有翻译入口,中文界面下只能显示 plugin.json 里的英文:

  • buildSystems[].displayName(构建窗口里的构建系统名)
  • buildSystems[].run[].name(运行配置与构建窗口里的运行项名称,例如 Tomcat 插件的 “Run on Tomcat”)
  • buildSystems[].options[].displayName(构建选项标题,例如 Maven 插件的 “Offline”、“Skip Tests”)
  • buildSystems[].tasks[].displayName(任务名)

create-lithe-plugin Skill 要求插件的用户可见文字至少有中英文,契约不能翻译的文字不得绕过,只能提契约变更。这些字段目前没有办法满足这条要求。在 Core main 8b91b32 上已确认。

Proposed solution / 建议方案

在插件翻译文件中增加一个 buildSystems 成员,按 ID 翻译上面这些显示文字,规则与 settings 一致:每个成员都可选;缺少的文字保持 plugin.json 的写法;ID、顺序和取值在各语言中不变;格式错误时 Core 整份拒绝该文件,使用 plugin.settings.invalidLocalization 或新的同类错误码。示例:

{
  "buildSystems": {
    "tomcat": {
      "displayName": "Tomcat",
      "run": { "tomcat": { "name": "在 Tomcat 上运行" } },
      "options": { "offline": { "displayName": "离线" } },
      "tasks": { "build": { "displayName": "构建" } }
    }
  }
}

同一个 Core PR 需要更新契约 README、翻译文件的 schema 和 fixture,并在协议更新记录中登记。宿主侧显示这些文字时,改为读取 Core 按界面语言给出的结果。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Extensions / 扩展

Priority / 优先级

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

Alternatives considered / 已考虑的替代方案
  • 在 plugin.json 中直接写中文,或写中英混排:英文界面下会显示中文,不可取。
  • 插件后端按界面语言返回名称:运行项和构建选项的名称来自清单,不经过后端,做不到;即使能做到,也是绕过契约,Skill 不允许。
  • 宿主为插件补词条:违反“插件内容不进宿主”的规则。
Additional context / 补充信息

在 Lithe-IDEA/lithe-plugin-tomcat 新的构建提供者实现中发现:设置项都已翻译,只有运行项名称 “Run on Tomcat” 无法翻译。Maven 插件的构建选项标题也有同样的问题。

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.