opencode-i18n 0.1.6 → 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 +1 -1
- package/plugins/i18n/index.ts +9 -23
package/package.json
CHANGED
package/plugins/i18n/index.ts
CHANGED
|
@@ -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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
{
|
|
265
|
-
|
|
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
|
|
280
|
-
placeholder: "
|
|
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:
|
|
276
|
+
api.ui.toast({ message: `已切换到 ${info.labels.get(opt.value) ?? opt.value}` })
|
|
291
277
|
},
|
|
292
278
|
}),
|
|
293
279
|
)
|