Skip to content

Commit

Permalink
fix localizations in misc dialogs (#12062)
Browse files Browse the repository at this point in the history
The commit updates dialogs across the framework to include proper localizations for their titles, and content.

Signed-off-by: FernandoAscencio <fernando.ascencio.cama@ericsson.com>
  • Loading branch information
FernandoAscencio authored Jan 16, 2023
1 parent aca9a26 commit c6cb7be
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/debug/src/browser/console/debug-console-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ConsoleItem, CompositeConsoleItem } from '@theia/console/lib/browser/co
import { DebugSession } from '../debug-session';
import { Severity } from '@theia/core/lib/common/severity';
import * as monaco from '@theia/monaco-editor-core';
import { nls } from '@theia/core';

export type DebugSessionProvider = () => DebugSession | undefined;

Expand Down Expand Up @@ -237,7 +238,7 @@ export class DebugVariable extends ExpressionContainer {
return;
}
const input = new SingleTextInputDialog({
title: `Set ${this.name} Value`,
title: nls.localize('theia/debug/debugVariableInput', 'Set {0} Value', this.name),
initialValue: this.value
});
const newValue = await input.open();
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/view/debug-watch-expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class DebugWatchExpression extends ExpressionItem {

async open(): Promise<void> {
const input = new SingleTextInputDialog({
title: 'Edit Watch Expression',
title: nls.localizeByDefault('Edit Expression'),
initialValue: this.expression
});
const newValue = await input.open();
Expand Down
11 changes: 6 additions & 5 deletions packages/filesystem/src/browser/file-tree/file-tree-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { CompositeTreeNode, TreeNode, ConfirmDialog, CompressedTreeModel } from '@theia/core/lib/browser';
import { CompositeTreeNode, TreeNode, ConfirmDialog, CompressedTreeModel, Dialog } from '@theia/core/lib/browser';
import { FileStatNode, DirNode, FileNode } from './file-tree';
import { LocationService } from '../location';
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
Expand All @@ -25,6 +25,7 @@ import { FileOperationError, FileOperationResult, FileChangesEvent, FileChangeTy
import { MessageService } from '@theia/core/lib/common/message-service';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { FileSystemUtils } from '../../common';
import { nls } from '@theia/core';

@injectable()
export class FileTreeModel extends CompressedTreeModel implements LocationService {
Expand Down Expand Up @@ -200,10 +201,10 @@ export class FileTreeModel extends CompressedTreeModel implements LocationServic

protected async shouldReplace(fileName: string): Promise<boolean> {
const dialog = new ConfirmDialog({
title: 'Replace file',
msg: `File '${fileName}' already exists in the destination folder. Do you want to replace it?`,
ok: 'Yes',
cancel: 'No'
title: nls.localize('theia/filesystem/replaceTitle', 'Replace File'),
msg: nls.localizeByDefault('{0} already exists. Are you sure you want to overwrite it?', fileName),
ok: Dialog.YES,
cancel: Dialog.NO
});
return !!await dialog.open();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/git/src/browser/git-scm-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,14 @@ export class GitScmProvider implements ScmProvider {
fileText = `${paths.length} files`;
}
return new ConfirmDialog({
title: 'Discard changes',
title: nls.localize('vscode.git/package/command.clean', 'Discard Changes'),
msg: nls.localize('vscode.git/commands/confirm discard', 'Do you really want to discard changes in {0}?', fileText)
}).open();
}

protected confirmAll(): Promise<boolean | undefined> {
return new ConfirmDialog({
title: 'Discard All Changes',
title: nls.localize('vscode.git/package/command.cleanAll', 'Discard All Changes'),
msg: nls.localize('vscode.git/commands/confirm discard all', 'Do you really want to discard all changes?')
}).open();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/main/browser/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class OpenNewTabDialog extends AbstractDialog<string> {

constructor(windowService: WindowService) {
super({
title: 'Your browser prevented opening of a new tab'
title: nls.localize('theia/plugin/blockNewTab', 'Your browser prevented opening of a new tab')
});
this.windowService = windowService;

Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-ext/src/main/browser/dialogs-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { FileUploadService } from '@theia/filesystem/lib/browser/file-upload-ser
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { FileStat } from '@theia/filesystem/lib/common/files';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { nls } from '@theia/core';

export class DialogsMainImpl implements DialogsMain {

Expand Down Expand Up @@ -146,7 +147,7 @@ export class DialogsMainImpl implements DialogsMain {
try {
// Create save file dialog props
const dialogProps = {
title: options.title ?? 'Save',
title: options.title ?? nls.localizeByDefault('Save'),
saveLabel: options.saveLabel,
filters: options.filters,
inputValue: fileNameValue
Expand Down

0 comments on commit c6cb7be

Please sign in to comment.