Skip to content

Commit 6b9429b

Browse files
authored
Enhance localization of the ai-core package (#16350)
* Enhance localization of the ai-core package
1 parent 1cb47c6 commit 6b9429b

File tree

6 files changed

+34
-31
lines changed

6 files changed

+34
-31
lines changed

packages/ai-core/src/browser/file-variable-contribution.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
1515
// *****************************************************************************
1616

17-
import { Path, URI } from '@theia/core';
17+
import { nls, Path, URI } from '@theia/core';
1818
import { OpenerService, codiconArray, open } from '@theia/core/lib/browser';
1919
import { inject, injectable } from '@theia/core/shared/inversify';
2020
import { FileService } from '@theia/filesystem/lib/browser/file-service';
@@ -36,12 +36,12 @@ export namespace FileVariableArgs {
3636

3737
export const FILE_VARIABLE: AIVariable = {
3838
id: 'file-provider',
39-
description: 'Resolves the contents of a file',
39+
description: nls.localize('theia/ai/core/fileVariable/description', 'Resolves the contents of a file'),
4040
name: 'file',
41-
label: 'File',
41+
label: nls.localizeByDefault('File'),
4242
iconClasses: codiconArray('file'),
4343
isContextVariable: true,
44-
args: [{ name: FileVariableArgs.uri, description: 'The URI of the requested file.' }]
44+
args: [{ name: FileVariableArgs.uri, description: nls.localize('theia/ai/core/fileVariable/uri/description', 'The URI of the requested file.') }]
4545
};
4646

4747
@injectable()

packages/ai-core/src/browser/frontend-language-model-alias-registry.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// *****************************************************************************
1616

1717
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18-
import { Emitter, Event } from '@theia/core';
18+
import { Emitter, Event, nls } from '@theia/core';
1919
import { LanguageModelAlias, LanguageModelAliasRegistry } from '../common/language-model-alias';
2020
import { PreferenceScope, PreferenceService } from '@theia/core/lib/common';
2121
import { LANGUAGE_MODEL_ALIASES_PREFERENCE } from '../common/ai-core-preferences';
@@ -32,7 +32,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi
3232
'openai/gpt-4.1',
3333
'google/gemini-2.5-pro-exp-03-25'
3434
],
35-
description: 'Optimized for code understanding and generation tasks.'
35+
description: nls.localize('theia/ai/core/defaultModelAliases/code/description', 'Optimized for code understanding and generation tasks.')
3636
},
3737
{
3838
id: 'default/universal',
@@ -41,7 +41,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi
4141
'anthropic/claude-3-7-sonnet-latest',
4242
'google/gemini-2.5-pro-exp-03-25'
4343
],
44-
description: 'Well-balanced for both code and general language use.'
44+
description: nls.localize('theia/ai/core/defaultModelAliases/universal/description', 'Well-balanced for both code and general language use.')
4545
},
4646
{
4747
id: 'default/code-completion',
@@ -50,7 +50,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi
5050
'anthropic/claude-3-7-sonnet-latest',
5151
'google/gemini-2.5-pro-exp-03-25'
5252
],
53-
description: 'Best suited for code autocompletion scenarios.'
53+
description: nls.localize('theia/ai/core/defaultModelAliases/code-completion/description', 'Best suited for code autocompletion scenarios.')
5454
},
5555
{
5656
id: 'default/summarize',
@@ -59,7 +59,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi
5959
'anthropic/claude-3-7-sonnet-latest',
6060
'google/gemini-2.5-pro-exp-03-25'
6161
],
62-
description: 'Models prioritized for summarization and condensation of content.'
62+
description: nls.localize('theia/ai/core/defaultModelAliases/summarize/description', 'Models prioritized for summarization and condensation of content.')
6363
}
6464
];
6565
protected readonly onDidChangeEmitter = new Emitter<void>();
@@ -163,4 +163,3 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi
163163
this.preferenceService.set(LANGUAGE_MODEL_ALIASES_PREFERENCE, map, PreferenceScope.User);
164164
}
165165
}
166-

packages/ai-core/src/browser/frontend-prompt-customization-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
1515
// *****************************************************************************
1616

