mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
@@ -4,13 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry';
|
||||
import { MediaPreview, reopenAsText } from './mediaPreview';
|
||||
import { escapeAttribute, getNonce } from './util/dom';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class AudioPreviewProvider implements vscode.CustomReadonlyEditorProvider {
|
||||
|
||||
public static readonly viewType = 'vscode.audioPreview';
|
||||
@@ -82,8 +79,8 @@ class AudioPreview extends MediaPreview {
|
||||
<body class="container loading">
|
||||
<div class="loading-indicator"></div>
|
||||
<div class="loading-error">
|
||||
<p>${localize('preview.audioLoadError', "An error occurred while loading the audio file.")}</p>
|
||||
<a href="#" class="open-file-link">${localize('preview.audioLoadErrorLink', "Open file using VS Code's standard text/binary editor?")}</a>
|
||||
<p>${vscode.l10n.t("An error occurred while loading the audio file.")}</p>
|
||||
<a href="#" class="open-file-link">${vscode.l10n.t("Open file using VS Code's standard text/binary editor?")}</a>
|
||||
</div>
|
||||
<script src="${escapeAttribute(this.extensionResource('media', 'audioPreview.js'))}" nonce="${nonce}"></script>
|
||||
</body>
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { PreviewStatusBarEntry } from './ownedStatusBarEntry';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class BinarySize {
|
||||
static readonly KB = 1024;
|
||||
@@ -17,29 +15,29 @@ class BinarySize {
|
||||
|
||||
static formatSize(size: number): string {
|
||||
if (size < BinarySize.KB) {
|
||||
return localize('sizeB', "{0}B", size);
|
||||
return vscode.l10n.t("{0}B", size);
|
||||
}
|
||||
|
||||
if (size < BinarySize.MB) {
|
||||
return localize('sizeKB', "{0}KB", (size / BinarySize.KB).toFixed(2));
|
||||
return vscode.l10n.t("{0}KB", (size / BinarySize.KB).toFixed(2));
|
||||
}
|
||||
|
||||
if (size < BinarySize.GB) {
|
||||
return localize('sizeMB', "{0}MB", (size / BinarySize.MB).toFixed(2));
|
||||
return vscode.l10n.t("{0}MB", (size / BinarySize.MB).toFixed(2));
|
||||
}
|
||||
|
||||
if (size < BinarySize.TB) {
|
||||
return localize('sizeGB', "{0}GB", (size / BinarySize.GB).toFixed(2));
|
||||
return vscode.l10n.t("{0}GB", (size / BinarySize.GB).toFixed(2));
|
||||
}
|
||||
|
||||
return localize('sizeTB', "{0}TB", (size / BinarySize.TB).toFixed(2));
|
||||
return vscode.l10n.t("{0}TB", (size / BinarySize.TB).toFixed(2));
|
||||
}
|
||||
}
|
||||
|
||||
export class BinarySizeStatusBarEntry extends PreviewStatusBarEntry {
|
||||
|
||||
constructor() {
|
||||
super('status.imagePreview.binarySize', localize('sizeStatusBar.name', "Image Binary Size"), vscode.StatusBarAlignment.Right, 100);
|
||||
super('status.imagePreview.binarySize', vscode.l10n.t("Image Binary Size"), vscode.StatusBarAlignment.Right, 100);
|
||||
}
|
||||
|
||||
public show(owner: unknown, size: number | undefined) {
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { BinarySizeStatusBarEntry } from '../binarySizeStatusBarEntry';
|
||||
import { MediaPreview, PreviewState, reopenAsText } from '../mediaPreview';
|
||||
import { escapeAttribute, getNonce } from '../util/dom';
|
||||
import { SizeStatusBarEntry } from './sizeStatusBarEntry';
|
||||
import { Scale, ZoomStatusBarEntry } from './zoomStatusBarEntry';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class PreviewManager implements vscode.CustomReadonlyEditorProvider {
|
||||
|
||||
@@ -181,8 +179,8 @@ class ImagePreview extends MediaPreview {
|
||||
<body class="container image scale-to-fit loading">
|
||||
<div class="loading-indicator"></div>
|
||||
<div class="image-load-error">
|
||||
<p>${localize('preview.imageLoadError', "An error occurred while loading the image.")}</p>
|
||||
<a href="#" class="open-file-link">${localize('preview.imageLoadErrorLink', "Open file using VS Code's standard text/binary editor?")}</a>
|
||||
<p>${vscode.l10n.t("An error occurred while loading the image.")}</p>
|
||||
<a href="#" class="open-file-link">${vscode.l10n.t("Open file using VS Code's standard text/binary editor?")}</a>
|
||||
</div>
|
||||
<script src="${escapeAttribute(this.extensionResource('media', 'imagePreview.js'))}" nonce="${nonce}"></script>
|
||||
</body>
|
||||
|
||||
@@ -4,15 +4,13 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { PreviewStatusBarEntry } from '../ownedStatusBarEntry';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class SizeStatusBarEntry extends PreviewStatusBarEntry {
|
||||
|
||||
constructor() {
|
||||
super('status.imagePreview.size', localize('sizeStatusBar.name', "Image Size"), vscode.StatusBarAlignment.Right, 101 /* to the left of editor status (100) */);
|
||||
super('status.imagePreview.size', vscode.l10n.t("Image Size"), vscode.StatusBarAlignment.Right, 101 /* to the left of editor status (100) */);
|
||||
}
|
||||
|
||||
public show(owner: unknown, text: string) {
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { PreviewStatusBarEntry as OwnedStatusBarEntry } from '../ownedStatusBarEntry';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const selectZoomLevelCommandId = '_imagePreview.selectZoomLevel';
|
||||
|
||||
@@ -19,7 +17,7 @@ export class ZoomStatusBarEntry extends OwnedStatusBarEntry {
|
||||
public readonly onDidChangeScale = this._onDidChangeScale.event;
|
||||
|
||||
constructor() {
|
||||
super('status.imagePreview.zoom', localize('zoomStatusBar.name', "Image Zoom"), vscode.StatusBarAlignment.Right, 102 /* to the left of editor size entry (101) */);
|
||||
super('status.imagePreview.zoom', vscode.l10n.t("Image Zoom"), vscode.StatusBarAlignment.Right, 102 /* to the left of editor size entry (101) */);
|
||||
|
||||
this._register(vscode.commands.registerCommand(selectZoomLevelCommandId, async () => {
|
||||
type MyPickItem = vscode.QuickPickItem & { scale: Scale };
|
||||
@@ -31,7 +29,7 @@ export class ZoomStatusBarEntry extends OwnedStatusBarEntry {
|
||||
}));
|
||||
|
||||
const pick = await vscode.window.showQuickPick(options, {
|
||||
placeHolder: localize('zoomStatusBar.placeholder', "Select zoom level")
|
||||
placeHolder: vscode.l10n.t("Select zoom level")
|
||||
});
|
||||
if (pick) {
|
||||
this._onDidChangeScale.fire({ scale: pick.scale });
|
||||
@@ -47,7 +45,7 @@ export class ZoomStatusBarEntry extends OwnedStatusBarEntry {
|
||||
|
||||
private zoomLabel(scale: Scale): string {
|
||||
return scale === 'fit'
|
||||
? localize('zoomStatusBar.wholeImageLabel', "Whole Image")
|
||||
? vscode.l10n.t("Whole Image")
|
||||
: `${Math.round(scale * 100)}%`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry';
|
||||
import { MediaPreview, reopenAsText } from './mediaPreview';
|
||||
import { escapeAttribute, getNonce } from './util/dom';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class VideoPreviewProvider implements vscode.CustomReadonlyEditorProvider {
|
||||
|
||||
@@ -82,8 +80,8 @@ class VideoPreview extends MediaPreview {
|
||||
<body class="loading">
|
||||
<div class="loading-indicator"></div>
|
||||
<div class="loading-error">
|
||||
<p>${localize('preview.videoLoadError', "An error occurred while loading the video file.")}</p>
|
||||
<a href="#" class="open-file-link">${localize('preview.videoLoadErrorLink', "Open file using VS Code's standard text/binary editor?")}</a>
|
||||
<p>${vscode.l10n.t("An error occurred while loading the video file.")}</p>
|
||||
<a href="#" class="open-file-link">${vscode.l10n.t("Open file using VS Code's standard text/binary editor?")}</a>
|
||||
</div>
|
||||
<script src="${escapeAttribute(this.extensionResource('media', 'videoPreview.js'))}" nonce="${nonce}"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user