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:
@@ -319,7 +319,7 @@
|
||||
"dashboard.media.detailsSlideOver.unmapped.description": "Do you want to remap the metadata of unmapped files?",
|
||||
|
||||
"dashboard.configuration.astro.astroContentTypes.empty": "No Astro Content Collections found.",
|
||||
"dashboard.configuration.astro.astroContentTypes.description": "The following Astro Content Collections and can be used to generate a content-type.",
|
||||
"dashboard.configuration.astro.astroContentTypes.description": "The following Astro Content Collections can be used to generate a content-type.",
|
||||
|
||||
"panel.contentType.contentTypeValidator.title": "Content-type",
|
||||
"panel.contentType.contentTypeValidator.hint": "We noticed field differences between the content-type and the front matter data. \n Would you like to create, update, or set the content-type for this content?",
|
||||
@@ -668,5 +668,39 @@
|
||||
"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."
|
||||
"listeners.dashboard.dashboardListener.pinItem.noPath.error": "No path provided.",
|
||||
"listeners.dashboard.dashboardListener.pinItem.coundNotPin.error": "Could not pin item.",
|
||||
"listeners.dashboard.dashboardListener.pinItem.coundNotUnPin.error": "Could not unpin item.",
|
||||
|
||||
"listeners.dashboard.settingsListener.triggerTemplate.notification": "Template files copied.",
|
||||
"listeners.dashboard.settingsListener.triggerTemplate.progress.title": "Downloading and initializing the template...",
|
||||
"listeners.dashboard.settingsListener.triggerTemplate.download.error": "Failed to download the template.",
|
||||
"listeners.dashboard.settingsListener.triggerTemplate.init.error": "Failed to initialize the template.",
|
||||
|
||||
"listeners.dashboard.snippetListener.addSnippet.missingFields.warning": "Snippet missing title or body",
|
||||
"listeners.dashboard.snippetListener.addSnippet.exists.warning": "Snippet with the same title already exists",
|
||||
"listeners.dashboard.snippetListener.updateSnippet.noSnippets.warning": "No snippets to update",
|
||||
|
||||
"listeners.general.gitListener.push.error": "Failed to push submodules.",
|
||||
|
||||
"listeners.panel.dataListener.aiSuggestTaxonomy.noEditor.error": "No active editor",
|
||||
"listeners.panel.dataListener.aiSuggestTaxonomy.noData.error": "No article data",
|
||||
"listeners.panel.dataListener.getDataFileEntries.noDataFiles.error": "Couldn't find data file entries",
|
||||
|
||||
|
||||
"listeners.panel.taxonomyListener.aiSuggestTaxonomy.noEditor.error": "No active editor",
|
||||
"listeners.panel.taxonomyListener.aiSuggestTaxonomy.noData.error": "No article data",
|
||||
|
||||
"services.modeSwitch.switchMode.quickPick.placeholder": "Select the mode you want to use",
|
||||
"services.modeSwitch.switchMode.quickPick.title": "{0}: Mode selection",
|
||||
"services.modeSwitch.setText.mode": "Mode: {0}",
|
||||
|
||||
"services.pagesParser.parsePages.statusBar.text": "Processing...",
|
||||
"services.pagesParser.parsePages.file.error": "File error: {0}",
|
||||
|
||||
"services.sponsorAi.getTitles.warning": "The AI title generation took too long. Please try again later.",
|
||||
"services.sponsorAi.getDescription.warning": "The AI description generation took too long. Please try again later.",
|
||||
"services.sponsorAi.getTaxonomySuggestions.warning": "The AI taxonomy generation took too long. Please try again later.",
|
||||
|
||||
"services.terminal.openLocalServerTerminal.terminalOption.message": "Starting local server"
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const jsoncParser = require('jsonc-parser');
|
||||
|
||||
const camlCase = (str) => {
|
||||
const words = str.split('.');
|
||||
@@ -15,12 +16,14 @@ const camlCase = (str) => {
|
||||
const enFile = fs.readFileSync(path.join(__dirname, '../l10n/bundle.l10n.json'), 'utf8');
|
||||
|
||||
// Parse the EN file
|
||||
const en = JSON.parse(enFile);
|
||||
const en = jsoncParser.parse(enFile);
|
||||
|
||||
const keys = Object.keys(en);
|
||||
|
||||
// Create an enum file
|
||||
const enumFile = fs.createWriteStream(path.join(__dirname, '../src/localization/localization.enum.ts'));
|
||||
const enumFile = fs.createWriteStream(
|
||||
path.join(__dirname, '../src/localization/localization.enum.ts')
|
||||
);
|
||||
|
||||
// Write the enum file header
|
||||
enumFile.write(`export enum LocalizationKey {\n`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const EXTENSION_NAME = '𝖥𝗋𝗈𝗇𝗍 𝖬𝖺𝗍𝗍𝖾𝗋 𝖢𝖬𝖲';
|
||||
export const EXTENSION_NAME = 'Front Matter CMS';
|
||||
|
||||
export const CONFIG_KEY = 'frontMatter';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GitListener } from './listeners/general/GitListener';
|
||||
import * as vscode from 'vscode';
|
||||
import { COMMAND_NAME, TelemetryEvent } from './constants';
|
||||
import { COMMAND_NAME, EXTENSION_NAME, TelemetryEvent } from './constants';
|
||||
import { MarkdownFoldingProvider } from './providers/MarkdownFoldingProvider';
|
||||
import { TagType } from './panelWebView/TagType';
|
||||
import { PanelProvider } from './panelWebView/PanelProvider';
|
||||
@@ -281,7 +281,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
);
|
||||
fmStatusBarItem.command = COMMAND_NAME.dashboard;
|
||||
fmStatusBarItem.text = `$(fm-logo)`;
|
||||
fmStatusBarItem.tooltip = `Front Matter CMS`;
|
||||
fmStatusBarItem.tooltip = EXTENSION_NAME;
|
||||
fmStatusBarItem.show();
|
||||
|
||||
// Register listeners that make sure the status bar updates
|
||||
|
||||
@@ -6,6 +6,8 @@ import { Extension, Notifications } from '../../helpers';
|
||||
import { PostMessageData } from '../../models';
|
||||
import { PinnedItems } from '../../services';
|
||||
import { BaseListener } from './BaseListener';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
|
||||
export class DashboardListener extends BaseListener {
|
||||
/**
|
||||
@@ -66,14 +68,22 @@ export class DashboardListener extends BaseListener {
|
||||
|
||||
const path = payload;
|
||||
if (!path) {
|
||||
this.sendError(command as any, requestId, 'No path provided.');
|
||||
this.sendError(
|
||||
command as any,
|
||||
requestId,
|
||||
l10n.t(LocalizationKey.listenersDashboardDashboardListenerPinItemNoPathError)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const allPinned = await PinnedItems.pin(path);
|
||||
|
||||
if (!allPinned) {
|
||||
this.sendError(command as any, requestId, 'Could not pin item.');
|
||||
this.sendError(
|
||||
command as any,
|
||||
requestId,
|
||||
l10n.t(LocalizationKey.listenersDashboardDashboardListenerPinItemCoundNotPinError)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,14 +102,22 @@ export class DashboardListener extends BaseListener {
|
||||
|
||||
const path = payload;
|
||||
if (!path) {
|
||||
this.sendError(command as any, requestId, 'No path provided.');
|
||||
this.sendError(
|
||||
command as any,
|
||||
requestId,
|
||||
l10n.t(LocalizationKey.listenersDashboardDashboardListenerPinItemNoPathError)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const updatedPinned = await PinnedItems.remove(path);
|
||||
|
||||
if (!updatedPinned) {
|
||||
this.sendError(command as any, requestId, 'Could not unpin item.');
|
||||
this.sendError(
|
||||
command as any,
|
||||
requestId,
|
||||
l10n.t(LocalizationKey.listenersDashboardDashboardListenerPinItemCoundNotUnPinError)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,9 @@ export class SettingsListener extends BaseListener {
|
||||
await window.withProgress(
|
||||
{
|
||||
location: ProgressLocation.Notification,
|
||||
title: 'Downloading and initializing the template...',
|
||||
title: l10n.t(
|
||||
LocalizationKey.listenersDashboardSettingsListenerTriggerTemplateProgressTitle
|
||||
),
|
||||
cancellable: false
|
||||
},
|
||||
async (progress) => {
|
||||
@@ -209,7 +211,11 @@ export class SettingsListener extends BaseListener {
|
||||
const ghFolder = await download(template.url, wsFolder.fsPath);
|
||||
|
||||
if (!ghFolder.downloaded) {
|
||||
Notifications.error('Failed to download the template.');
|
||||
Notifications.error(
|
||||
l10n.t(
|
||||
LocalizationKey.listenersDashboardSettingsListenerTriggerTemplateDownloadError
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -225,7 +231,9 @@ export class SettingsListener extends BaseListener {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
Notifications.error(`Failed to initialize the template.`);
|
||||
Notifications.error(
|
||||
l10n.t(LocalizationKey.listenersDashboardSettingsListenerTriggerTemplateInitError)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -7,6 +7,8 @@ import { Notifications, Settings, Telemetry } from '../../helpers';
|
||||
import { PostMessageData, Snippets } from '../../models';
|
||||
import { BaseListener } from './BaseListener';
|
||||
import { SettingsListener } from './SettingsListener';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
|
||||
export class SnippetListener extends BaseListener {
|
||||
public static process(msg: PostMessageData) {
|
||||
@@ -30,13 +32,17 @@ export class SnippetListener extends BaseListener {
|
||||
const { title, description, body, fields, isMediaSnippet } = data;
|
||||
|
||||
if (!title || !body) {
|
||||
Notifications.warning('Snippet missing title or body');
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.listenersDashboardSnippetListenerAddSnippetMissingFieldsWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const snippets = Settings.get<any>(SETTING_CONTENT_SNIPPETS);
|
||||
if (snippets && snippets[title]) {
|
||||
Notifications.warning('Snippet with the same title already exists');
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.listenersDashboardSnippetListenerAddSnippetExistsWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +69,9 @@ export class SnippetListener extends BaseListener {
|
||||
const { snippets } = data;
|
||||
|
||||
if (!snippets) {
|
||||
Notifications.warning('No snippets to update');
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.listenersDashboardSnippetListenerUpdateSnippetNoSnippetsWarning)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ import {
|
||||
import { Folders } from '../../commands/Folders';
|
||||
import { commands } from 'vscode';
|
||||
import { PostMessageData } from '../../models';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
|
||||
export class GitListener {
|
||||
private static isRegistered: boolean = false;
|
||||
@@ -177,7 +179,9 @@ export class GitListener {
|
||||
}
|
||||
await subGit.push();
|
||||
} catch (e) {
|
||||
Notifications.error(`Failed to push submodules. Please check the logs for more details.`);
|
||||
Notifications.errorWithOutput(
|
||||
l10n.t(LocalizationKey.listenersGeneralGitListenerPushError)
|
||||
);
|
||||
Logger.error((e as Error).message);
|
||||
return;
|
||||
}
|
||||
@@ -203,7 +207,9 @@ export class GitListener {
|
||||
await git.subModule(['foreach', 'git', 'push']);
|
||||
}
|
||||
} catch (e) {
|
||||
Notifications.error(`Failed to push submodules. Please check the logs for more details.`);
|
||||
Notifications.errorWithOutput(
|
||||
l10n.t(LocalizationKey.listenersGeneralGitListenerPushError)
|
||||
);
|
||||
Logger.error((e as Error).message);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import { PanelProvider } from '../../panelWebView/PanelProvider';
|
||||
import { MessageHandlerData } from '@estruyf/vscode';
|
||||
import { SponsorAi } from '../../services/SponsorAI';
|
||||
import { Terminal } from '../../services';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
|
||||
const FILE_LIMIT = 10;
|
||||
|
||||
@@ -94,7 +96,7 @@ export class DataListener extends BaseListener {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: 'No active editor'
|
||||
error: l10n.t(LocalizationKey.listenersPanelDataListenerAiSuggestTaxonomyNoEditorError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
@@ -104,7 +106,7 @@ export class DataListener extends BaseListener {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: 'No article data'
|
||||
error: l10n.t(LocalizationKey.listenersPanelDataListenerAiSuggestTaxonomyNoDataError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +128,7 @@ export class DataListener extends BaseListener {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: 'No article data'
|
||||
error: l10n.t(LocalizationKey.listenersPanelDataListenerAiSuggestTaxonomyNoDataError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
@@ -499,7 +501,11 @@ export class DataListener extends BaseListener {
|
||||
if (entries) {
|
||||
this.sendRequest(command, requestId, entries);
|
||||
} else {
|
||||
this.sendRequestError(command, requestId, "Couldn't find data file entries");
|
||||
this.sendRequestError(
|
||||
command,
|
||||
requestId,
|
||||
l10n.t(LocalizationKey.listenersPanelDataListenerGetDataFileEntriesNoDataFilesError)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
import { SponsorAi } from '../../services/SponsorAI';
|
||||
import { PanelProvider } from '../../panelWebView/PanelProvider';
|
||||
import { MessageHandlerData } from '@estruyf/vscode';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
|
||||
export class TaxonomyListener extends BaseListener {
|
||||
/**
|
||||
@@ -80,7 +82,7 @@ export class TaxonomyListener extends BaseListener {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: 'No active editor'
|
||||
error: l10n.t(LocalizationKey.listenersPanelTaxonomyListenerAiSuggestTaxonomyNoDataError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
@@ -90,7 +92,7 @@ export class TaxonomyListener extends BaseListener {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: 'No article data'
|
||||
error: l10n.t(LocalizationKey.listenersPanelTaxonomyListenerAiSuggestTaxonomyNoEditorError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
@@ -115,7 +117,7 @@ export class TaxonomyListener extends BaseListener {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: 'No article data'
|
||||
error: l10n.t(LocalizationKey.listenersPanelTaxonomyListenerAiSuggestTaxonomyNoDataError)
|
||||
} as MessageHandlerData<string>);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1056,7 +1056,7 @@ export enum LocalizationKey {
|
||||
*/
|
||||
dashboardConfigurationAstroAstroContentTypesEmpty = 'dashboard.configuration.astro.astroContentTypes.empty',
|
||||
/**
|
||||
* The following Astro Content Collections and can be used to generate a content-type.
|
||||
* The following Astro Content Collections can be used to generate a content-type.
|
||||
*/
|
||||
dashboardConfigurationAstroAstroContentTypesDescription = 'dashboard.configuration.astro.astroContentTypes.description',
|
||||
/**
|
||||
@@ -2196,8 +2196,104 @@ export enum LocalizationKey {
|
||||
* Move completed.
|
||||
*/
|
||||
helpersTaxonomyHelperMoveSuccess = 'helpers.taxonomyHelper.move.success',
|
||||
/**
|
||||
* No path provided.
|
||||
*/
|
||||
listenersDashboardDashboardListenerPinItemNoPathError = 'listeners.dashboard.dashboardListener.pinItem.noPath.error',
|
||||
/**
|
||||
* Could not pin item.
|
||||
*/
|
||||
listenersDashboardDashboardListenerPinItemCoundNotPinError = 'listeners.dashboard.dashboardListener.pinItem.coundNotPin.error',
|
||||
/**
|
||||
* Could not unpin item.
|
||||
*/
|
||||
listenersDashboardDashboardListenerPinItemCoundNotUnPinError = 'listeners.dashboard.dashboardListener.pinItem.coundNotUnPin.error',
|
||||
/**
|
||||
* Template files copied.
|
||||
*/
|
||||
listenersDashboardSettingsListenerTriggerTemplateNotification = 'listeners.dashboard.settingsListener.triggerTemplate.notification'
|
||||
listenersDashboardSettingsListenerTriggerTemplateNotification = 'listeners.dashboard.settingsListener.triggerTemplate.notification',
|
||||
/**
|
||||
* Downloading and initializing the template...
|
||||
*/
|
||||
listenersDashboardSettingsListenerTriggerTemplateProgressTitle = 'listeners.dashboard.settingsListener.triggerTemplate.progress.title',
|
||||
/**
|
||||
* Failed to download the template.
|
||||
*/
|
||||
listenersDashboardSettingsListenerTriggerTemplateDownloadError = 'listeners.dashboard.settingsListener.triggerTemplate.download.error',
|
||||
/**
|
||||
* Failed to initialize the template.
|
||||
*/
|
||||
listenersDashboardSettingsListenerTriggerTemplateInitError = 'listeners.dashboard.settingsListener.triggerTemplate.init.error',
|
||||
/**
|
||||
* Snippet missing title or body
|
||||
*/
|
||||
listenersDashboardSnippetListenerAddSnippetMissingFieldsWarning = 'listeners.dashboard.snippetListener.addSnippet.missingFields.warning',
|
||||
/**
|
||||
* Snippet with the same title already exists
|
||||
*/
|
||||
listenersDashboardSnippetListenerAddSnippetExistsWarning = 'listeners.dashboard.snippetListener.addSnippet.exists.warning',
|
||||
/**
|
||||
* No snippets to update
|
||||
*/
|
||||
listenersDashboardSnippetListenerUpdateSnippetNoSnippetsWarning = 'listeners.dashboard.snippetListener.updateSnippet.noSnippets.warning',
|
||||
/**
|
||||
* Failed to push submodules.
|
||||
*/
|
||||
listenersGeneralGitListenerPushError = 'listeners.general.gitListener.push.error',
|
||||
/**
|
||||
* No active editor
|
||||
*/
|
||||
listenersPanelDataListenerAiSuggestTaxonomyNoEditorError = 'listeners.panel.dataListener.aiSuggestTaxonomy.noEditor.error',
|
||||
/**
|
||||
* No article data
|
||||
*/
|
||||
listenersPanelDataListenerAiSuggestTaxonomyNoDataError = 'listeners.panel.dataListener.aiSuggestTaxonomy.noData.error',
|
||||
/**
|
||||
* Couldn't find data file entries
|
||||
*/
|
||||
listenersPanelDataListenerGetDataFileEntriesNoDataFilesError = 'listeners.panel.dataListener.getDataFileEntries.noDataFiles.error',
|
||||
/**
|
||||
* No active editor
|
||||
*/
|
||||
listenersPanelTaxonomyListenerAiSuggestTaxonomyNoEditorError = 'listeners.panel.taxonomyListener.aiSuggestTaxonomy.noEditor.error',
|
||||
/**
|
||||
* No article data
|
||||
*/
|
||||
listenersPanelTaxonomyListenerAiSuggestTaxonomyNoDataError = 'listeners.panel.taxonomyListener.aiSuggestTaxonomy.noData.error',
|
||||
/**
|
||||
* Select the mode you want to use
|
||||
*/
|
||||
servicesModeSwitchSwitchModeQuickPickPlaceholder = 'services.modeSwitch.switchMode.quickPick.placeholder',
|
||||
/**
|
||||
* {0}: Mode selection
|
||||
*/
|
||||
servicesModeSwitchSwitchModeQuickPickTitle = 'services.modeSwitch.switchMode.quickPick.title',
|
||||
/**
|
||||
* Mode: {0}
|
||||
*/
|
||||
servicesModeSwitchSetTextMode = 'services.modeSwitch.setText.mode',
|
||||
/**
|
||||
* Processing...
|
||||
*/
|
||||
servicesPagesParserParsePagesStatusBarText = 'services.pagesParser.parsePages.statusBar.text',
|
||||
/**
|
||||
* File error: {0}
|
||||
*/
|
||||
servicesPagesParserParsePagesFileError = 'services.pagesParser.parsePages.file.error',
|
||||
/**
|
||||
* The AI title generation took too long. Please try again later.
|
||||
*/
|
||||
servicesSponsorAiGetTitlesWarning = 'services.sponsorAi.getTitles.warning',
|
||||
/**
|
||||
* The AI description generation took too long. Please try again later.
|
||||
*/
|
||||
servicesSponsorAiGetDescriptionWarning = 'services.sponsorAi.getDescription.warning',
|
||||
/**
|
||||
* The AI taxonomy generation took too long. Please try again later.
|
||||
*/
|
||||
servicesSponsorAiGetTaxonomySuggestionsWarning = 'services.sponsorAi.getTaxonomySuggestions.warning',
|
||||
/**
|
||||
* Starting local server
|
||||
*/
|
||||
servicesTerminalOpenLocalServerTerminalTerminalOptionMessage = 'services.terminal.openLocalServerTerminal.terminalOption.message'
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ import {
|
||||
} from 'vscode';
|
||||
import {
|
||||
SETTING_CONTENT_FRONTMATTER_HIGHLIGHT,
|
||||
SETTING_CONTENT_SUPPORTED_FILETYPES,
|
||||
SETTING_FRONTMATTER_TYPE
|
||||
SETTING_CONTENT_SUPPORTED_FILETYPES
|
||||
} from '../constants';
|
||||
import { Settings } from '../helpers';
|
||||
import { FrontMatterDecorationProvider } from './FrontMatterDecorationProvider';
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { ModeListener } from './../listeners/general/ModeListener';
|
||||
import { SETTING_GLOBAL_ACTIVE_MODE, SETTING_GLOBAL_MODES } from './../constants/settings';
|
||||
import { commands, StatusBarAlignment, StatusBarItem, ThemeColor, window } from 'vscode';
|
||||
import {
|
||||
EXTENSION_NAME,
|
||||
SETTING_GLOBAL_ACTIVE_MODE,
|
||||
SETTING_GLOBAL_MODES
|
||||
} from './../constants/settings';
|
||||
import { commands, StatusBarAlignment, StatusBarItem, window } from 'vscode';
|
||||
import { Settings } from '../helpers/SettingsHelper';
|
||||
import { COMMAND_NAME, CONTEXT } from '../constants';
|
||||
import { Mode } from '../models';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export class ModeSwitch {
|
||||
private static isInit: boolean = false;
|
||||
@@ -56,9 +62,9 @@ export class ModeSwitch {
|
||||
const modePicks = ['Default', ...modes.map((m) => m.id)];
|
||||
|
||||
const mode = await window.showQuickPick(modePicks, {
|
||||
placeHolder: `Select the mode you want to use`,
|
||||
ignoreFocusOut: true,
|
||||
title: `Front Matter: Mode selection`
|
||||
title: l10n.t(LocalizationKey.servicesModeSwitchSwitchModeQuickPickTitle, EXTENSION_NAME),
|
||||
placeHolder: l10n.t(LocalizationKey.servicesModeSwitchSwitchModeQuickPickPlaceholder),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
if (mode) {
|
||||
@@ -70,9 +76,10 @@ export class ModeSwitch {
|
||||
}
|
||||
|
||||
private static setText() {
|
||||
ModeSwitch.statusBarElm.text = `$(preview) Mode: ${
|
||||
ModeSwitch.statusBarElm.text = `$(preview) ${l10n.t(
|
||||
LocalizationKey.servicesModeSwitchSetTextMode,
|
||||
ModeSwitch.currentMode ? ModeSwitch.currentMode : 'Default'
|
||||
}`;
|
||||
)}`;
|
||||
ModeSwitch.statusBarElm.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import {
|
||||
} from '../helpers';
|
||||
import { existsAsync } from '../utils';
|
||||
import { Article, Cache } from '../commands';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
export class PagesParser {
|
||||
public static allPages: Page[] = [];
|
||||
@@ -81,7 +83,9 @@ export class PagesParser {
|
||||
const pages: Page[] = [];
|
||||
|
||||
if (folderInfo) {
|
||||
PagesParser.pagesStatusBar.text = '$(sync~spin) Processing pages...';
|
||||
PagesParser.pagesStatusBar.text = `$(sync~spin) ${l10n.t(
|
||||
LocalizationKey.servicesPagesParserParsePagesStatusBarText
|
||||
)}`;
|
||||
PagesParser.pagesStatusBar.show();
|
||||
|
||||
for (const folder of folderInfo) {
|
||||
@@ -108,7 +112,12 @@ export class PagesParser {
|
||||
}
|
||||
|
||||
Logger.error(`PagesParser::parsePages: ${file.filePath} - ${error.message}`);
|
||||
Notifications.error(`File error: ${file.filePath} - ${error?.message || error}`);
|
||||
Notifications.error(
|
||||
l10n.t(
|
||||
LocalizationKey.servicesPagesParserParsePagesFileError,
|
||||
`${file.filePath} - ${error?.message || error}`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import { Logger, Notifications, Settings, TaxonomyHelper } from '../helpers';
|
||||
import fetch from 'node-fetch';
|
||||
import { TagType } from '../panelWebView/TagType';
|
||||
import { TaxonomyType } from '../models';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
const AI_URL = 'https://frontmatter.codes/api/ai';
|
||||
// const AI_URL = 'http://localhost:3000/api/ai';
|
||||
@@ -18,7 +20,7 @@ export class SponsorAi {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
Notifications.warning(`The AI title generation took too long. Please try again later.`);
|
||||
Notifications.warning(l10n.t(LocalizationKey.servicesSponsorAiGetTitlesWarning));
|
||||
controller.abort();
|
||||
}, 10000);
|
||||
const signal = controller.signal;
|
||||
@@ -51,7 +53,7 @@ export class SponsorAi {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
Notifications.warning(`The AI title generation took too long. Please try again later.`);
|
||||
Notifications.warning(l10n.t(LocalizationKey.servicesSponsorAiGetDescriptionWarning));
|
||||
controller.abort();
|
||||
}, 10000);
|
||||
const signal = controller.signal;
|
||||
@@ -103,7 +105,9 @@ export class SponsorAi {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
Notifications.warning(`The AI taxonomy generation took too long. Please try again later.`);
|
||||
Notifications.warning(
|
||||
l10n.t(LocalizationKey.servicesSponsorAiGetTaxonomySuggestionsWarning)
|
||||
);
|
||||
controller.abort();
|
||||
}, 10000);
|
||||
const signal = controller.signal;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { workspace, window, ThemeIcon, TerminalOptions } from 'vscode';
|
||||
import * as os from 'os';
|
||||
import { Folders } from '../commands';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
interface ShellSetting {
|
||||
path: string;
|
||||
@@ -45,7 +47,9 @@ export class Terminal {
|
||||
const terminalOptions: TerminalOptions = {
|
||||
name: Terminal.terminalName,
|
||||
iconPath: new ThemeIcon('server-environment'),
|
||||
message: `Starting local server`
|
||||
message: l10n.t(
|
||||
LocalizationKey.servicesTerminalOpenLocalServerTerminalTerminalOptionMessage
|
||||
)
|
||||
};
|
||||
|
||||
// Check if workspace
|
||||
|
||||
Reference in New Issue
Block a user