diff --git a/packages/ai-core/src/browser/file-variable-contribution.ts b/packages/ai-core/src/browser/file-variable-contribution.ts index 4595e80d37543..7bb77f5fbeb72 100644 --- a/packages/ai-core/src/browser/file-variable-contribution.ts +++ b/packages/ai-core/src/browser/file-variable-contribution.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Path, URI } from '@theia/core'; +import { nls, Path, URI } from '@theia/core'; import { OpenerService, codiconArray, open } from '@theia/core/lib/browser'; import { inject, injectable } from '@theia/core/shared/inversify'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; @@ -36,12 +36,12 @@ export namespace FileVariableArgs { export const FILE_VARIABLE: AIVariable = { id: 'file-provider', - description: 'Resolves the contents of a file', + description: nls.localize('theia/ai/core/fileVariable/description', 'Resolves the contents of a file'), name: 'file', - label: 'File', + label: nls.localizeByDefault('File'), iconClasses: codiconArray('file'), isContextVariable: true, - args: [{ name: FileVariableArgs.uri, description: 'The URI of the requested file.' }] + args: [{ name: FileVariableArgs.uri, description: nls.localize('theia/ai/core/fileVariable/uri/description', 'The URI of the requested file.') }] }; @injectable() diff --git a/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts b/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts index 3bae6490aab14..afab58884180a 100644 --- a/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts +++ b/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; -import { Emitter, Event } from '@theia/core'; +import { Emitter, Event, nls } from '@theia/core'; import { LanguageModelAlias, LanguageModelAliasRegistry } from '../common/language-model-alias'; import { PreferenceScope, PreferenceService } from '@theia/core/lib/common'; import { LANGUAGE_MODEL_ALIASES_PREFERENCE } from '../common/ai-core-preferences'; @@ -32,7 +32,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi 'openai/gpt-4.1', 'google/gemini-2.5-pro-exp-03-25' ], - description: 'Optimized for code understanding and generation tasks.' + description: nls.localize('theia/ai/core/defaultModelAliases/code/description', 'Optimized for code understanding and generation tasks.') }, { id: 'default/universal', @@ -41,7 +41,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi 'anthropic/claude-3-7-sonnet-latest', 'google/gemini-2.5-pro-exp-03-25' ], - description: 'Well-balanced for both code and general language use.' + description: nls.localize('theia/ai/core/defaultModelAliases/universal/description', 'Well-balanced for both code and general language use.') }, { id: 'default/code-completion', @@ -50,7 +50,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi 'anthropic/claude-3-7-sonnet-latest', 'google/gemini-2.5-pro-exp-03-25' ], - description: 'Best suited for code autocompletion scenarios.' + description: nls.localize('theia/ai/core/defaultModelAliases/code-completion/description', 'Best suited for code autocompletion scenarios.') }, { id: 'default/summarize', @@ -59,7 +59,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi 'anthropic/claude-3-7-sonnet-latest', 'google/gemini-2.5-pro-exp-03-25' ], - description: 'Models prioritized for summarization and condensation of content.' + description: nls.localize('theia/ai/core/defaultModelAliases/summarize/description', 'Models prioritized for summarization and condensation of content.') } ]; protected readonly onDidChangeEmitter = new Emitter(); @@ -163,4 +163,3 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi this.preferenceService.set(LANGUAGE_MODEL_ALIASES_PREFERENCE, map, PreferenceScope.User); } } - diff --git a/packages/ai-core/src/browser/frontend-prompt-customization-service.ts b/packages/ai-core/src/browser/frontend-prompt-customization-service.ts index b1a544810b9ff..f201ade93779a 100644 --- a/packages/ai-core/src/browser/frontend-prompt-customization-service.ts +++ b/packages/ai-core/src/browser/frontend-prompt-customization-service.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { DisposableCollection, URI, Event, Emitter } from '@theia/core'; +import { DisposableCollection, URI, Event, Emitter, nls } from '@theia/core'; import { OpenerService } from '@theia/core/lib/browser'; import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; import { PromptFragmentCustomizationService, CustomAgentDescription, CustomizedPromptFragment } from '../common'; @@ -32,7 +32,7 @@ import { PROMPT_TEMPLATE_EXTENSION } from './prompttemplate-contribution'; const newCustomAgentEntry = { id: 'my_agent', name: 'My Agent', - description: 'This is an example agent. Please adapt the properties to fit your needs.', + description: nls.localize('theia/ai/core/customAgentTemplate/description', 'This is an example agent. Please adapt the properties to fit your needs.'), prompt: `{{!-- Note: The context section below will resolve all context elements (e.g. files) to their full content in the system prompt. Context elements can be added by the user in the default chat view (e.g. via DnD or the "+" button). If you want a more fine-grained, on demand resolvement of context elements, you can also resolve files to their paths only diff --git a/packages/ai-core/src/browser/frontend-variable-service.ts b/packages/ai-core/src/browser/frontend-variable-service.ts index 66449578ddfde..120d4ad67b60d 100644 --- a/packages/ai-core/src/browser/frontend-variable-service.ts +++ b/packages/ai-core/src/browser/frontend-variable-service.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Disposable, MessageService, Prioritizeable } from '@theia/core'; +import { Disposable, MessageService, nls, Prioritizeable } from '@theia/core'; import { FrontendApplicationContribution, OpenerService, open } from '@theia/core/lib/browser'; import { inject, injectable } from '@theia/core/shared/inversify'; import { @@ -192,7 +192,7 @@ export class DefaultFrontendVariableService extends DefaultAIVariableService imp const { variableName, arg } = this.parseRequest(request); const variable = this.getVariable(variableName); if (!variable) { - this.messageService.warn('No variable found for open request.'); + this.messageService.warn(nls.localize('theia/ai/core/noVariableFoundForOpenRequest', 'No variable found for open request.')); return; } const opener = await this.getOpener(variableName, arg, context); @@ -200,14 +200,14 @@ export class DefaultFrontendVariableService extends DefaultAIVariableService imp return opener ? opener.open({ variable, arg }, context ?? {}) : this.openReadonly({ variable, arg }, context); } catch (err) { console.error('Unable to open variable:', err); - this.messageService.error('Unable to display variable value.'); + this.messageService.error(nls.localize('theia/ai/core/unableToDisplayVariableValue', 'Unable to display variable value.')); } } protected async openReadonly(request: AIVariableResolutionRequest, context: AIVariableContext = {}): Promise { const resolved = await this.resolveVariable(request, context); if (resolved === undefined) { - this.messageService.warn('Unable to resolve variable.'); + this.messageService.warn(nls.localize('theia/ai/core/unableToResolveVariable', 'Unable to resolve variable.')); return; } const resource = this.aiResourceResolver.getOrCreate(request, context, resolved.value); diff --git a/packages/ai-core/src/browser/window-blink-service.ts b/packages/ai-core/src/browser/window-blink-service.ts index c2ae593d3e213..dff92303a9c1b 100644 --- a/packages/ai-core/src/browser/window-blink-service.ts +++ b/packages/ai-core/src/browser/window-blink-service.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable } from '@theia/core/shared/inversify'; -import { environment } from '@theia/core'; +import { environment, nls } from '@theia/core'; /** * Result of a window blink attempt @@ -96,9 +96,9 @@ export class WindowBlinkService { private async blinkDocumentTitle(agentName?: string): Promise { const originalTitle = document.title; - const alertTitle = agentName - ? `🔔 Theia - Agent "${agentName}" Completed` - : '🔔 Theia - Agent Completed'; + const alertTitle = '🔔 ' + (agentName + ? nls.localize('theia/ai/core/blinkTitle/namedAgentCompleted', 'Theia - Agent "{0}" Completed', agentName) + : nls.localize('theia/ai/core/blinkTitle/agentCompleted', 'Theia - Agent Completed')); let blinkCount = 0; const maxBlinks = 6; diff --git a/packages/ai-core/src/common/ai-core-preferences.ts b/packages/ai-core/src/common/ai-core-preferences.ts index ab04f08abebca..f00376eb1f48f 100644 --- a/packages/ai-core/src/common/ai-core-preferences.ts +++ b/packages/ai-core/src/common/ai-core-preferences.ts @@ -24,7 +24,7 @@ import { } from './notification-types'; import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema'; -export const AI_CORE_PREFERENCES_TITLE = nls.localize('theia/ai/core/prefs/title', '✨ AI Features [Beta]'); +export const AI_CORE_PREFERENCES_TITLE = '✨ ' + nls.localize('theia/ai/core/prefs/title', 'AI Features [Beta]'); export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder'; export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings'; export const PREFERENCE_NAME_MAX_RETRIES = 'ai-features.modelSettings.maxRetries'; @@ -44,7 +44,7 @@ export const aiCorePreferenceSchema: PreferenceSchema = { typeDetails: { isFilepath: true, selectionProps: { - openLabel: 'Select Folder', + openLabel: nls.localize('theia/ai/core/promptTemplates/openLabel', 'Select Folder'), canSelectFiles: false, canSelectFolders: true, canSelectMany: false @@ -74,37 +74,41 @@ export const aiCorePreferenceSchema: PreferenceSchema = { properties: { modelId: { type: 'string', - description: 'The (optional) model id' + description: nls.localize('theia/ai/core/requestSettings/scope/modelId/description', 'The (optional) model id') }, providerId: { type: 'string', - description: 'The (optional) provider id to apply the settings to.', - }, agentId: { + description: nls.localize('theia/ai/core/requestSettings/scope/providerId/description', 'The (optional) provider id to apply the settings to.'), + }, + agentId: { type: 'string', - description: 'The (optional) agent id to apply the settings to.', + description: nls.localize('theia/ai/core/requestSettings/scope/agentId/description', 'The (optional) agent id to apply the settings to.'), }, } }, requestSettings: { type: 'object', additionalProperties: true, - description: 'Settings for the specific model ID.', + description: nls.localize('theia/ai/core/requestSettings/modelSpecificSettings/description', 'Settings for the specific model ID.'), }, clientSettings: { type: 'object', additionalProperties: false, - description: 'Client settings for how to handle messages that are send back to the llm.', + description: nls.localize('theia/ai/core/requestSettings/clientSettings/description', + 'Client settings for how to handle messages that are send back to the llm.'), properties: { keepToolCalls: { type: 'boolean', default: true, - description: 'If set to false, all tool request and tool responses will be filtered \ - before sending the next user request in a multi-turn conversation.' + description: nls.localize('theia/ai/core/requestSettings/clientSettings/keepToolCalls/description', + 'If set to false, all tool request and tool responses will be filtered \ + before sending the next user request in a multi-turn conversation.') }, keepThinking: { type: 'boolean', default: true, - description: 'If set to false, all thinking output will be filtered before sending the next user request in a multi-turn conversation.' + description: nls.localize('theia/ai/core/requestSettings/clientSettings/keepThinking/description', + 'If set to false, all thinking output will be filtered before sending the next user request in a multi-turn conversation.') } } },