feat: add LANGUAGE option for English bot replies - #12
Open
jonathanherr wants to merge 1 commit into
Open
jonathanherr wants to merge 1 commit into
jonathanherr wants to merge 1 commit into
Conversation
All user-facing Slack messages (commands, question prompts,
permission requests, bg-task updates) were hardcoded in Korean.
Adds a LANGUAGE plugin option ('ko' default, 'en' opt-in, also
readable from SLACK_LANGUAGE) backed by a ko/en string table,
so English-speaking workspaces get English replies without
changing default behavior.
There was a problem hiding this comment.
2 issues found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/plugin.ts">
<violation number="1" location="src/plugin.ts:109">
P2: When a substituted value contains `$&`, `t()` interprets it as a replacement token and corrupts the Slack reply. Use the replacer-function overload so variable values are inserted literally.</violation>
<violation number="2" location="src/plugin.ts:1091">
P3: When `LANGUAGE=ko` and no model override is set, `!model` still displays the English `(default)` label. Use the localized `defaultLabel` for the fallback value, as `!agent` already does.</violation>
</file>
Shadow auto-approve: would not auto-approve because issues were found.
Re-trigger cubic
| function t(key: keyof typeof STR, vars?: Record<string, string | number>): string { | ||
| let s = STR[key][language]; | ||
| if (vars) { | ||
| for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v)); |
There was a problem hiding this comment.
P2: When a substituted value contains $&, t() interprets it as a replacement token and corrupts the Slack reply. Use the replacer-function overload so variable values are inserted literally.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/plugin.ts, line 109:
<comment>When a substituted value contains `$&`, `t()` interprets it as a replacement token and corrupts the Slack reply. Use the replacer-function overload so variable values are inserted literally.</comment>
<file context>
@@ -29,6 +29,87 @@ let defaultDirectory: string = "";
+function t(key: keyof typeof STR, vars?: Record<string, string | number>): string {
+ let s = STR[key][language];
+ if (vars) {
+ for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v));
+ }
+ return s;
</file context>
Suggested change
| for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v)); | |
| for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, () => String(v)); |
| ? `${modelOverride.providerID}/${modelOverride.modelID}` | ||
| : "(default)"; | ||
| const lines = [`*현재 모델:* \`${current}\``, "", "*사용 가능:*"]; | ||
| const lines = [t("currentModel", { v: current }), "", t("available")]; |
There was a problem hiding this comment.
P3: When LANGUAGE=ko and no model override is set, !model still displays the English (default) label. Use the localized defaultLabel for the fallback value, as !agent already does.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/plugin.ts, line 1091:
<comment>When `LANGUAGE=ko` and no model override is set, `!model` still displays the English `(default)` label. Use the localized `defaultLabel` for the fallback value, as `!agent` already does.</comment>
<file context>
@@ -1007,7 +1088,7 @@ async function handleCommand(channel: string, text: string, ts: string): Promise
? `${modelOverride.providerID}/${modelOverride.modelID}`
: "(default)";
- const lines = [`*현재 모델:* \`${current}\``, "", "*사용 가능:*"];
+ const lines = [t("currentModel", { v: current }), "", t("available")];
try {
const { data: config } = await pluginClient.config.get();
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All user-facing Slack messages (commands, question prompts, permission requests, bg-task updates) are hardcoded in Korean, so English-speaking workspaces see mixed-language replies that no model instruction can fix (verified: strings live in
src/plugin.ts, not in any LLM prompt).This PR adds a
LANGUAGEplugin option ('ko'default,'en'opt-in; also readable fromSLACK_LANGUAGEenv) backed by a ko/en string table +t()helper, following the same option-resolution pattern asDEFAULT_AGENT/ATTACH_TIMEOUT_SEC. Default staysko, so existing behavior is unchanged unless opted in.Covers ~55 user-facing strings:
!model/!agent/!dir/!attach/!sync/!reset/!helpresponses, question forwarding, permission requests/replies, bg-task updates, timeout labels. Tool description made bilingual (evaluated at module load, before options resolve). README options table updated.Verification:
npm run buildsucceeds; built output contains both locales + resolver. Note:npx tsc --noEmitreports one error atsrc/plugin.ts:373(Property 'completed' does not exist...) which is pre-existing on the base commit, untouched by this change.Summary by cubic
Adds a
LANGUAGEplugin option so all user-facing Slack replies (commands, question prompts, permission requests, bg-task updates) can be English instead of hardcoded Korean. Default staysko, and the option is also readable fromSLACK_LANGUAGE.Bug Fixes
m.info?.idand resets when a thread switches sessions, so messages aren't skipped or replayed.Written for commit b17353c. Summary will update on new commits.