Skip to content

Commit

Permalink
nls: add more localizations
Browse files Browse the repository at this point in the history
Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Jun 29, 2022
1 parent 35c3dbe commit c2b9613
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 24 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/browser/connection-status-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Event, Emitter } from '../common/event';
import { DefaultFrontendApplicationContribution } from './frontend-application';
import { StatusBar, StatusBarAlignment } from './status-bar/status-bar';
import { WebSocketConnectionProvider } from './messaging/ws-connection-provider';
import { Disposable, DisposableCollection } from '../common';
import { Disposable, DisposableCollection, nls } from '../common';

/**
* Service for listening on backend connection changes.
Expand Down Expand Up @@ -205,8 +205,8 @@ export class ApplicationConnectionStatusContribution extends DefaultFrontendAppl
protected handleOffline(): void {
this.statusBar.setElement(this.statusbarId, {
alignment: StatusBarAlignment.LEFT,
text: 'Offline',
tooltip: 'Cannot connect to backend.',
text: nls.localize('theia/core/offline', 'Offline'),
tooltip: nls.localize('theia/localize/offlineTooltip', 'Cannot connect to backend.'),
priority: 5000
});
this.toDisposeOnOnline.push(Disposable.create(() => this.statusBar.removeElement(this.statusbarId)));
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/browser/keybinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { StatusBarAlignment, StatusBar } from './status-bar/status-bar';
import { ContextKeyService } from './context-key-service';
import { CorePreferences } from './core-preferences';
import * as common from '../common/keybinding';
import { nls } from '../common/nls';

export enum KeybindingScope {
DEFAULT,
Expand Down Expand Up @@ -559,7 +560,7 @@ export class KeybindingRegistry {
event.stopPropagation();

this.statusBar.setElement('keybinding-status', {
text: `(${this.acceleratorForSequence(this.keySequence, '+')}) was pressed, waiting for more keys`,
text: nls.localize('theia/core/keybindingStatus', '{0} was pressed, waiting for more keys', `(${this.acceleratorForSequence(this.keySequence, '+')})`),
alignment: StatusBarAlignment.LEFT,
priority: 2
});
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/browser/shell/application-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { CorePreferences } from '../core-preferences';
import { BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer';
import { Deferred } from '../../common/promise-util';
import { SaveResourceService } from '../save-resource-service';
import { nls } from '../../common/nls';

/** The class name added to ApplicationShell instances. */
const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell';
Expand Down Expand Up @@ -1428,14 +1429,15 @@ export class ApplicationShell extends Widget {
if (this.bottomPanel.isEmpty) {
this.statusBar.removeElement(BOTTOM_PANEL_TOGGLE_ID);
} else {
const label = nls.localize('theia/core/common/collapseBottomPanel', 'Toggle Bottom Panel');
const element: StatusBarEntry = {
name: 'Toggle Bottom Panel',
name: label,
text: '$(codicon-window)',
alignment: StatusBarAlignment.RIGHT,
tooltip: 'Toggle Bottom Panel',
tooltip: label,
command: 'core.toggle.bottom.panel',
accessibilityInformation: {
label: 'Toggle Bottom Panel',
label: label,
role: 'button'
},
priority: -1000
Expand Down
9 changes: 5 additions & 4 deletions packages/core/src/browser/tree/search-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { SearchBoxDebounce, SearchBoxDebounceOptions } from '../tree/search-box-
import { BaseWidget, Message } from '../widgets/widget';
import { Emitter, Event } from '../../common/event';
import { KeyCode, Key } from '../keyboard/keys';
import { nls } from '../../common/nls';

/**
* Initializer properties for the search box widget.
Expand Down Expand Up @@ -253,7 +254,7 @@ export class SearchBox extends BaseWidget {
SearchBox.Styles.BUTTON,
...SearchBox.Styles.FILTER,
);
filter.title = 'Enable Filter on Type';
filter.title = nls.localizeByDefault('Enable Filter on Type');
buttons.appendChild(filter);
filter.onclick = this.fireFilterToggle.bind(this);
}
Expand All @@ -268,7 +269,7 @@ export class SearchBox extends BaseWidget {
SearchBox.Styles.BUTTON,
SearchBox.Styles.BUTTON_PREVIOUS
);
previous.title = 'Previous (Up)';
previous.title = nls.localize('theia/core/searchbox/previous', 'Previous (Up)');
buttons.appendChild(previous);
previous.onclick = () => this.firePrevious.bind(this)();

Expand All @@ -277,7 +278,7 @@ export class SearchBox extends BaseWidget {
SearchBox.Styles.BUTTON,
SearchBox.Styles.BUTTON_NEXT
);
next.title = 'Next (Down)';
next.title = nls.localize('theia/core/searchbox/next', 'Next (Down)');
buttons.appendChild(next);
next.onclick = () => this.fireNext.bind(this)();
}
Expand All @@ -288,7 +289,7 @@ export class SearchBox extends BaseWidget {
SearchBox.Styles.BUTTON,
SearchBox.Styles.BUTTON_CLOSE
);
close.title = 'Close (Escape)';
close.title = nls.localize('theia/core/searchbox/close', 'Close (Escape)');
buttons.appendChild(close);
close.onclick = () => this.hide.bind(this)();
}
Expand Down
3 changes: 2 additions & 1 deletion packages/git/src/browser/diff/git-diff-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import { ScmService } from '@theia/scm/lib/browser/scm-service';
import { GitRepositoryProvider } from '../git-repository-provider';
import { ScmTreeWidget } from '@theia/scm/lib/browser/scm-tree-widget';
import { ScmPreferences } from '@theia/scm/lib/browser/scm-preferences';
import { nls } from '@theia/core';

/* eslint-disable @typescript-eslint/no-explicit-any */

export const GIT_DIFF = 'git-diff';
@injectable()
export class GitDiffWidget extends BaseWidget implements StatefulWidget {

protected readonly GIT_DIFF_TITLE = 'Diff';
protected readonly GIT_DIFF_TITLE = nls.localize('theia/git/diff', 'Diff');

@inject(GitRepositoryProvider) protected readonly repositoryProvider: GitRepositoryProvider;
@inject(DiffNavigatorProvider) protected readonly diffNavigatorProvider: DiffNavigatorProvider;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-dev/src/browser/hosted-plugin-informer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { nls } from '@theia/core/lib/common/nls';
@injectable()
export class HostedPluginInformer implements FrontendApplicationContribution {

public static readonly DEVELOPMENT_HOST_TITLE = 'Development Host';
public static readonly DEVELOPMENT_HOST_TITLE = nls.localize('theia/plugin-dev/devHost', 'Development Host');

public static readonly DEVELOPMENT_HOST = 'development-host';

Expand Down
3 changes: 2 additions & 1 deletion packages/timeline/src/browser/timeline-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { TimelineEmptyWidget } from './timeline-empty-widget';
import { toArray } from '@theia/core/shared/@phosphor/algorithm';
import URI from '@theia/core/lib/common/uri';
import { URI as CodeURI } from '@theia/core/shared/vscode-uri';
import { nls } from '@theia/core/lib/common/nls';

@injectable()
export class TimelineWidget extends BaseWidget {
Expand All @@ -50,7 +51,7 @@ export class TimelineWidget extends BaseWidget {
constructor() {
super();
this.id = TimelineWidget.ID;
this.title.label = 'Timeline';
this.title.label = nls.localizeByDefault('Timeline');
this.title.caption = this.title.label;
this.addClass('theia-timeline');
}
Expand Down
3 changes: 2 additions & 1 deletion packages/vsx-registry/src/browser/vsx-extension-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ReactWidget, Message, Widget, codicon } from '@theia/core/lib/browser';
import { VSXExtension, VSXExtensionEditorComponent } from './vsx-extension';
import { VSXExtensionsModel } from './vsx-extensions-model';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { nls } from '@theia/core/lib/common/nls';

@injectable()
export class VSXExtensionEditor extends ReactWidget {
Expand Down Expand Up @@ -66,7 +67,7 @@ export class VSXExtensionEditor extends ReactWidget {
}

protected updateTitle(): void {
const label = 'Extension: ' + (this.extension.displayName || this.extension.name);
const label = nls.localizeByDefault('Extension: {0}', (this.extension.displayName || this.extension.name));
this.title.label = label;
this.title.caption = label;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as React from '@theia/core/shared/react';
import { injectable, postConstruct, inject } from '@theia/core/shared/inversify';
import { ReactWidget, Message } from '@theia/core/lib/browser/widgets';
import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
import { nls } from '@theia/core/lib/common/nls';

@injectable()
export class VSXExtensionsSearchBar extends ReactWidget {
Expand All @@ -40,7 +41,7 @@ export class VSXExtensionsSearchBar extends ReactWidget {
defaultValue={this.model.query}
spellCheck={false}
className='theia-input'
placeholder='Search Extensions in Open VSX Registry'
placeholder={nls.localize('theia/vsx-registry/searchPlaceholder', 'Search Extensions in {0}', 'Open VSX Registry')}
onChange={this.updateQuery}>
</input>;
}
Expand Down
16 changes: 8 additions & 8 deletions packages/workspace/src/browser/workspace-delete-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ export class WorkspaceDeleteHandler implements UriCommandHandler<URI[]> {
* @param uris URIs of selected resources.
*/
protected confirm(uris: URI[], options: FileDeleteOptions): Promise<boolean | undefined> {
let title = `File${uris.length === 1 ? '' : 's'}`;
let title = uris.length === 1 ? nls.localizeByDefault('File') : nls.localizeByDefault('Files');
if (options.useTrash) {
title = 'Move ' + title + ' to Trash';
title = nls.localize('theia/workspace/trashTitle', 'Move {0} to Trash', title);
} else {
title = 'Delete ' + title;
title = nls.localizeByDefault('Delete {0}', title);
}
return new ConfirmDialog({
title,
Expand All @@ -106,18 +106,18 @@ export class WorkspaceDeleteHandler implements UriCommandHandler<URI[]> {
const dirty = this.getDirty(uris);
if (dirty.length) {
if (dirty.length === 1) {
return `Do you really want to delete ${dirty[0].path.base} with unsaved changes?`;
return nls.localize('theia/workspace/confirmMessage.dirtySingle', 'Do you really want to delete {0} with unsaved changes?', dirty[0].path.base);
}
return `Do you really want to delete ${dirty.length} files with unsaved changes?`;
return nls.localize('theia/workspace/confirmMessage.dirtyMultiple', 'Do you really want to delete {0} files with unsaved changes?', dirty.length);
}
if (uris.length === 1) {
return `Do you really want to delete ${uris[0].path.base}?`;
return nls.localize('theia/workspace/confirmMessage.uriSingle', 'Do you really want to delete {0}?', uris[0].path.base);
}
if (uris.length > 10) {
return `Do you really want to delete all the ${uris.length} selected files?`;
return nls.localize('theia/workspace/confirmMessage.uriMultiple', 'Do you really want to delete all the {0} selected files?', uris.length);
}
const messageContainer = document.createElement('div');
messageContainer.textContent = 'Do you really want to delete the following files?';
messageContainer.textContent = nls.localize('theia/workspace/confirmMessage.delete', 'Do you really want to delete the following files?');
const list = document.createElement('ul');
list.style.listStyleType = 'none';
for (const uri of uris) {
Expand Down

0 comments on commit c2b9613

Please sign in to comment.