Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt l10n for simple-browser #165529

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions extensions/simple-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"vscode-nls": "^5.2.0"
"@vscode/extension-telemetry": "0.6.2"
},
"devDependencies": {
"@types/vscode-webview": "^1.57.0",
Expand Down
9 changes: 3 additions & 6 deletions extensions/simple-browser/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { SimpleBrowserManager } from './simpleBrowserManager';
import { SimpleBrowserView } from './simpleBrowserView';

Expand All @@ -13,8 +12,6 @@ declare class URL {
hostname: string;
}

const localize = nls.loadMessageBundle();

const openApiCommand = 'simpleBrowser.api.open';
const showCommand = 'simpleBrowser.show';

Expand Down Expand Up @@ -48,8 +45,8 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand(showCommand, async (url?: string) => {
if (!url) {
url = await vscode.window.showInputBox({
placeHolder: localize('simpleBrowser.show.placeholder', "https://example.com"),
prompt: localize('simpleBrowser.show.prompt', "Enter url to visit")
placeHolder: vscode.l10n.t("https://example.com"),
prompt: vscode.l10n.t("Enter url to visit")
});
}

Expand Down Expand Up @@ -84,7 +81,7 @@ export function activate(context: vscode.ExtensionContext) {
}
}, {
schemes: ['http', 'https'],
label: localize('openTitle', "Open in simple browser"),
label: vscode.l10n.t("Open in simple browser"),
}));
}

Expand Down
14 changes: 6 additions & 8 deletions extensions/simple-browser/src/simpleBrowserView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Disposable } from './dispose';

const localize = nls.loadMessageBundle();

export interface ShowOptions {
readonly preserveFocus?: boolean;
Expand All @@ -17,7 +15,7 @@ export interface ShowOptions {
export class SimpleBrowserView extends Disposable {

public static readonly viewType = 'simpleBrowser.view';
private static readonly title = localize('view.title', "Simple Browser");
private static readonly title = vscode.l10n.t("Simple Browser");

private readonly _webviewPanel: vscode.WebviewPanel;

Expand Down Expand Up @@ -134,28 +132,28 @@ export class SimpleBrowserView extends Disposable {
<header class="header">
<nav class="controls">
<button
title="${localize('control.back.title', "Back")}"
title="${vscode.l10n.t("Back")}"
class="back-button icon"><i class="codicon codicon-arrow-left"></i></button>

<button
title="${localize('control.forward.title', "Forward")}"
title="${vscode.l10n.t("Forward")}"
class="forward-button icon"><i class="codicon codicon-arrow-right"></i></button>

<button
title="${localize('control.reload.title', "Reload")}"
title="${vscode.l10n.t("Reload")}"
class="reload-button icon"><i class="codicon codicon-refresh"></i></button>
</nav>

<input class="url-input" type="text">

<nav class="controls">
<button
title="${localize('control.openExternal.title', "Open in browser")}"
title="${vscode.l10n.t("Open in browser")}"
class="open-external-button icon"><i class="codicon codicon-link-external"></i></button>
</nav>
</header>
<div class="content">
<div class="iframe-focused-alert">${localize('view.iframe-focused', "Focus Lock")}</div>
<div class="iframe-focused-alert">${vscode.l10n.t("Focus Lock")}</div>
<iframe sandbox="allow-scripts allow-forms allow-same-origin"></iframe>
</div>

Expand Down
5 changes: 0 additions & 5 deletions extensions/simple-browser/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,3 @@ vscode-codicons@^0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/vscode-codicons/-/vscode-codicons-0.0.14.tgz#e0d05418e2e195564ff6f6a2199d70415911c18f"
integrity sha512-6CEH5KT9ct5WMw7n5dlX7rB8ya4CUI2FSq1Wk36XaW+c5RglFtAanUV0T+gvZVVFhl/WxfjTvFHq06Hz9c1SLA==

vscode-nls@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f"
integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==