From a4bf972b1dff38446c9b32f38fdb004bffc4b8b7 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 17 Jul 2023 21:46:58 -0400 Subject: [PATCH] Localization of steps + taxonomy --- l10n/bundle.l10n.json | 45 +++++ .../components/SnippetsView/NewForm.tsx | 32 ++-- .../components/SnippetsView/Snippets.tsx | 32 ++-- .../components/Steps/StepsToGetStarted.tsx | 45 ++--- .../TaxonomyView/TaxonomyActions.tsx | 30 ++-- .../TaxonomyView/TaxonomyLookup.tsx | 4 +- src/localization/localization.enum.ts | 160 ++++++++++++++++++ 7 files changed, 282 insertions(+), 66 deletions(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 9dca1e66..6ba3d8cf 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -8,7 +8,10 @@ "common.menu": "Menu", "common.insert": "Insert", "common.insert.snippet": "Insert snippet", + "common.title": "Title", "common.update": "Update", + "common.information": "Info", + "common.important": "Important", "common.error.message": "Sorry, something went wrong.", "field.required": "Required field", @@ -183,6 +186,48 @@ "dashboard.snippetsView.item.alert.title": "Delete snippet: {0}", "dashboard.snippetsView.item.alert.description": "Are you sure you want to delete the {0} snippet?", + "dashboard.snippetsView.newForm.snippetInput.title.placeholder": "Snippet title", + "dashboard.snippetsView.newForm.snippetInput.description.label": "Description", + "dashboard.snippetsView.newForm.snippetInput.description.placeholder": "Snippet description", + "dashboard.snippetsView.newForm.snippetInput.snippet.label": "Snippet", + "dashboard.snippetsView.newForm.snippetInput.snippet.placeholder": "Snippet content", + "dashboard.snippetsView.newForm.snippetInput.isMediaSnippet.label": "Is a media snippet?", + "dashboard.snippetsView.newForm.snippetInput.isMediaSnippet.checkbox.label": "Media snippet", + "dashboard.snippetsView.newForm.snippetInput.isMediaSnippet.checkbox.description": "Use the current snippet for inserting media files into your content.", + "dashboard.snippetsView.newForm.snippetInput.docsButton.title": "Read more on using media snippet placeholders", + "dashboard.snippetsView.newForm.snippetInput.docsButton.description": "Check our media snippet placeholders documentation to know which placeholders you can use.", + + "dashboard.snippetsView.snippets.ariaLabel": "Snippets header", + "dashboard.snippetsView.snippets.button.create": "Create new snippet", + "dashboard.snippetsView.snippets.select.description": "Select the snippet to add to your content.", + "dashboard.snippetsView.snippets.empty.message": "No snippets found", + "dashboard.snippetsView.snippets.readMore": "Read more to get started with snippets", + "dashboard.snippetsView.snippets.formDialog.title": "Create a snippet", + + "dashboard.steps.stepsToGetStarted.button.addFolder.title": "Add as a content folder to Front Matter", + "dashboard.steps.stepsToGetStarted.initializeProject.name": "Initialize project", + "dashboard.steps.stepsToGetStarted.initializeProject.description": "Initialize the project will create the required files and folders for using the Front Matter CMS. Start by clicking on this action.", + "dashboard.steps.stepsToGetStarted.framework.name": "Framework presets", + "dashboard.steps.stepsToGetStarted.framework.description": "Select your site-generator or framework to prefill some of the recommended settings.", + "dashboard.steps.stepsToGetStarted.framework.select": "Select your framework", + "dashboard.steps.stepsToGetStarted.framework.select.other": "other", + "dashboard.steps.stepsToGetStarted.contentFolders.name": "Register content folder(s)", + "dashboard.steps.stepsToGetStarted.contentFolders.description": "Add one of the folders we found in your project as a content folder. Once a folder is set, Front Matter can be used to list all contents and allow you to create content.", + "dashboard.steps.stepsToGetStarted.contentFolders.label": "Folders containing content:", + "dashboard.steps.stepsToGetStarted.contentFolders.information.description": "You can also perform this action by right-clicking on the folder in the explorer view, and selecting register folder", + "dashboard.steps.stepsToGetStarted.tags.name": "Import all tags and categories (optional)", + "dashboard.steps.stepsToGetStarted.tags.description": "Now that Front Matter knows all the content folders. Would you like to import all tags and categories from the available content?", + "dashboard.steps.stepsToGetStarted.showDashboard.name": "Show the dashboard", + "dashboard.steps.stepsToGetStarted.showDashboard.description": "Once all actions are completed, the dashboard can be loaded.", + + "dashboard.taxonomyView.button.add.title": "Add {0} to taxonomy settings", + "dashboard.taxonomyView.button.edit.title": "Edit {0}", + "dashboard.taxonomyView.button.merge.title": "Merge {0}", + "dashboard.taxonomyView.button.move.title": "Move to another taxonomy type", + "dashboard.taxonomyView.button.delete.title": "Delete {0}", + + "dashboard.taxonomyView.taxonomyLookup.button.title": "Show contents with {0} in {1}", + "panel.actions.title": "Actions", "panel.actions.openDashboard": "Open dashboard", "panel.actions.openPreview": "Open preview", diff --git a/src/dashboardWebView/components/SnippetsView/NewForm.tsx b/src/dashboardWebView/components/SnippetsView/NewForm.tsx index 32a41d25..8eaff3e9 100644 --- a/src/dashboardWebView/components/SnippetsView/NewForm.tsx +++ b/src/dashboardWebView/components/SnippetsView/NewForm.tsx @@ -3,6 +3,8 @@ import * as React from 'react'; import { GeneralCommands } from '../../../constants'; import useThemeColors from '../../hooks/useThemeColors'; import { SnippetInput } from './SnippetInput'; +import * as l10n from '@vscode/l10n'; +import { LocalizationKey } from '../../../localization'; export interface INewFormProps { title: string; @@ -39,7 +41,8 @@ export const NewForm: React.FunctionComponent = ({
@@ -56,13 +59,13 @@ export const NewForm: React.FunctionComponent = ({
onDescriptionUpdate(e.currentTarget.value)} />
@@ -70,7 +73,8 @@ export const NewForm: React.FunctionComponent = ({
-
@@ -124,7 +128,9 @@ export const Snippets: React.FunctionComponent = (
{viewData?.data?.filePath && (
-

Select the snippet to add to your content.

+

+ {l10n.t(LocalizationKey.dashboardSnippetsViewSnippetsSelectDescription)} +

)} @@ -142,14 +148,16 @@ export const Snippets: React.FunctionComponent = (
-

No snippets found

+

+ {l10n.t(LocalizationKey.dashboardSnippetsViewSnippetsEmptyMessage)} +

- Read more to get started with snippets + {l10n.t(LocalizationKey.dashboardSnippetsViewSnippetsReadMore)}

@@ -158,13 +166,13 @@ export const Snippets: React.FunctionComponent = ( {showCreateDialog && ( addFolder(folder)} className={`mr-2 flex gap-2 items-center ${getColors('hover:text-teal-500', 'hover:text-[var(--vscode-textLink-activeForeground)]')}`} - title={`Add as a content folder to Front Matter`} + title={l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedButtonAddFolderTitle)} > {isAdded ? ( @@ -94,13 +96,8 @@ export const StepsToGetStarted: React.FunctionComponent const steps = [ { id: `welcome-init`, - name: 'Initialize project', - description: ( - <> - Initialize the project will create the required files and folders for using the Front - Matter CMS. Start by clicking on this action. - - ), + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedInitializeProjectName), + description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedInitializeProjectDescription)}, status: settings.initialized ? Status.Completed : Status.NotStarted, onClick: settings.initialized ? undefined @@ -110,11 +107,11 @@ export const StepsToGetStarted: React.FunctionComponent }, { id: `welcome-framework`, - name: 'Framework presets', + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkName), description: (
- Select your site-generator or framework to prefill some of the recommended settings. + {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkDescription)}
@@ -124,7 +121,7 @@ export const StepsToGetStarted: React.FunctionComponent 'text-[var(--vscode-tab-inactiveForeground)] hover:text-[var(--vscode-tab-activeForeground)]' ) }`}> - {framework ? framework : 'Select your framework'} + {framework ? framework : l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkSelect)} >
setFrameworkAndSendMessage(value)} @@ -172,17 +169,16 @@ export const StepsToGetStarted: React.FunctionComponent }, { id: `welcome-content-folders`, - name: 'Register content folder(s)', + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersName), description: ( <>

- Add one of the folders we found in your project as a content folder. Once a folder is - set, Front Matter can be used to list all contents and allow you to create content. + {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersDescription)}

{settings?.dashboardState?.welcome?.contentFolders?.length > 0 && (
-
Folders containing content:
+
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersLabel)}
{settings?.dashboardState?.welcome?.contentFolders?.map((folder: string) => ( )}

- IMPORTANT: You can perform this action by{' '} - right-clicking on the folder in the explorer view, and selecting{' '} - register folder. + {l10n.t(LocalizationKey.commonInformation)}: {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersInformationDescription)}.

), @@ -211,21 +205,16 @@ export const StepsToGetStarted: React.FunctionComponent }, { id: `welcome-import`, - name: 'Import all tags and categories (optional)', - description: ( - <> - Now that Front Matter knows all the content folders. Would you like to import all tags and - categories from the available content? - - ), + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTagsName), + description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTagsDescription)}, status: taxImported ? Status.Completed : Status.NotStarted, onClick: settings.contentFolders && settings.contentFolders.length > 0 ? importTaxonomy : undefined }, { id: `welcome-show-dashboard`, - name: 'Show the dashboard', - description: <>Once all actions are completed, the dashboard can be loaded., + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedShowDashboardName), + description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedShowDashboardDescription)}, status: settings.initialized && settings.contentFolders && settings.contentFolders.length > 0 ? Status.Active diff --git a/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx b/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx index 5abc5092..f37de8fa 100644 --- a/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx +++ b/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx @@ -10,6 +10,8 @@ import { useCallback } from 'react'; import { MergeIcon } from '../../../components/icons/MergeIcon'; import { DashboardMessage } from '../../DashboardMessage'; import { LinkButton } from '../Common/LinkButton'; +import * as l10n from '@vscode/l10n'; +import { LocalizationKey } from '../../../localization'; export interface ITaxonomyActionsProps { field: string | null; @@ -61,39 +63,47 @@ export const TaxonomyActions: React.FunctionComponent = (
{unmapped && ( - Add to settings + + {l10n.t(LocalizationKey.dashboardTaxonomyViewButtonAddTitle, value)} + )} - Edit + {l10n.t(LocalizationKey.commonEdit)} - Merge + + {l10n.t(LocalizationKey.dashboardTaxonomyViewButtonMergeTitle, value)} + - Move to another taxonomy type + + {l10n.t(LocalizationKey.dashboardTaxonomyViewButtonMoveTitle)} + - Delete + + {l10n.t(LocalizationKey.dashboardTaxonomyViewButtonDeleteTitle, value)} +
); diff --git a/src/dashboardWebView/components/TaxonomyView/TaxonomyLookup.tsx b/src/dashboardWebView/components/TaxonomyView/TaxonomyLookup.tsx index b6e5af88..5cdf1d69 100644 --- a/src/dashboardWebView/components/TaxonomyView/TaxonomyLookup.tsx +++ b/src/dashboardWebView/components/TaxonomyView/TaxonomyLookup.tsx @@ -7,6 +7,8 @@ import { getTaxonomyField } from '../../../helpers/getTaxonomyField'; import { useNavigate } from 'react-router-dom'; import { routePaths } from '../..'; import useThemeColors from '../../hooks/useThemeColors'; +import * as l10n from '@vscode/l10n'; +import { LocalizationKey } from '../../../localization'; export interface ITaxonomyLookupProps { taxonomy: string | null; @@ -57,7 +59,7 @@ export const TaxonomyLookup: React.FunctionComponent = ({ return (