src / locales / i18n.ts
src / locales / i18n.ts
/**
* i18n module for Timbers Toolbox plugin.
* Provides config field translations and runtime message dictionaries.
*/
// Config field display names & subtitles (Layer 1)
const configDicts: Record<string, Record<string, { displayName: string; subtitle: string }>> = {
en: {
planMode: { displayName: "Plan Mode", subtitle: "Planning strategy for task execution" },
defaultWorkspacePath: { displayName: "Default Workspace Path", subtitle: "" },
enableDocumentParsing: { displayName: "Enable Document Parsing Tools", subtitle: "" },
maxFileSizeMB: { displayName: "Max File Size (MB)", subtitle: "" },
enableLongTermMemory: { displayName: "Enable Long-Term Memory", subtitle: "" },
hotThreshold: { displayName: "Hot Memory Threshold", subtitle: "" },
neo4jSyncEnabled: { displayName: "Enable Neo4j Memory Sync", subtitle: "" },
maxWorkflowSteps: { displayName: "Max Workflow Steps", subtitle: "" },
enableAgentEvaluation: { displayName: "Enable Agent Evaluation", subtitle: "" },
allowJavascriptExecution: { displayName: "Allow JavaScript Execution", subtitle: "Run JS via Deno sandbox" },
allowPythonExecution: { displayName: "Allow Python Execution", subtitle: "Run Python scripts" },
allowTerminalExecution: { displayName: "Allow Terminal Execution", subtitle: "Open interactive terminal windows" },
allowShellCommandExecution: { displayName: "Allow Shell Commands", subtitle: "Execute shell commands (cmd/powershell)" },
allowBrowserControl: { displayName: "Allow Browser Control", subtitle: "Puppeteer browser automation" },
allowAllCode: { displayName: "Allow All Code Execution (Master Switch)", subtitle: "Enable all execution permissions at once" },
unrestrictedMode: { displayName: "UNRESTRICTED MODE (Master Switch — All Tools, No Sandbox)", subtitle: "Enable every tool and disable workspace sandboxing" },
allowSystemNotifications: { displayName: "Allow System Notifications", subtitle: "Send desktop notifications via node-notifier" },
enableGitOperations: { displayName: "Enable Git Operations", subtitle: "git_status, git_diff, git_commit, etc." },
enableGitHubTools: { displayName: "Enable GitHub CLI Tools", subtitle: "gh_auth, gh_create_issue, gh_push, etc." },
allowDatabaseInspection: { displayName: "Enable Database Inspection", subtitle: "Allow read-only queries on SQLite databases" },
enableSecondaryAgent: { displayName: "Enable Secondary Agent", subtitle: "Delegate tasks to a second model/server" },
useMainModelForSubAgent: { displayName: "Use Main Model for Sub-Agent", subtitle: "Use the currently loaded LM Studio model" },
secondaryAgentEndpoint: { displayName: "Secondary Agent Endpoint", subtitle: "" },
subAgentModelId: { displayName: "Sub-Agent Model ID", subtitle: "" },
subAgentProfiles: { displayName: "Sub-Agent Profiles", subtitle: "" },
subAgentFrequency: { displayName: "Sub-Agent Frequency", subtitle: "" },
enableDebugMode: { displayName: "Enable Debug Mode", subtitle: "" },
enableSubAgentDebugLogging: { displayName: "Enable Sub-Agent Debug Logging", subtitle: "" },
subAgentAutoSave: { displayName: "Sub-Agent Auto-Save", subtitle: "" },
showFullCodeOutput: { displayName: "Show Full Code Output", subtitle: "" },
subAgentAllowFileSystem: { displayName: "Allow File System Access", subtitle: "" },
subAgentAllowWeb: { displayName: "Allow Web Access", subtitle: "" },
subAgentAllowCode: { displayName: "Allow Code Execution", subtitle: "" },
subAgentAllowBrowserControl: { displayName: "Allow Browser Control", subtitle: "" },
subAgentTimeLimit: { displayName: "Sub-Agent Time Limit (minutes)", subtitle: "" },
embeddingModel: { displayName: "Embedding Model", subtitle: "" },
retrievalLimit: { displayName: "Retrieval Limit", subtitle: "" },
threshold: { displayName: "Affinity Threshold", subtitle: "" },
enableWikipedia: { displayName: "Enable Wikipedia Search", subtitle: "" },
localRagEnabled: { displayName: "Enable Local RAG", subtitle: "" },
neo4jUri: { displayName: "Neo4j URI", subtitle: "" },
neo4jUsername: { displayName: "Neo4j Username", subtitle: "" },
neo4jPassword: { displayName: "Neo4j Password", subtitle: "" },
messageLanguage: { displayName: "Message Language", subtitle: "" },
uiLanguageOverride: { displayName: "UI Language Override", subtitle: "" },
},
};
const defaultDict = configDicts["en"];
export function getSystemDict(): { dict: { config: typeof defaultDict }; resolvedLocale: string } {
const detectedLocale = "en";
return {
dict: { config: configDicts[detectedLocale] || defaultDict },
resolvedLocale: detectedLocale,
};
}
// Runtime message dictionaries (Layer 2)
interface RuntimeDict {
statusLoadingEmbeddingModel: string;
statusRetrievingCitations: string;
statusRetrievedCitations: (count: number) => string;
statusNoRelevantCitations: string;
statusDecidingStrategy: string;
statusInjectFullContent: string;
statusUseRetrieval: string;
statusLoadingParser: (fileName: string) => string;
statusStrategyChosen: (strategy: string, reason?: string) => string;
planHintAlways: string;
planHintWhenUseful: string;
delegationHintAlways: string;
delegationHintWhenUseful: string;
delegationHintWhenUsefulDebug: string;
delegationHintHardTasks: string;
documentInjectionHeader: string;
documentInjectionFileBlock: (name: string, content: string) => string;
documentInjectionSuffix: (userPrompt: string) => string;
citationPrefix: string;
citationEntry: (num: number, text: string) => string;
citationSuffix: (originalQuery: string) => string;
noRelevantCitationsNote: string;
}
const runtimeDicts: Record<string, RuntimeDict> = {
en: {
statusLoadingEmbeddingModel: "Loading embedding model...",
statusRetrievingCitations: "Retrieving relevant citations...",
statusRetrievedCitations: (count) => "Retrieved " + count + " relevant citation(s).",
statusNoRelevantCitations: "No relevant citations found.",
statusDecidingStrategy: "Deciding context injection strategy...",
statusInjectFullContent: "Injecting full document content...",
statusUseRetrieval: "Using retrieval...",
statusLoadingParser: (fileName) => "Loading parser for " + fileName + "...",
statusStrategyChosen: (strategy, reason) => {
var msg = "Context injection strategy chosen: " + strategy;
if (reason) {
msg += " (" + reason + ")";
} else {
msg += ".";
}
return msg;
},
planHintAlways: "You are in 'always' planning mode. Always output your reasoning before taking action.",
planHintWhenUseful: "You are in 'when_useful' planning mode. Output reasoning when the task is complex or ambiguous.",
delegationHintAlways: "For complex tasks, consider delegating to a sub-agent for focused execution.",
delegationHintWhenUseful: "Consider delegating complex or multi-step tasks to a sub-agent.",
delegationHintWhenUsefulDebug: " (debug mode active)",
delegationHintHardTasks: "This task requires significant code changes. Delegate to a coding sub-agent for best results.",
documentInjectionHeader: "# Document Context\n",
documentInjectionFileBlock: (name, content) => "## File: " + name + "\n" + content + "\n",
documentInjectionSuffix: (userPrompt) => "\n---\n\nUser Query:\n\n" + userPrompt,
citationPrefix: "\n[CITATIONS]\n",
citationEntry: (num, text) => num + ". " + text + "\n",
citationSuffix: (originalQuery) => "[/CITATIONS]\n\nOriginal Query:\n" + originalQuery,
noRelevantCitationsNote: "No relevant content found in the workspace. Proceeding with available context.",
},
};
interface DictWrapper {
runtime: RuntimeDict;
}
export function getDict(language?: string): DictWrapper {
return { runtime: runtimeDicts[language || "en"] || runtimeDicts["en"] };
}
/**
* i18n module for Timbers Toolbox plugin.
* Provides config field translations and runtime message dictionaries.
*/
// Config field display names & subtitles (Layer 1)
const configDicts: Record<string, Record<string, { displayName: string; subtitle: string }>> = {
en: {
planMode: { displayName: "Plan Mode", subtitle: "Planning strategy for task execution" },
defaultWorkspacePath: { displayName: "Default Workspace Path", subtitle: "" },
enableDocumentParsing: { displayName: "Enable Document Parsing Tools", subtitle: "" },
maxFileSizeMB: { displayName: "Max File Size (MB)", subtitle: "" },
enableLongTermMemory: { displayName: "Enable Long-Term Memory", subtitle: "" },
hotThreshold: { displayName: "Hot Memory Threshold", subtitle: "" },
neo4jSyncEnabled: { displayName: "Enable Neo4j Memory Sync", subtitle: "" },
maxWorkflowSteps: { displayName: "Max Workflow Steps", subtitle: "" },
enableAgentEvaluation: { displayName: "Enable Agent Evaluation", subtitle: "" },
allowJavascriptExecution: { displayName: "Allow JavaScript Execution", subtitle: "Run JS via Deno sandbox" },
allowPythonExecution: { displayName: "Allow Python Execution", subtitle: "Run Python scripts" },
allowTerminalExecution: { displayName: "Allow Terminal Execution", subtitle: "Open interactive terminal windows" },
allowShellCommandExecution: { displayName: "Allow Shell Commands", subtitle: "Execute shell commands (cmd/powershell)" },
allowBrowserControl: { displayName: "Allow Browser Control", subtitle: "Puppeteer browser automation" },
allowAllCode: { displayName: "Allow All Code Execution (Master Switch)", subtitle: "Enable all execution permissions at once" },
unrestrictedMode: { displayName: "UNRESTRICTED MODE (Master Switch — All Tools, No Sandbox)", subtitle: "Enable every tool and disable workspace sandboxing" },
allowSystemNotifications: { displayName: "Allow System Notifications", subtitle: "Send desktop notifications via node-notifier" },
enableGitOperations: { displayName: "Enable Git Operations", subtitle: "git_status, git_diff, git_commit, etc." },
enableGitHubTools: { displayName: "Enable GitHub CLI Tools", subtitle: "gh_auth, gh_create_issue, gh_push, etc." },
allowDatabaseInspection: { displayName: "Enable Database Inspection", subtitle: "Allow read-only queries on SQLite databases" },
enableSecondaryAgent: { displayName: "Enable Secondary Agent", subtitle: "Delegate tasks to a second model/server" },
useMainModelForSubAgent: { displayName: "Use Main Model for Sub-Agent", subtitle: "Use the currently loaded LM Studio model" },
secondaryAgentEndpoint: { displayName: "Secondary Agent Endpoint", subtitle: "" },
subAgentModelId: { displayName: "Sub-Agent Model ID", subtitle: "" },
subAgentProfiles: { displayName: "Sub-Agent Profiles", subtitle: "" },
subAgentFrequency: { displayName: "Sub-Agent Frequency", subtitle: "" },
enableDebugMode: { displayName: "Enable Debug Mode", subtitle: "" },
enableSubAgentDebugLogging: { displayName: "Enable Sub-Agent Debug Logging", subtitle: "" },
subAgentAutoSave: { displayName: "Sub-Agent Auto-Save", subtitle: "" },
showFullCodeOutput: { displayName: "Show Full Code Output", subtitle: "" },
subAgentAllowFileSystem: { displayName: "Allow File System Access", subtitle: "" },
subAgentAllowWeb: { displayName: "Allow Web Access", subtitle: "" },
subAgentAllowCode: { displayName: "Allow Code Execution", subtitle: "" },
subAgentAllowBrowserControl: { displayName: "Allow Browser Control", subtitle: "" },
subAgentTimeLimit: { displayName: "Sub-Agent Time Limit (minutes)", subtitle: "" },
embeddingModel: { displayName: "Embedding Model", subtitle: "" },
retrievalLimit: { displayName: "Retrieval Limit", subtitle: "" },
threshold: { displayName: "Affinity Threshold", subtitle: "" },
enableWikipedia: { displayName: "Enable Wikipedia Search", subtitle: "" },
localRagEnabled: { displayName: "Enable Local RAG", subtitle: "" },
neo4jUri: { displayName: "Neo4j URI", subtitle: "" },
neo4jUsername: { displayName: "Neo4j Username", subtitle: "" },
neo4jPassword: { displayName: "Neo4j Password", subtitle: "" },
messageLanguage: { displayName: "Message Language", subtitle: "" },
uiLanguageOverride: { displayName: "UI Language Override", subtitle: "" },
},
};
const defaultDict = configDicts["en"];
export function getSystemDict(): { dict: { config: typeof defaultDict }; resolvedLocale: string } {
const detectedLocale = "en";
return {
dict: { config: configDicts[detectedLocale] || defaultDict },
resolvedLocale: detectedLocale,
};
}
// Runtime message dictionaries (Layer 2)
interface RuntimeDict {
statusLoadingEmbeddingModel: string;
statusRetrievingCitations: string;
statusRetrievedCitations: (count: number) => string;
statusNoRelevantCitations: string;
statusDecidingStrategy: string;
statusInjectFullContent: string;
statusUseRetrieval: string;
statusLoadingParser: (fileName: string) => string;
statusStrategyChosen: (strategy: string, reason?: string) => string;
planHintAlways: string;
planHintWhenUseful: string;
delegationHintAlways: string;
delegationHintWhenUseful: string;
delegationHintWhenUsefulDebug: string;
delegationHintHardTasks: string;
documentInjectionHeader: string;
documentInjectionFileBlock: (name: string, content: string) => string;
documentInjectionSuffix: (userPrompt: string) => string;
citationPrefix: string;
citationEntry: (num: number, text: string) => string;
citationSuffix: (originalQuery: string) => string;
noRelevantCitationsNote: string;
}
const runtimeDicts: Record<string, RuntimeDict> = {
en: {
statusLoadingEmbeddingModel: "Loading embedding model...",
statusRetrievingCitations: "Retrieving relevant citations...",
statusRetrievedCitations: (count) => "Retrieved " + count + " relevant citation(s).",
statusNoRelevantCitations: "No relevant citations found.",
statusDecidingStrategy: "Deciding context injection strategy...",
statusInjectFullContent: "Injecting full document content...",
statusUseRetrieval: "Using retrieval...",
statusLoadingParser: (fileName) => "Loading parser for " + fileName + "...",
statusStrategyChosen: (strategy, reason) => {
var msg = "Context injection strategy chosen: " + strategy;
if (reason) {
msg += " (" + reason + ")";
} else {
msg += ".";
}
return msg;
},
planHintAlways: "You are in 'always' planning mode. Always output your reasoning before taking action.",
planHintWhenUseful: "You are in 'when_useful' planning mode. Output reasoning when the task is complex or ambiguous.",
delegationHintAlways: "For complex tasks, consider delegating to a sub-agent for focused execution.",
delegationHintWhenUseful: "Consider delegating complex or multi-step tasks to a sub-agent.",
delegationHintWhenUsefulDebug: " (debug mode active)",
delegationHintHardTasks: "This task requires significant code changes. Delegate to a coding sub-agent for best results.",
documentInjectionHeader: "# Document Context\n",
documentInjectionFileBlock: (name, content) => "## File: " + name + "\n" + content + "\n",
documentInjectionSuffix: (userPrompt) => "\n---\n\nUser Query:\n\n" + userPrompt,
citationPrefix: "\n[CITATIONS]\n",
citationEntry: (num, text) => num + ". " + text + "\n",
citationSuffix: (originalQuery) => "[/CITATIONS]\n\nOriginal Query:\n" + originalQuery,
noRelevantCitationsNote: "No relevant content found in the workspace. Proceeding with available context.",
},
};
interface DictWrapper {
runtime: RuntimeDict;
}
export function getDict(language?: string): DictWrapper {
return { runtime: runtimeDicts[language || "en"] || runtimeDicts["en"] };
}