Skip to content

Commit

Permalink
Merge branch 'features/support-localization' (Closes #151)
Browse files Browse the repository at this point in the history
  • Loading branch information
alefragnani committed Feb 7, 2023
2 parents 79dc7b6 + 99401c5 commit 488a030
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 25 deletions.
7 changes: 7 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"No Bookmarks found": "No Bookmarks found",
"Type a line number or a piece of code to navigate to": "Type a line number or a piece of code to navigate to",
"The Bookmark {0} is not defined": "The Bookmark {0} is not defined",
"Select a workspace": "Select a workspace",
"Error loading Numbered Bookmarks: {0}": "Error loading Numbered Bookmarks: {0}"
}
7 changes: 7 additions & 0 deletions l10n/bundle.l10n.pt-br.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"No Bookmarks found": "Nenhum Bookmark encontrado",
"Type a line number or a piece of code to navigate to": "Digite um número de linha ou pedaço de código para navegar",
"The Bookmark {0} is not defined": "O Bookmark {0} não está definido",
"Select a workspace": "Selecione um workspace",
"Error loading Numbered Bookmarks: {0}": "Erro lendo Numbered Bookmarks: {0}"
}
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "8.3.1",
"publisher": "alefragnani",
"engines": {
"vscode": "^1.61.0"
"vscode": "^1.73.0"
},
"extensionKind": [
"ui",
Expand Down Expand Up @@ -46,6 +46,7 @@
"onStartupFinished"
],
"main": "./dist/extension-node.js",
"l10n": "./l10n",
"contributes": {
"commands": [
{
Expand Down Expand Up @@ -511,7 +512,7 @@
"@types/glob": "^7.1.4",
"@types/mocha": "^9.0.0",
"@types/node": "^14.17.27",
"@types/vscode": "^1.61.0",
"@types/vscode": "^1.73.0",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"@vscode/test-electron": "^1.6.2",
Expand Down
16 changes: 8 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from "vscode";
import { Position, TextDocument, Uri } from "vscode";
import { l10n, Position, TextDocument, Uri } from "vscode";

import { Bookmark, BookmarkQuickPickItem } from "../vscode-numbered-bookmarks-core/src/bookmark";
import { NO_BOOKMARK_DEFINED } from "../vscode-numbered-bookmarks-core/src/constants";
Expand Down Expand Up @@ -196,7 +196,7 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand("numberedBookmarks.list", () => {
// no bookmark
if (!hasBookmarks(activeFile)) {
vscode.window.showInformationMessage("No Bookmarks found");
vscode.window.showInformationMessage(l10n.t("No Bookmarks found"));
return;
}

Expand All @@ -218,7 +218,7 @@ export async function activate(context: vscode.ExtensionContext) {
// pick one
const currentPosition: Position = vscode.window.activeTextEditor.selection.active;
const options = <vscode.QuickPickOptions> {
placeHolder: "Type a line number or a piece of code to navigate to",
placeHolder: l10n.t("Type a line number or a piece of code to navigate to"),
matchOnDescription: true,
matchOnDetail: true,
onDidSelectItem: item => {
Expand Down Expand Up @@ -257,7 +257,7 @@ export async function activate(context: vscode.ExtensionContext) {
if (someFileHasBookmark) break;
}
if (!someFileHasBookmark) {
vscode.window.showInformationMessage("No Bookmarks found");
vscode.window.showInformationMessage(l10n.t("No Bookmarks found"));
return;
}

Expand Down Expand Up @@ -351,7 +351,7 @@ export async function activate(context: vscode.ExtensionContext) {
});

const options = <vscode.QuickPickOptions> {
placeHolder: "Type a line number or a piece of code to navigate to",
placeHolder: l10n.t("Type a line number or a piece of code to navigate to"),
matchOnDescription: true,
onDidSelectItem: item => {

Expand Down Expand Up @@ -572,7 +572,7 @@ export async function activate(context: vscode.ExtensionContext) {

if (!found) {
if (vscode.workspace.getConfiguration("numberedBookmarks").get<boolean>("showBookmarkNotDefinedWarning", false)) {
vscode.window.showWarningMessage("The Bookmark " + n + " is not defined");
vscode.window.showWarningMessage(l10n.t("The Bookmark {0} is not defined", n));
}
return;
}
Expand All @@ -584,13 +584,13 @@ export async function activate(context: vscode.ExtensionContext) {
default: // "false"
// is it already set?
if (activeFile.bookmarks.length === 0) {
vscode.window.showInformationMessage("No Bookmark found");
vscode.window.showInformationMessage(l10n.t("No Bookmarks found"));
return;
}

if (activeFile.bookmarks[ n ].line < 0) {
if (vscode.workspace.getConfiguration("numberedBookmarks").get<boolean>("showBookmarkNotDefinedWarning", false)) {
vscode.window.showWarningMessage("The Bookmark " + n + " is not defined");
vscode.window.showWarningMessage(l10n.t("The Bookmark {0} is not defined", n));
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion vscode-numbered-bookmarks-core

0 comments on commit 488a030

Please sign in to comment.