mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Localization updates
This commit is contained in:
@@ -611,5 +611,62 @@
|
||||
"helpers.mediaHelper.saveFile.file.uploaded.failed": "Sorry, something went wrong uploading {0}",
|
||||
"helpers.mediaHelper.deleteFile.file.deletion.failed": "Sorry, something went wrong deleting {0}",
|
||||
|
||||
"helpers.mediaLibrary.remove.warning": "The name \"{0}\" already exists at the file location.",
|
||||
"helpers.mediaLibrary.remove.error": "Sorry, something went wrong updating \"{0}\" to \"{1}\".",
|
||||
|
||||
"helpers.openFileInEditor.error": "Couldn't open the file.",
|
||||
|
||||
"helpers.questions.contentTitle.aiInput.title": "Title or description",
|
||||
"helpers.questions.contentTitle.aiInput.prompt": "What would you like to write about?",
|
||||
"helpers.questions.contentTitle.aiInput.placeholder": "What would you like to write about?",
|
||||
"helpers.questions.contentTitle.aiInput.quickPick.title.separator": "your title/description",
|
||||
"helpers.questions.contentTitle.aiInput.quickPick.ai.separator": "AI generated title",
|
||||
"helpers.questions.contentTitle.aiInput.select.title": "Select a title",
|
||||
"helpers.questions.contentTitle.aiInput.select.placeholder": "Select a title for your content",
|
||||
"helpers.questions.contentTitle.aiInput.failed": "Failed fetching the AI title. Please try to use your own title or try again later.",
|
||||
"helpers.questions.contentTitle.aiInput.warning": "You did not specify a title for your content.",
|
||||
"helpers.questions.contentTitle.titleInput.title": "Content title",
|
||||
"helpers.questions.contentTitle.titleInput.prompt": "What would you like to use as a title for the content to create?",
|
||||
"helpers.questions.contentTitle.titleInput.placeholder": "Content title",
|
||||
"helpers.questions.contentTitle.titleInput.warning": "You did not specify a title for your content.",
|
||||
"helpers.questions.selectContentFolder.quickPick.title": "Select a folder",
|
||||
"helpers.questions.selectContentFolder.quickPick.placeholder": "Select where you want to create your content",
|
||||
"helpers.questions.selectContentFolder.quickPick.noFolders.warning": "No page folders were configured.",
|
||||
"helpers.questions.selectContentFolder.quickPick.noSelection.warning": "You didn't select a place where you wanted to create your content.",
|
||||
"helpers.questions.selectContentType.noContentType.warning": "No content types found. Please create a content type first.",
|
||||
"helpers.questions.selectContentType.quickPick.title": "Content type",
|
||||
"helpers.questions.selectContentType.quickPick.placeholder": "Select the content type to create your new content",
|
||||
"helpers.questions.selectContentType.noSelection.warning": "No content type was selected.",
|
||||
|
||||
"helpers.seoHelper.checkLength.diagnostic.message": "Article {0} is longer than {1} characters (current length: {2}). For SEO reasons, it would be better to make it less than {1} characters.",
|
||||
|
||||
"helpers.settingsHelper.checkToPromote.message": "You have local settings. Would you like to promote them to the global settings (\"frontmatter.json\")?",
|
||||
"helpers.settingsHelper.promote.success": "All settings promoted to team level.",
|
||||
"helpers.settingsHelper.readConfig.progress.title": "{0}: Reading dynamic config file...",
|
||||
"helpers.settingsHelper.readConfig.error": "Error reading your configuration.",
|
||||
"helpers.settingsHelper.refreshConfig.success": "Settings have been refreshed.",
|
||||
|
||||
"helpers.taxonomyHelper.rename.input.title": "Rename the {0}",
|
||||
"helpers.taxonomyHelper.rename.validate.equalValue": "The new value must be different from the old one.",
|
||||
"helpers.taxonomyHelper.rename.validate.noValue": "A new value must be provided.",
|
||||
"helpers.taxonomyHelper.merge.quickPick.title": "Merge the \"{0}\" with another {1} value",
|
||||
"helpers.taxonomyHelper.merge.quickPick.placeholder": "Select the {0} value to merge with",
|
||||
"helpers.taxonomyHelper.delete.quickPick.title": "Delete the \"{0}\" {1} value",
|
||||
"helpers.taxonomyHelper.delete.quickPick.placeholder": "Are you sure you want to delete the \"{0}\" {1} value?",
|
||||
"helpers.taxonomyHelper.createNew.input.title": "Create a new {0} value",
|
||||
"helpers.taxonomyHelper.createNew.input.placeholder": "Enter the value you want to add",
|
||||
"helpers.taxonomyHelper.createNew.input.validate.noValue": "A value must be provided.",
|
||||
"helpers.taxonomyHelper.createNew.input.validate.exists": "The value already exists.",
|
||||
"helpers.taxonomyHelper.process.edit": "{0}: Renaming \"{1}\" from {2} to {3}.",
|
||||
"helpers.taxonomyHelper.process.merge": "{0}: Merging \"{1}\" from {2} to {3}.",
|
||||
"helpers.taxonomyHelper.process.delete": "{0}: Deleting \"{1}\" from {2}.",
|
||||
"helpers.taxonomyHelper.process.edit.success": "Edit completed.",
|
||||
"helpers.taxonomyHelper.process.merge.success": "Merge completed.",
|
||||
"helpers.taxonomyHelper.process.delete.success": "Deletion completed.",
|
||||
"helpers.taxonomyHelper.move.quickPick.title": "Move the \"{0}\" to another type",
|
||||
"helpers.taxonomyHelper.move.quickPick.placeholder": "Select the type to move to",
|
||||
"helpers.taxonomyHelper.move.progress.title": "{0}: Moving \"{1}\" from {2} to \"${3}\".",
|
||||
"helpers.taxonomyHelper.move.success": "Move completed.",
|
||||
|
||||
"listeners.dashboard.settingsListener.triggerTemplate.notification": "Template files copied."
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import { LocalStore } from '../constants';
|
||||
import { existsAsync, renameAsync } from '../utils';
|
||||
import { existsSync, mkdirSync, renameSync } from 'fs';
|
||||
import { lookup } from 'mime-types';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
interface MediaRecord {
|
||||
description: string;
|
||||
@@ -160,14 +162,14 @@ export class MediaLibrary {
|
||||
const newPath = join(dirname(filePath), `${newFileInfo.name}${oldFileInfo.ext}`);
|
||||
|
||||
if (await existsAsync(newPath)) {
|
||||
Notifications.warning(`The name "${filename}" already exists at the file location.`);
|
||||
Notifications.warning(LocalizationKey.helpersMediaLibraryRemoveWarning, filename);
|
||||
} else {
|
||||
await renameAsync(filePath, newPath);
|
||||
await this.rename(filePath, newPath);
|
||||
MediaHelpers.resetMedia();
|
||||
}
|
||||
} catch (err) {
|
||||
Notifications.error(`Something went wrong updating "${name}" to "${filename}".`);
|
||||
Notifications.error(l10n.t(LocalizationKey.helpersMediaLibraryRemoveError, name, filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import {
|
||||
SETTING_SLUG_PREFIX,
|
||||
SETTING_SLUG_SUFFIX,
|
||||
SETTING_SLUG_UPDATE_FILE_NAME,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES,
|
||||
SETTING_TAXONOMY_CUSTOM,
|
||||
SETTING_TAXONOMY_FIELD_GROUPS,
|
||||
SETTING_GIT_ENABLED,
|
||||
|
||||
@@ -6,6 +6,8 @@ import { Notifications } from './Notifications';
|
||||
import { Settings } from './SettingsHelper';
|
||||
import { Logger } from './Logger';
|
||||
import { SponsorAi } from '../services/SponsorAI';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export class Questions {
|
||||
/**
|
||||
@@ -14,12 +16,15 @@ export class Questions {
|
||||
* @returns
|
||||
*/
|
||||
public static async yesOrNo(placeholder: string) {
|
||||
const answer = await window.showQuickPick(['yes', 'no'], {
|
||||
placeHolder: placeholder,
|
||||
canPickMany: false,
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
return answer === 'yes';
|
||||
const answer = await window.showQuickPick(
|
||||
[l10n.t(LocalizationKey.commonYes), l10n.t(LocalizationKey.commonNo)],
|
||||
{
|
||||
placeHolder: placeholder,
|
||||
canPickMany: false,
|
||||
ignoreFocusOut: true
|
||||
}
|
||||
);
|
||||
return answer === l10n.t(LocalizationKey.commonYes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,9 +41,9 @@ export class Questions {
|
||||
|
||||
if (githubAuth && githubAuth.account.label) {
|
||||
title = await window.showInputBox({
|
||||
title: 'Title or description',
|
||||
prompt: `What would you like to write about?`,
|
||||
placeHolder: `Content title or description`,
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputTitle),
|
||||
prompt: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputPrompt),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputPlaceholder),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
@@ -49,14 +54,18 @@ export class Questions {
|
||||
if (aiTitles && aiTitles.length > 0) {
|
||||
const options: QuickPickItem[] = [
|
||||
{
|
||||
label: `✏️ your title/description`,
|
||||
label: `✏️ ${l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickTitleSeparator
|
||||
)}`,
|
||||
kind: QuickPickItemKind.Separator
|
||||
},
|
||||
{
|
||||
label: title
|
||||
},
|
||||
{
|
||||
label: `🤖 AI generated title`,
|
||||
label: `🤖 ${l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickAiSeparator
|
||||
)}`,
|
||||
kind: QuickPickItemKind.Separator
|
||||
},
|
||||
...aiTitles.map((d: string) => ({
|
||||
@@ -65,8 +74,10 @@ export class Questions {
|
||||
];
|
||||
|
||||
const selectedTitle = await window.showQuickPick(options, {
|
||||
title: 'Select a title',
|
||||
placeHolder: `Select a title for your content`,
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputSelectTitle),
|
||||
placeHolder: l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputSelectPlaceholder
|
||||
),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
@@ -79,13 +90,11 @@ export class Questions {
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.error((e as Error).message);
|
||||
Notifications.error(
|
||||
`Failed fetching the AI title. Please try to use your own title or try again later.`
|
||||
);
|
||||
Notifications.error(l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputFailed));
|
||||
title = undefined;
|
||||
}
|
||||
} else if (!title && showWarning) {
|
||||
Notifications.warning(`You did not specify a title for your content.`);
|
||||
Notifications.warning(l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputWarning));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -93,15 +102,15 @@ export class Questions {
|
||||
|
||||
if (!title) {
|
||||
title = await window.showInputBox({
|
||||
title: 'Title',
|
||||
prompt: `What would you like to use as a title for the content to create?`,
|
||||
placeHolder: `Content title`,
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleTitleInputTitle),
|
||||
prompt: l10n.t(LocalizationKey.helpersQuestionsContentTitleTitleInputPrompt),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersQuestionsContentTitleTitleInputPlaceholder),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
}
|
||||
|
||||
if (!title && showWarning) {
|
||||
Notifications.warning(`You did not specify a title for your content.`);
|
||||
Notifications.warning(l10n.t(LocalizationKey.helpersQuestionsContentTitleTitleInputWarning));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,20 +132,26 @@ export class Questions {
|
||||
selectedFolder = await window.showQuickPick(
|
||||
folders.map((f) => f.title),
|
||||
{
|
||||
title: `Select a folder`,
|
||||
placeHolder: `Select where you want to create your content`,
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsSelectContentFolderQuickPickTitle),
|
||||
placeHolder: l10n.t(
|
||||
LocalizationKey.helpersQuestionsSelectContentFolderQuickPickPlaceholder
|
||||
),
|
||||
ignoreFocusOut: true
|
||||
}
|
||||
);
|
||||
} else if (folders.length === 1) {
|
||||
selectedFolder = folders[0].title;
|
||||
} else {
|
||||
Notifications.warning(`No page folders were configures.`);
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.helpersQuestionsSelectContentFolderQuickPickNoFoldersWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!selectedFolder && showWarning) {
|
||||
Notifications.warning(`You didn't select a place where you wanted to create your content.`);
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.helpersQuestionsSelectContentFolderQuickPickNoSelectionWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -155,7 +170,9 @@ export class Questions {
|
||||
): Promise<string | undefined> {
|
||||
let contentTypes = ContentType.getAll();
|
||||
if (!contentTypes || contentTypes.length === 0) {
|
||||
Notifications.warning('No content types found. Please create a content type first.');
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.helpersQuestionsSelectContentTypeNoContentTypeWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,14 +192,16 @@ export class Questions {
|
||||
}));
|
||||
|
||||
const selectedOption = await window.showQuickPick(options, {
|
||||
title: `Content type`,
|
||||
placeHolder: `Select the content type to create your new content`,
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsSelectContentTypeQuickPickTitle),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersQuestionsSelectContentTypeQuickPickPlaceholder),
|
||||
canPickMany: false,
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
if (!selectedOption && showWarning) {
|
||||
Notifications.warning('No content type was selected.');
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.helpersQuestionsSelectContentTypeNoSelectionWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { ArticleHelper } from '.';
|
||||
import { ParsedFrontMatter } from '../parsers';
|
||||
import { EXTENSION_NAME } from '../constants';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export class SeoHelper {
|
||||
public static checkLength(
|
||||
@@ -23,10 +26,15 @@ export class SeoHelper {
|
||||
|
||||
const diagnostic: vscode.Diagnostic = {
|
||||
code: '',
|
||||
message: `Article ${fieldName} is longer than ${length} characters (current length: ${value.length}). For SEO reasons, it would be better to make it less than ${length} characters.`,
|
||||
message: l10n.t(
|
||||
LocalizationKey.helpersSeoHelperCheckLengthDiagnosticMessage,
|
||||
fieldName,
|
||||
length,
|
||||
value.length
|
||||
),
|
||||
range: new vscode.Range(posStart, posEnd),
|
||||
severity: vscode.DiagnosticSeverity.Warning,
|
||||
source: 'Front Matter'
|
||||
source: EXTENSION_NAME
|
||||
};
|
||||
|
||||
if (collection.has(editor.document.uri)) {
|
||||
|
||||
@@ -51,6 +51,8 @@ import { GitListener } from '../listeners/general';
|
||||
import { DataListener } from '../listeners/panel';
|
||||
import { MarkdownFoldingProvider } from '../providers/MarkdownFoldingProvider';
|
||||
import { ModeSwitch } from '../services/ModeSwitch';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export class Settings {
|
||||
public static globalFile = 'frontmatter.json';
|
||||
@@ -181,16 +183,19 @@ export class Settings {
|
||||
if (Settings.hasSettings()) {
|
||||
window
|
||||
.showInformationMessage(
|
||||
`You have local settings. Would you like to promote them to the global settings ("frontmatter.json")?`,
|
||||
'Yes',
|
||||
'No'
|
||||
l10n.t(LocalizationKey.helpersSettingsHelperCheckToPromoteMessage),
|
||||
l10n.t(LocalizationKey.commonYes),
|
||||
l10n.t(LocalizationKey.commonNo)
|
||||
)
|
||||
.then(async (result) => {
|
||||
if (result === 'Yes') {
|
||||
if (result === l10n.t(LocalizationKey.commonYes)) {
|
||||
Settings.promote();
|
||||
}
|
||||
|
||||
if (result === 'No' || result === 'Yes') {
|
||||
if (
|
||||
result === l10n.t(LocalizationKey.commonNo) ||
|
||||
result === l10n.t(LocalizationKey.commonYes)
|
||||
) {
|
||||
Extension.getInstance().setState(ExtensionState.SettingPromoted, true, 'workspace');
|
||||
}
|
||||
});
|
||||
@@ -529,7 +534,7 @@ export class Settings {
|
||||
}
|
||||
}
|
||||
|
||||
Notifications.info(`All settings promoted to team level.`);
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersSettingsHelperPromoteSuccess));
|
||||
|
||||
Telemetry.send(TelemetryEvent.promoteSettings);
|
||||
}
|
||||
@@ -663,7 +668,7 @@ export class Settings {
|
||||
await window.withProgress(
|
||||
{
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: `${EXTENSION_NAME}: Reading dynamic config file...`
|
||||
title: l10n.t(LocalizationKey.helpersSettingsHelperReadConfigProgressTitle)
|
||||
},
|
||||
async () => {
|
||||
const absFilePath = Folders.getAbsFilePath(dynamicConfigPath);
|
||||
@@ -691,9 +696,7 @@ export class Settings {
|
||||
}
|
||||
} catch (e) {
|
||||
Settings.globalConfig = undefined;
|
||||
Notifications.error(
|
||||
`Error reading "frontmatter.json" config file. Check [output window](command:${COMMAND_NAME.showOutputChannel}) for more details.`
|
||||
);
|
||||
Notifications.errorWithOutput(l10n.t(LocalizationKey.helpersSettingsHelperReadConfigError));
|
||||
Logger.error((e as Error).message);
|
||||
}
|
||||
|
||||
@@ -1103,7 +1106,7 @@ export class Settings {
|
||||
*/
|
||||
private static async refreshConfig() {
|
||||
await Settings.reloadConfig();
|
||||
Notifications.info(`Settings have been refreshed.`);
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersSettingsHelperRefreshConfigSuccess));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@ import { Folders } from '../commands';
|
||||
import { join } from 'path';
|
||||
import { SettingsListener as PanelSettingsListener } from '../listeners/panel';
|
||||
import { SettingsListener as DashboardSettingsListener } from '../listeners/dashboard';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export class TaxonomyHelper {
|
||||
private static db: JsonDB;
|
||||
@@ -126,15 +128,15 @@ export class TaxonomyHelper {
|
||||
const { type, value } = data;
|
||||
|
||||
const answer = await window.showInputBox({
|
||||
title: `Rename the "${value}"`,
|
||||
title: l10n.t(LocalizationKey.helpersTaxonomyHelperRenameInputTitle, value),
|
||||
value,
|
||||
validateInput: (text) => {
|
||||
if (text === value) {
|
||||
return 'The new value must be different from the old one.';
|
||||
return l10n.t(LocalizationKey.helpersTaxonomyHelperRenameValidateEqualValue);
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
return 'A new value must be provided.';
|
||||
return l10n.t(LocalizationKey.helpersTaxonomyHelperRenameValidateNoValue);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -168,8 +170,8 @@ export class TaxonomyHelper {
|
||||
const answer = await window.showQuickPick(
|
||||
options.filter((o) => o !== value),
|
||||
{
|
||||
title: `Merge the "${value}" with another ${type} value`,
|
||||
placeHolder: `Select the ${type} value to merge with`,
|
||||
title: l10n.t(LocalizationKey.helpersTaxonomyHelperMergeQuickPickTitle, value, type),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersTaxonomyHelperMergeQuickPickPlaceholder, type),
|
||||
ignoreFocusOut: true
|
||||
}
|
||||
);
|
||||
@@ -188,13 +190,20 @@ export class TaxonomyHelper {
|
||||
public static async delete(data: { type: string; value: string }) {
|
||||
const { type, value } = data;
|
||||
|
||||
const answer = await window.showQuickPick(['Yes', 'No'], {
|
||||
title: `Delete the "${value}" ${type} value`,
|
||||
placeHolder: `Are you sure you want to delete the "${value}" ${type} value?`,
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
const answer = await window.showQuickPick(
|
||||
[l10n.t(LocalizationKey.commonYes), l10n.t(LocalizationKey.commonNo)],
|
||||
{
|
||||
title: l10n.t(LocalizationKey.helpersTaxonomyHelperDeleteQuickPickTitle, value, type),
|
||||
placeHolder: l10n.t(
|
||||
LocalizationKey.helpersTaxonomyHelperDeleteQuickPickPlaceholder,
|
||||
value,
|
||||
type
|
||||
),
|
||||
ignoreFocusOut: true
|
||||
}
|
||||
);
|
||||
|
||||
if (!answer || answer === 'No') {
|
||||
if (!answer || answer === l10n.t(LocalizationKey.commonNo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -221,16 +230,16 @@ export class TaxonomyHelper {
|
||||
const options = await this.getTaxonomyOptions(taxonomyType);
|
||||
|
||||
const newOption = await window.showInputBox({
|
||||
title: `Create a new ${type} value`,
|
||||
placeHolder: `The value you want to add`,
|
||||
title: l10n.t(LocalizationKey.helpersTaxonomyHelperCreateNewInputTitle, type),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersTaxonomyHelperCreateNewInputPlaceholder),
|
||||
ignoreFocusOut: true,
|
||||
validateInput: (text) => {
|
||||
if (!text) {
|
||||
return 'A value must be provided.';
|
||||
return l10n.t(LocalizationKey.helpersTaxonomyHelperCreateNewInputValidateNoValue);
|
||||
}
|
||||
|
||||
if (options.includes(text)) {
|
||||
return 'The value already exists.';
|
||||
return l10n.t(LocalizationKey.helpersTaxonomyHelperCreateNewInputValidateExists);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -276,11 +285,28 @@ export class TaxonomyHelper {
|
||||
let progressText = ``;
|
||||
|
||||
if (type === 'edit') {
|
||||
progressText = `${EXTENSION_NAME}: Renaming "${oldValue}" from ${taxonomyName} to "${newValue}".`;
|
||||
progressText = l10n.t(
|
||||
LocalizationKey.helpersTaxonomyHelperProcessEdit,
|
||||
EXTENSION_NAME,
|
||||
oldValue,
|
||||
taxonomyName,
|
||||
newValue || ''
|
||||
);
|
||||
} else if (type === 'merge') {
|
||||
progressText = `${EXTENSION_NAME}: Merging "${oldValue}" from "${taxonomyName}" to "${newValue}".`;
|
||||
progressText = l10n.t(
|
||||
LocalizationKey.helpersTaxonomyHelperProcessMerge,
|
||||
EXTENSION_NAME,
|
||||
oldValue,
|
||||
taxonomyName,
|
||||
newValue || ''
|
||||
);
|
||||
} else if (type === 'delete') {
|
||||
progressText = `${EXTENSION_NAME}: Deleting "${oldValue}" from "${taxonomyName}".`;
|
||||
progressText = l10n.t(
|
||||
LocalizationKey.helpersTaxonomyHelperProcessDelete,
|
||||
EXTENSION_NAME,
|
||||
oldValue,
|
||||
taxonomyName
|
||||
);
|
||||
}
|
||||
|
||||
window.withProgress(
|
||||
@@ -350,11 +376,11 @@ export class TaxonomyHelper {
|
||||
await this.addToSettings(taxonomyType, oldValue, newValue);
|
||||
|
||||
if (type === 'edit') {
|
||||
Notifications.info(`Edit completed.`);
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersTaxonomyHelperProcessEditSuccess));
|
||||
} else if (type === 'merge') {
|
||||
Notifications.info(`Merge completed.`);
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersTaxonomyHelperProcessMergeSuccess));
|
||||
} else if (type === 'delete') {
|
||||
Notifications.info(`Deletion completed.`);
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersTaxonomyHelperProcessDeleteSuccess));
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -375,8 +401,8 @@ export class TaxonomyHelper {
|
||||
options = options.filter((o) => o !== type);
|
||||
|
||||
const answer = await window.showQuickPick(options, {
|
||||
title: `Move the "${value}" to another type`,
|
||||
placeHolder: `Select the type to move to`,
|
||||
title: l10n.t(LocalizationKey.helpersTaxonomyHelperMoveQuickPickTitle, value),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersTaxonomyHelperMoveQuickPickPlaceholder),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
@@ -390,7 +416,13 @@ export class TaxonomyHelper {
|
||||
window.withProgress(
|
||||
{
|
||||
location: ProgressLocation.Notification,
|
||||
title: `${EXTENSION_NAME}: Moving "${value}" from ${type} to "${answer}".`,
|
||||
title: l10n.t(
|
||||
LocalizationKey.helpersTaxonomyHelperMoveProgressTitle,
|
||||
EXTENSION_NAME,
|
||||
value,
|
||||
type,
|
||||
answer
|
||||
),
|
||||
cancellable: false
|
||||
},
|
||||
async (progress) => {
|
||||
@@ -465,7 +497,7 @@ export class TaxonomyHelper {
|
||||
|
||||
await this.process('delete', oldType, value);
|
||||
|
||||
Notifications.info(`Move completed.`);
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersTaxonomyHelperMoveSuccess));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Uri, workspace, window } from 'vscode';
|
||||
import { Logger } from './Logger';
|
||||
import { Notifications } from './Notifications';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export const openFileInEditor = async (filePath: string) => {
|
||||
if (filePath) {
|
||||
@@ -8,7 +10,7 @@ export const openFileInEditor = async (filePath: string) => {
|
||||
const doc = await workspace.openTextDocument(Uri.file(filePath));
|
||||
await window.showTextDocument(doc, 1, false);
|
||||
} catch (e) {
|
||||
Notifications.error(`Couldn't open the file.`);
|
||||
Notifications.error(l10n.t(LocalizationKey.helpersOpenFileInEditorError));
|
||||
Logger.error(`${filePath}: ${(e as Error).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1992,6 +1992,210 @@ export enum LocalizationKey {
|
||||
* Sorry, something went wrong deleting {0}
|
||||
*/
|
||||
helpersMediaHelperDeleteFileFileDeletionFailed = 'helpers.mediaHelper.deleteFile.file.deletion.failed',
|
||||
/**
|
||||
* The name "{0}" already exists at the file location.
|
||||
*/
|
||||
helpersMediaLibraryRemoveWarning = 'helpers.mediaLibrary.remove.warning',
|
||||
/**
|
||||
* Sorry, something went wrong updating "{0}" to "{1}".
|
||||
*/
|
||||
helpersMediaLibraryRemoveError = 'helpers.mediaLibrary.remove.error',
|
||||
/**
|
||||
* Couldn't open the file.
|
||||
*/
|
||||
helpersOpenFileInEditorError = 'helpers.openFileInEditor.error',
|
||||
/**
|
||||
* Title or description
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputTitle = 'helpers.questions.contentTitle.aiInput.title',
|
||||
/**
|
||||
* What would you like to write about?
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputPrompt = 'helpers.questions.contentTitle.aiInput.prompt',
|
||||
/**
|
||||
* What would you like to write about?
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputPlaceholder = 'helpers.questions.contentTitle.aiInput.placeholder',
|
||||
/**
|
||||
* your title/description
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputQuickPickTitleSeparator = 'helpers.questions.contentTitle.aiInput.quickPick.title.separator',
|
||||
/**
|
||||
* AI generated title
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputQuickPickAiSeparator = 'helpers.questions.contentTitle.aiInput.quickPick.ai.separator',
|
||||
/**
|
||||
* Select a title
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputSelectTitle = 'helpers.questions.contentTitle.aiInput.select.title',
|
||||
/**
|
||||
* Select a title for your content
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputSelectPlaceholder = 'helpers.questions.contentTitle.aiInput.select.placeholder',
|
||||
/**
|
||||
* Failed fetching the AI title. Please try to use your own title or try again later.
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputFailed = 'helpers.questions.contentTitle.aiInput.failed',
|
||||
/**
|
||||
* You did not specify a title for your content.
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputWarning = 'helpers.questions.contentTitle.aiInput.warning',
|
||||
/**
|
||||
* Content title
|
||||
*/
|
||||
helpersQuestionsContentTitleTitleInputTitle = 'helpers.questions.contentTitle.titleInput.title',
|
||||
/**
|
||||
* What would you like to use as a title for the content to create?
|
||||
*/
|
||||
helpersQuestionsContentTitleTitleInputPrompt = 'helpers.questions.contentTitle.titleInput.prompt',
|
||||
/**
|
||||
* Content title
|
||||
*/
|
||||
helpersQuestionsContentTitleTitleInputPlaceholder = 'helpers.questions.contentTitle.titleInput.placeholder',
|
||||
/**
|
||||
* You did not specify a title for your content.
|
||||
*/
|
||||
helpersQuestionsContentTitleTitleInputWarning = 'helpers.questions.contentTitle.titleInput.warning',
|
||||
/**
|
||||
* Select a folder
|
||||
*/
|
||||
helpersQuestionsSelectContentFolderQuickPickTitle = 'helpers.questions.selectContentFolder.quickPick.title',
|
||||
/**
|
||||
* Select where you want to create your content
|
||||
*/
|
||||
helpersQuestionsSelectContentFolderQuickPickPlaceholder = 'helpers.questions.selectContentFolder.quickPick.placeholder',
|
||||
/**
|
||||
* No page folders were configured.
|
||||
*/
|
||||
helpersQuestionsSelectContentFolderQuickPickNoFoldersWarning = 'helpers.questions.selectContentFolder.quickPick.noFolders.warning',
|
||||
/**
|
||||
* You didn't select a place where you wanted to create your content.
|
||||
*/
|
||||
helpersQuestionsSelectContentFolderQuickPickNoSelectionWarning = 'helpers.questions.selectContentFolder.quickPick.noSelection.warning',
|
||||
/**
|
||||
* No content types found. Please create a content type first.
|
||||
*/
|
||||
helpersQuestionsSelectContentTypeNoContentTypeWarning = 'helpers.questions.selectContentType.noContentType.warning',
|
||||
/**
|
||||
* Content type
|
||||
*/
|
||||
helpersQuestionsSelectContentTypeQuickPickTitle = 'helpers.questions.selectContentType.quickPick.title',
|
||||
/**
|
||||
* Select the content type to create your new content
|
||||
*/
|
||||
helpersQuestionsSelectContentTypeQuickPickPlaceholder = 'helpers.questions.selectContentType.quickPick.placeholder',
|
||||
/**
|
||||
* No content type was selected.
|
||||
*/
|
||||
helpersQuestionsSelectContentTypeNoSelectionWarning = 'helpers.questions.selectContentType.noSelection.warning',
|
||||
/**
|
||||
* Article {0} is longer than {1} characters (current length: {2}). For SEO reasons, it would be better to make it less than {1} characters.
|
||||
*/
|
||||
helpersSeoHelperCheckLengthDiagnosticMessage = 'helpers.seoHelper.checkLength.diagnostic.message',
|
||||
/**
|
||||
* You have local settings. Would you like to promote them to the global settings ("frontmatter.json")?
|
||||
*/
|
||||
helpersSettingsHelperCheckToPromoteMessage = 'helpers.settingsHelper.checkToPromote.message',
|
||||
/**
|
||||
* All settings promoted to team level.
|
||||
*/
|
||||
helpersSettingsHelperPromoteSuccess = 'helpers.settingsHelper.promote.success',
|
||||
/**
|
||||
* {0}: Reading dynamic config file...
|
||||
*/
|
||||
helpersSettingsHelperReadConfigProgressTitle = 'helpers.settingsHelper.readConfig.progress.title',
|
||||
/**
|
||||
* Error reading your configuration.
|
||||
*/
|
||||
helpersSettingsHelperReadConfigError = 'helpers.settingsHelper.readConfig.error',
|
||||
/**
|
||||
* Settings have been refreshed.
|
||||
*/
|
||||
helpersSettingsHelperRefreshConfigSuccess = 'helpers.settingsHelper.refreshConfig.success',
|
||||
/**
|
||||
* Rename the {0}
|
||||
*/
|
||||
helpersTaxonomyHelperRenameInputTitle = 'helpers.taxonomyHelper.rename.input.title',
|
||||
/**
|
||||
* The new value must be different from the old one.
|
||||
*/
|
||||
helpersTaxonomyHelperRenameValidateEqualValue = 'helpers.taxonomyHelper.rename.validate.equalValue',
|
||||
/**
|
||||
* A new value must be provided.
|
||||
*/
|
||||
helpersTaxonomyHelperRenameValidateNoValue = 'helpers.taxonomyHelper.rename.validate.noValue',
|
||||
/**
|
||||
* Merge the "{0}" with another {1} value
|
||||
*/
|
||||
helpersTaxonomyHelperMergeQuickPickTitle = 'helpers.taxonomyHelper.merge.quickPick.title',
|
||||
/**
|
||||
* Select the {0} value to merge with
|
||||
*/
|
||||
helpersTaxonomyHelperMergeQuickPickPlaceholder = 'helpers.taxonomyHelper.merge.quickPick.placeholder',
|
||||
/**
|
||||
* Delete the "{0}" {1} value
|
||||
*/
|
||||
helpersTaxonomyHelperDeleteQuickPickTitle = 'helpers.taxonomyHelper.delete.quickPick.title',
|
||||
/**
|
||||
* Are you sure you want to delete the "{0}" {1} value?
|
||||
*/
|
||||
helpersTaxonomyHelperDeleteQuickPickPlaceholder = 'helpers.taxonomyHelper.delete.quickPick.placeholder',
|
||||
/**
|
||||
* Create a new {0} value
|
||||
*/
|
||||
helpersTaxonomyHelperCreateNewInputTitle = 'helpers.taxonomyHelper.createNew.input.title',
|
||||
/**
|
||||
* Enter the value you want to add
|
||||
*/
|
||||
helpersTaxonomyHelperCreateNewInputPlaceholder = 'helpers.taxonomyHelper.createNew.input.placeholder',
|
||||
/**
|
||||
* A value must be provided.
|
||||
*/
|
||||
helpersTaxonomyHelperCreateNewInputValidateNoValue = 'helpers.taxonomyHelper.createNew.input.validate.noValue',
|
||||
/**
|
||||
* The value already exists.
|
||||
*/
|
||||
helpersTaxonomyHelperCreateNewInputValidateExists = 'helpers.taxonomyHelper.createNew.input.validate.exists',
|
||||
/**
|
||||
* {0}: Renaming "{1}" from {2} to {3}.
|
||||
*/
|
||||
helpersTaxonomyHelperProcessEdit = 'helpers.taxonomyHelper.process.edit',
|
||||
/**
|
||||
* {0}: Merging "{1}" from {2} to {3}.
|
||||
*/
|
||||
helpersTaxonomyHelperProcessMerge = 'helpers.taxonomyHelper.process.merge',
|
||||
/**
|
||||
* {0}: Deleting "{1}" from {2}.
|
||||
*/
|
||||
helpersTaxonomyHelperProcessDelete = 'helpers.taxonomyHelper.process.delete',
|
||||
/**
|
||||
* Edit completed.
|
||||
*/
|
||||
helpersTaxonomyHelperProcessEditSuccess = 'helpers.taxonomyHelper.process.edit.success',
|
||||
/**
|
||||
* Merge completed.
|
||||
*/
|
||||
helpersTaxonomyHelperProcessMergeSuccess = 'helpers.taxonomyHelper.process.merge.success',
|
||||
/**
|
||||
* Deletion completed.
|
||||
*/
|
||||
helpersTaxonomyHelperProcessDeleteSuccess = 'helpers.taxonomyHelper.process.delete.success',
|
||||
/**
|
||||
* Move the "{0}" to another type
|
||||
*/
|
||||
helpersTaxonomyHelperMoveQuickPickTitle = 'helpers.taxonomyHelper.move.quickPick.title',
|
||||
/**
|
||||
* Select the type to move to
|
||||
*/
|
||||
helpersTaxonomyHelperMoveQuickPickPlaceholder = 'helpers.taxonomyHelper.move.quickPick.placeholder',
|
||||
/**
|
||||
* {0}: Moving "{1}" from {2} to "${3}".
|
||||
*/
|
||||
helpersTaxonomyHelperMoveProgressTitle = 'helpers.taxonomyHelper.move.progress.title',
|
||||
/**
|
||||
* Move completed.
|
||||
*/
|
||||
helpersTaxonomyHelperMoveSuccess = 'helpers.taxonomyHelper.move.success',
|
||||
/**
|
||||
* Template files copied.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user