opencode-i18n 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-i18n",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "OpenCode TUI i18n plugin — localize the interface into 简体中文 / 繁體中文 and more, with one-command install.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -241,8 +241,8 @@ function registerI18nCommand(api: TuiPluginApi) {
241
241
  commands: [
242
242
  {
243
243
  name: "i18n.open",
244
- title: "Open i18n language picker",
245
- desc: "Choose the OpenCode interface language",
244
+ title: "界面语言",
245
+ desc: "切换 OpenCode 界面语言",
246
246
  category: "System",
247
247
  namespace: "palette",
248
248
  slashName: "i18n",
@@ -257,37 +257,23 @@ function openLanguagePicker(api: TuiPluginApi) {
257
257
  const state = readStateSync()
258
258
  const info = localeInfo(config, state)
259
259
  const active = info.activeLocale
260
- const enabled = state.enabled
261
-
262
- const toggleLabel = enabled ? "Disable localization" : "Enable localization"
263
- const options = [
264
- {
265
- title: `${toggleLabel} ${enabled ? "ON" : "OFF"}`,
266
- value: "__toggle__",
267
- description: enabled ? "Turn off localized titles" : "Turn on localized titles",
268
- },
269
- ...info.available.map((locale) => ({
270
- title: `${info.labels.get(locale) ?? locale}${locale === active ? " ✓" : ""}`,
271
- value: locale,
272
- description: `Switch to ${info.labels.get(locale) ?? locale}`,
273
- })),
274
- ]
260
+
261
+ const options = info.available.map((locale) => ({
262
+ title: `${info.labels.get(locale) ?? locale}${locale === active ? "" : ""}`,
263
+ value: locale,
264
+ description: `切换到 ${info.labels.get(locale) ?? locale}`,
265
+ }))
275
266
 
276
267
  api.ui.dialog.setSize("medium")
277
268
  api.ui.dialog.replace(() =>
278
269
  api.ui.DialogSelect({
279
- title: "OpenCode i18n",
280
- placeholder: "Search languages...",
270
+ title: "OpenCode 界面语言",
271
+ placeholder: "搜索语言...",
281
272
  options,
282
273
  onSelect(opt: { value: string }) {
283
274
  api.ui.dialog.clear()
284
- if (opt.value === "__toggle__") {
285
- void writeState({ enabled: !enabled })
286
- api.ui.toast({ message: enabled ? "Localization disabled" : "Localization enabled" })
287
- return
288
- }
289
275
  void writeState({ locale: opt.value, enabled: opt.value !== "en" })
290
- api.ui.toast({ message: `Switched to ${info.labels.get(opt.value) ?? opt.value}` })
276
+ api.ui.toast({ message: `已切换到 ${info.labels.get(opt.value) ?? opt.value}` })
291
277
  },
292
278
  }),
293
279
  )