opencode-translate 2.0.2 → 2.0.3
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/README.md +6 -0
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ $en 프로젝트 루트의 package.json을 읽고 요약해줘
|
|
|
64
64
|
All subsequent messages in the same session are translated automatically — no need to repeat `$en`.
|
|
65
65
|
|
|
66
66
|
- Your original message and its English translation remain visible in the transcript.
|
|
67
|
+
- Web composer presentation metadata is synchronized with the translated prompt, including failure notices; review-comment cards are preserved.
|
|
67
68
|
- The first successful `$en` prompt includes a `Translation enabled:` confirmation with the language and translator model.
|
|
68
69
|
- English assistant text streams normally; a translated Markdown section is appended when the text segment completes.
|
|
69
70
|
- Both the **terminal and web UI** display the same persisted bilingual assistant text. No UI-specific plugin is needed.
|
|
@@ -87,6 +88,11 @@ package, not an old pinned `opencode-translate@1.x`. Also check the configured *
|
|
|
87
88
|
the main-chat model does not change the translator. An API-key login or OAuth connection must exist on that server.
|
|
88
89
|
The server log message `[opencode-translate] inbound translation failed` contains the underlying generation error.
|
|
89
90
|
|
|
91
|
+
If replies translate but your own prompt still looks untranslated in the **Web UI**, inspect the stored user message's
|
|
92
|
+
`text` and `metadata.displayText`. The Web UI prefers `displayText`, which versions up to 2.0.2 left at the original
|
|
93
|
+
composer input even when `text` contained the English translation. The prompt hook now synchronizes that presentation
|
|
94
|
+
field. This applies to newly admitted prompts; it does not rewrite presentation metadata on older messages.
|
|
95
|
+
|
|
90
96
|
OpenCode 2.0.3 also normalizes the legacy `"plugin": [["package", { ...options }]]` tuple syntax; that syntax alone
|
|
91
97
|
does not prevent this plugin from loading. The `plugins` object form shown above is the recommended v2 format.
|
|
92
98
|
Make sure the configuration is a complete JSON/JSONC object, including its opening `{`.
|
package/dist/index.js
CHANGED
|
@@ -837,7 +837,8 @@ async function setup(ctx) {
|
|
|
837
837
|
if (source === undefined)
|
|
838
838
|
return;
|
|
839
839
|
const userLanguage = lang ?? options.lang;
|
|
840
|
-
|
|
840
|
+
const apply = (display, english, enabled) => {
|
|
841
|
+
const presentation = event.metadata?.displayText;
|
|
841
842
|
event.prompt.text = display;
|
|
842
843
|
for (const attachment of [
|
|
843
844
|
...event.prompt.files ?? [],
|
|
@@ -847,7 +848,11 @@ async function setup(ctx) {
|
|
|
847
848
|
delete attachment.mention;
|
|
848
849
|
}
|
|
849
850
|
event.metadata = { ...event.metadata, [METADATA_KEY]: { lang: userLanguage, english, display, enabled } };
|
|
850
|
-
|
|
851
|
+
if (typeof presentation === "string") {
|
|
852
|
+
const visible = lang ? presentation : stripTrigger(presentation, options.trigger) ?? presentation;
|
|
853
|
+
event.metadata.displayText = `${visible}${display.slice(source.length)}`;
|
|
854
|
+
}
|
|
855
|
+
};
|
|
851
856
|
try {
|
|
852
857
|
const english = await translator.text(source, userLanguage, LLM_LANGUAGE);
|
|
853
858
|
const content = source === english ? source : `${source}
|
package/package.json
CHANGED