17-
import { DisposableCollection, URI, Event, Emitter } from '@theia/core';
17+
import { DisposableCollection, URI, Event, Emitter, nls } from '@theia/core';
1818
import { OpenerService } from '@theia/core/lib/browser';
1919
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
2020
import { PromptFragmentCustomizationService, CustomAgentDescription, CustomizedPromptFragment } from '../common';
@@ -32,7 +32,7 @@ import { PROMPT_TEMPLATE_EXTENSION } from './prompttemplate-contribution';
3232
const newCustomAgentEntry = {
3333
id: 'my_agent',
3434
name: 'My Agent',
35-
description: 'This is an example agent. Please adapt the properties to fit your needs.',
35+
description: nls.localize('theia/ai/core/customAgentTemplate/description', 'This is an example agent. Please adapt the properties to fit your needs.'),
3636
prompt: `{{!-- Note: The context section below will resolve all context elements (e.g. files) to their full content
3737
in the system prompt. Context elements can be added by the user in the default chat view (e.g. via DnD or the "+" button).
3838
If you want a more fine-grained, on demand resolvement of context elements, you can also resolve files to their paths only

packages/ai-core/src/browser/frontend-variable-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
1515
// *****************************************************************************
1616

17-
import { Disposable, MessageService, Prioritizeable } from '@theia/core';
17+
import { Disposable, MessageService, nls, Prioritizeable } from '@theia/core';
1818
import { FrontendApplicationContribution, OpenerService, open } from '@theia/core/lib/browser';
1919
import { inject, injectable } from '@theia/core/shared/inversify';
2020
import {
@@ -192,22 +192,22 @@ export class DefaultFrontendVariableService extends DefaultAIVariableService imp
192192
const { variableName, arg } = this.parseRequest(request);
193193
const variable = this.getVariable(variableName);
194194
if (!variable) {
195-
this.messageService.warn('No variable found for open request.');
195+
this.messageService.warn(nls.localize('theia/ai/core/noVariableFoundForOpenRequest', 'No variable found for open request.'));
196196
return;
197197
}
198198
const opener = await this.getOpener(variableName, arg, context);
199199
try {
200200
return opener ? opener.open({ variable, arg }, context ?? {}) : this.openReadonly({ variable, arg }, context);
201201
} catch (err) {
202202
console.error('Unable to open variable:', err);
203-
this.messageService.error('Unable to display variable value.');
203+
this.messageService.error(nls.localize('theia/ai/core/unableToDisplayVariableValue', 'Unable to display variable value.'));
204204
}
205205
}
206206

207207
protected async openReadonly(request: AIVariableResolutionRequest, context: AIVariableContext = {}): Promise<void> {
208208
const resolved = await this.resolveVariable(request, context);
209209
if (resolved === undefined) {
210-
this.messageService.warn('Unable to resolve variable.');
210+
this.messageService.warn(nls.localize('theia/ai/core/unableToResolveVariable', 'Unable to resolve variable.'));
211211
return;
212212
}
213213
const resource = this.aiResourceResolver.getOrCreate(request, context, resolved.value);

packages/ai-core/src/browser/window-blink-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// *****************************************************************************
1616

1717
import { injectable } from '@theia/core/shared/inversify';
18-
import { environment } from '@theia/core';
18+
import { environment, nls } from '@theia/core';
1919

2020
/**
2121
* Result of a window blink attempt
@@ -96,9 +96,9 @@ export class WindowBlinkService {
9696

9797
private async blinkDocumentTitle(agentName?: string): Promise<void> {
9898
const originalTitle = document.title;
99-
const alertTitle = agentName
100-
? `🔔 Theia - Agent "${agentName}" Completed`
101-
: '🔔 Theia - Agent Completed';
99+
const alertTitle = '🔔 ' + (agentName
100+
? nls.localize('theia/ai/core/blinkTitle/namedAgentCompleted', 'Theia - Agent "{0}" Completed', agentName)
101+
: nls.localize('theia/ai/core/blinkTitle/agentCompleted', 'Theia - Agent Completed'));
102102

103103
let blinkCount = 0;
104104
const maxBlinks = 6;

packages/ai-core/src/common/ai-core-preferences.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
} from './notification-types';
2525
import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema';
2626

27-
export const AI_CORE_PREFERENCES_TITLE = nls.localize('theia/ai/core/prefs/title', 'AI Features [Beta]');
27+
export const AI_CORE_PREFERENCES_TITLE = '✨ ' + nls.localize('theia/ai/core/prefs/title', 'AI Features [Beta]');
2828
export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder';
2929
export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings';
3030
export const PREFERENCE_NAME_MAX_RETRIES = 'ai-features.modelSettings.maxRetries';
@@ -44,7 +44,7 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
4444
typeDetails: {
4545
isFilepath: true,
4646
selectionProps: {
47-
openLabel: 'Select Folder',
47+
openLabel: nls.localize('theia/ai/core/promptTemplates/openLabel', 'Select Folder'),
4848
canSelectFiles: false,
4949
canSelectFolders: true,
5050
canSelectMany: false
@@ -74,37 +74,41 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
7474
properties: {
7575
modelId: {
7676
type: 'string',
77-
description: 'The (optional) model id'
77+
description: nls.localize('theia/ai/core/requestSettings/scope/modelId/description', 'The (optional) model id')
7878
},
7979
providerId: {
8080
type: 'string',
81-
description: 'The (optional) provider id to apply the settings to.',
82-
}, agentId: {
81+
description: nls.localize('theia/ai/core/requestSettings/scope/providerId/description', 'The (optional) provider id to apply the settings to.'),
82+
},
83+
agentId: {
8384
type: 'string',
84-
description: 'The (optional) agent id to apply the settings to.',
85+
description: nls.localize('theia/ai/core/requestSettings/scope/agentId/description', 'The (optional) agent id to apply the settings to.'),
8586
},
8687
}
8788
},
8889
requestSettings: {
8990
type: 'object',
9091
additionalProperties: true,
91-
description: 'Settings for the specific model ID.',
92+
description: nls.localize('theia/ai/core/requestSettings/modelSpecificSettings/description', 'Settings for the specific model ID.'),
9293
},
9394
clientSettings: {
9495
type: 'object',
9596
additionalProperties: false,
96-
description: 'Client settings for how to handle messages that are send back to the llm.',
97+
description: nls.localize('theia/ai/core/requestSettings/clientSettings/description',
98+
'Client settings for how to handle messages that are send back to the llm.'),
9799
properties: {
98100
keepToolCalls: {
99101
type: 'boolean',
100102
default: true,
101-
description: 'If set to false, all tool request and tool responses will be filtered \
102-
before sending the next user request in a multi-turn conversation.'
103+
description: nls.localize('theia/ai/core/requestSettings/clientSettings/keepToolCalls/description',
104+
'If set to false, all tool request and tool responses will be filtered \
105+
before sending the next user request in a multi-turn conversation.')
103106
},
104107
keepThinking: {
105108
type: 'boolean',
106109
default: true,
107-
description: 'If set to false, all thinking output will be filtered before sending the next user request in a multi-turn conversation.'
110+
description: nls.localize('theia/ai/core/requestSettings/clientSettings/keepThinking/description',
111+
'If set to false, all thinking output will be filtered before sending the next user request in a multi-turn conversation.')
108112
}
109113
}
110114
},

0 commit comments

Comments
 (0)