Skip to content

Commit

Permalink
Add localization to "preparing download" message (#12041)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonah-iden authored Jan 9, 2023
1 parent 83b726e commit 395ee0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/core/i18n/nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
},
"filesystem": {
"copyDownloadLink": "Download-Link kopieren",
"prepareDownloadLink": "Download-Link wird vorbereitet...",
"prepareDownload": "Download wird vorbereitet...",
"dialog": {
"initialLocation": "Zum Ausgangsort gehen",
"multipleItemMessage": "Sie können nur ein Element auswählen",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/common/message-service-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { injectable } from 'inversify';
import { CancellationToken } from './cancellation';
import { nls } from './nls';

export const messageServicePath = '/services/messageService';

Expand Down Expand Up @@ -52,7 +53,7 @@ export interface ProgressMessage extends Message {
readonly options?: ProgressMessageOptions;
}
export namespace ProgressMessage {
export const Cancel = 'Cancel';
export const Cancel = nls.localizeByDefault('Cancel');
export function isCancelable(message: ProgressMessage): boolean {
return !!message.options?.cancelable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Endpoint } from '@theia/core/lib/browser/endpoint';
import { FileDownloadData } from '../../common/download/file-download-data';
import { MessageService } from '@theia/core/lib/common/message-service';
import { addClipboardListener } from '@theia/core/lib/browser/widgets';
import { nls } from '@theia/core';

@injectable()
export class FileDownloadService {
Expand Down Expand Up @@ -53,9 +54,13 @@ export class FileDownloadService {
}
const copyLink = options && options.copyLink ? true : false;
try {
const text: string = copyLink ?
nls.localize('theia/filesystem/prepareDownloadLink', 'Preparing download link...') :
nls.localize('theia/filesystem/prepareDownload', 'Preparing download...');
const [progress, result] = await Promise.all([
this.messageService.showProgress({
text: `Preparing download${copyLink ? ' link' : ''}...`, options: { cancelable: true }
text: text,
options: { cancelable: true }
}, () => { cancel = true; }),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
new Promise<{ response: Response, jsonResponse: any }>(async resolve => {
Expand Down

0 comments on commit 395ee0a

Please sign in to comment.