diff --git a/plugin/commands.ts b/plugin/commands.ts index b8d16c37..3cd4fb45 100644 --- a/plugin/commands.ts +++ b/plugin/commands.ts @@ -6,7 +6,7 @@ import {GithubBranch} from "./publishing/branch"; import { Octokit } from "@octokit/core"; import {MetadataCache, Notice, TFile, Vault} from "obsidian"; import GithubPublisher from "./main"; -import t from './i18n' +import {error, informations} from './i18n' import { StringFunc } from "./i18n"; @@ -43,7 +43,7 @@ export async function shareAllMarkedNotes(PublisherManager: GithubBranch, settin } catch { errorCount++; new Notice( - (t("unablePublishNote") as StringFunc)(sharedFiles[files].name) + (error("unablePublishNote") as StringFunc)(sharedFiles[files].name) ); } } @@ -54,13 +54,13 @@ export async function shareAllMarkedNotes(PublisherManager: GithubBranch, settin if (update) { await noticeMessage(PublisherManager, noticeValue, settings, repoFrontmatter); } else { - new Notice((t("errorPublish") as StringFunc)(settings.githubRepo)); + new Notice((error("errorPublish") as StringFunc)(settings.githubRepo)); } } } catch (error) { console.error(error); new Notice( - t("unablePublishMultiNotes") as string + error("unablePublishMultiNotes") as string ); statusBar.error(); } @@ -75,7 +75,7 @@ export async function deleteUnsharedDeletedNotes(PublisherManager: GithubBranch, * @param branchName */ try { - new Notice((t("startingClean") as StringFunc)(settings.githubRepo)) + new Notice((informations("startingClean") as StringFunc)(settings.githubRepo)) await PublisherManager.newBranch(branchName, repoFrontmatter); await deleteFromGithub(false, settings,octokit, branchName, PublisherManager, repoFrontmatter); await PublisherManager.updateRepository(branchName, repoFrontmatter); @@ -104,14 +104,14 @@ export async function shareOneNote(branchName: string, PublisherManager: GithubB await noticeMessage(PublisherManager, file, settings, repoFrontmatter); await createLink(file, repoFrontmatter, metadataCache, vault, settings); } else { - new Notice((t("errorPublish") as StringFunc)(settings.githubRepo)); + new Notice((error("errorPublish") as StringFunc)(settings.githubRepo)); } } } catch (error) { if (!(error instanceof DOMException)) { console.error(error); - new Notice((t("errorPublish") as StringFunc)(settings.githubRepo)); + new Notice((error("errorPublish") as StringFunc)(settings.githubRepo)); } } } @@ -126,18 +126,18 @@ export async function shareNewNote(PublisherManager: GithubBranch, octokit: Octo * @class plugin */ const settings = plugin.settings; - new Notice(t("scanningRepo") as string); + new Notice(informations("scanningRepo") as string); const branchMaster = settings.githubBranch; const sharedFilesWithPaths = PublisherManager.getAllFileWithPath(); const githubSharedNotes = await PublisherManager.getAllFileFromRepo(branchMaster, octokit, settings, repoFrontmatter); const newlySharedNotes = PublisherManager.getNewFiles(sharedFilesWithPaths, githubSharedNotes, vault); if (newlySharedNotes.length > 0) { - new Notice((t("foundNoteToSend") as StringFunc)(`${newlySharedNotes.length}`)); + new Notice((informations("foundNoteToSend") as StringFunc)(`${newlySharedNotes.length}`)); const statusBarElement = plugin.addStatusBarItem(); await PublisherManager.newBranch(branchName, repoFrontmatter); await shareAllMarkedNotes(PublisherManager, plugin.settings, octokit, statusBarElement, branchName, repoFrontmatter, newlySharedNotes); } else { - new Notice(t("noNewNote") as string); + new Notice(informations("noNewNote") as string); } } @@ -152,19 +152,19 @@ export async function shareAllEditedNotes(PublisherManager: GithubBranch, octoki * @class plugin */ const settings = plugin.settings; - new Notice(t("scanningRepo") as string); + new Notice(informations("scanningRepo") as string); const branchMaster = settings.githubBranch; const sharedFilesWithPaths = PublisherManager.getAllFileWithPath(); const githubSharedNotes = await PublisherManager.getAllFileFromRepo(branchMaster, octokit, settings, repoFrontmatter); const newSharedFiles = PublisherManager.getNewFiles(sharedFilesWithPaths, githubSharedNotes, vault); const newlySharedNotes = await PublisherManager.getEditedFiles(sharedFilesWithPaths, githubSharedNotes, vault, newSharedFiles); if (newlySharedNotes.length > 0) { - new Notice((t("foundNoteToSend") as StringFunc)(`${newlySharedNotes.length}`)); + new Notice((informations("foundNoteToSend") as StringFunc)(`${newlySharedNotes.length}`)); const statusBarElement = plugin.addStatusBarItem(); await PublisherManager.newBranch(branchName, repoFrontmatter); await shareAllMarkedNotes(PublisherManager, settings, octokit, statusBarElement, branchName, repoFrontmatter, newlySharedNotes); } else { - new Notice(t("noNewNote") as string); + new Notice(informations("noNewNote") as string); } } @@ -178,18 +178,18 @@ export async function shareOnlyEdited(PublisherManager: GithubBranch, octokit: O * @class plugin */ const settings = plugin.settings; - new Notice(t("scanningRepo") as string); + new Notice(informations("scanningRepo") as string); const branchMaster = settings.githubBranch; const sharedFilesWithPaths = PublisherManager.getAllFileWithPath(); const githubSharedNotes = await PublisherManager.getAllFileFromRepo(branchMaster, octokit, settings, repoFrontmatter); const newSharedFiles:TFile[]=[] const newlySharedNotes = await PublisherManager.getEditedFiles(sharedFilesWithPaths, githubSharedNotes, vault, newSharedFiles); if (newlySharedNotes.length > 0) { - new Notice((t("foundNoteToSend") as StringFunc)(`${newlySharedNotes.length}`)); + new Notice((informations("foundNoteToSend") as StringFunc)(`${newlySharedNotes.length}`)); const statusBarElement = plugin.addStatusBarItem(); await PublisherManager.newBranch(branchName, repoFrontmatter); await shareAllMarkedNotes(PublisherManager, settings, octokit, statusBarElement, branchName, repoFrontmatter, newlySharedNotes); } else { - new Notice(t("noNewNote") as string); + new Notice(informations("noNewNote") as string); } } diff --git a/plugin/i18n/index.ts b/plugin/i18n/index.ts index 24f22095..090c4211 100644 --- a/plugin/i18n/index.ts +++ b/plugin/i18n/index.ts @@ -24,16 +24,16 @@ */ import { moment } from 'obsidian'; -import enUS from './locales/en-us'; -import zhCN from './locales/zh-cn'; -import frFR from "./locales/fr-fr"; -import ruRU from "./locales/ru"; - -const localeMap: { [k: string]: Partial } = { - enUS, - 'zh-cn': zhCN, - 'fr': frFR, - 'ru': ruRU +import en from './locales/en'; +import fr from './locales/fr'; +import ru from './locales/ru'; +import cn from './locales/zh-cn'; + +const localeMap: { [k: string]: Partial } = { + en: en, + fr: fr, + ru: ru, + 'zh-cn': cn, }; const locale = localeMap[moment.locale()]; @@ -42,6 +42,29 @@ export interface StringFunc { (params: string|string[]): string; } -export default function t(str: keyof typeof enUS): string | StringFunc { - return (locale && locale[str]) || enUS[str]; +// export value from en locale into string map +export function error(str: string): string | StringFunc{ + // @ts-ignore + return (locale && locale.error[str]) || en.error[str]; +} + +export function commands(key: string): string | StringFunc{ + // @ts-ignore + return (locale && locale.commands[key]) || en.commands[key]; +} + +export function deletion(key: string): string | StringFunc{ + // @ts-ignore + return (locale && locale.deletion[key]) || en.deletion[key]; } + +export function settings(type:string, msg: string): string | StringFunc{ + // @ts-ignore + return (locale && locale.settings[type][msg]) || en.settings[type][msg]; +} + +export function informations(key: string): string | StringFunc{ + // @ts-ignore + return (locale && locale.informations[key]) || en.informations[key]; +} + diff --git a/plugin/i18n/locales/en-us.ts b/plugin/i18n/locales/en-us.ts deleted file mode 100644 index 68a94f3e..00000000 --- a/plugin/i18n/locales/en-us.ts +++ /dev/null @@ -1,148 +0,0 @@ -export default { - /* ------------ * - * Commands * - * ------------ */ - shareActiveFile: "Share active file", - publisherDeleteClean: "Remove unshared and deleted file in repository", - uploadAllNotes: "Upload all shared notes", - uploadNewNotes: "Upload new shared notes", - uploadAllNewEditedNote: "Upload all new and edited note since last upload", - uploadAllEditedNote: "Upload all edited note since last upload", - shareViewFiles:(viewFile:string): string => `Share "${viewFile}" with Github Publisher`, - /* ------ Delete string ----- */ - errorDeleteDefaultFolder: "You need a default folder name in the settings to use this command.", - errorDeleteRootFolder: 'You need to configure a root folder in the settings to use this command.', - successDeleting:(nb:string): string => `Successfully deleted ${nb} files.`, - failedDeleting:(nb:string): string => `Failed to delete ${nb} files.`, - noFileDeleted: 'No files have been deleted.', - - /* ------------ * - * Settings * - * ------------ */ - githubConfiguration: "Github Configuration", - repoName: "Repo Name", - repoNameDesc: "The name of the repository where you store your blog.", - mkdocsTemplate: "mkdocs-template", - githubUsername: "Github Username", - githubUsernameDesc: "Your github username.", - ghTokenDesc: "A github token with repository permission. You can generate it ", - here: "here.", - githubToken: "Github Token", - githubBranchHeading: "Main branch", - githubBranchDesc: 'If you use a different main branch than "main", you can specify it here.', - automaticallyMergePR: "Automatically merge pull requests", - - // --- - // # Upload configuration # // - uploadConfig: "Upload configuration", - pathSetting: "Path settings", - folderBehavior: "Folder behavior", - folderBehaviorDesc: "Choose between a fixed folder, the value of a frontmatter key or your obsidian relative path.", - fixedFolder: "Fixed Folder", - yaml: "YAML frontmatter", - obsidianPath: "Obsidian Path", - defaultFolder: "Default Folder", - defaultFolderDesc: "Set the default reception folder", - defaultFolderPlaceholder: "docs", - pathRemoving: "Path removing", - pathRemovingDesc: "Allow to publish only subfolder by removing the path before that :", - pathRemovingPlaceholder: "GardenSketch", - frontmatterKey: "Frontmatter key", - frontmatterKeyDesc: "Set the key where to get the value of the folder", - frontmatterKeyPlaceholder: "category", - rootFolder: "Root folder", - rootFolderDesc: "Append this path to the folder set by the frontmatter key.", - useFrontmatterTitle: "Set the title from the frontmatter", - useFrontmatterTitleDesc: "Use a frontmatter value to generate the filename. By default, \"title\" is used.", - - // --- - // # Text conversion # // - textConversion: "Content's conversion", - textConversionDesc:'Theses option won\'t change the content of the file in your Obsidian Vault, but will change the content of the file in Github.', - textHeader: "Text", - linkHeader: "Links", - folderNote: "Folder note", - folderNoteDesc: "Rename files to \"index.md\" if it has the same name as their parent folder/category (also works if the note is out of the folder).", - internalsLinks: "Internals Links", - internalsLinksDesc: "Convert the internal link in shared file to match the folder settings", - linkDesc: 'You can prevent links to be converted and keep the alt text (or filename) by using the frontmatter key "links" with the value "false".', - wikilinks: "Wikilinks", - wikilinksDesc: "Convert Wikilinks to MDlinks, without changing the contents. This option can be overridden by the frontmatter key \"mdlinks\".", - hardBreakTitle: "Markdown hard line break", - hardBreakDesc: "Add a markdown hard line break (double whitespace) after each line. This settings can be overridden by the frontmatter key \"hardbreak\".", - headerDataview: "Dataview", - headerDataviewDesc: "Convert dataview to markdown. This settings can be overridden by the frontmatter key \"dataview\".", - censorTextHeader: "Text replacer", - censorTextDesc: "Replace text (or regex) in the file with the given value.", - censorTextInsensitive: "Case insensitive", - censorTextEmpty: 'Replacement can be empty to remove the whole string.', - censorToolTipAdd: 'Add a new text replacer', - censorToolTipRemove: 'Delete this text replacer', - censorPlaceHolder: 'Regex or text to replace', - censorValuePlaceHolder: 'Replacement value', - censorBefore: 'Run it before the other plugin conversion (link, dataview, etc.)', - censorAfter: 'Run it after the other plugin conversion (link, dataview, etc.)', - inlineTagsHeader: 'Inline tags', - inlineTagsDesc: 'Add your inline tags in your frontmatter tags field and converting nested tags with replacing "/" with "_"', - dataviewFieldHeader: 'Convert frontmatter/dataview field to tags', - dataviewFieldDesc: 'This will convert any frontmatter or dataview inline field into frontmatter tags. Separate fields with a comma.', - dataviewExcludeHeader: 'Exclude value from conversion', - dataviewExcludeDesc: 'This will exclude value from being converted. Separate fields with a comma.', - // --- - // # Embed # // - embed: "Embed", - transferImage: "Transfer attachments", - transferImageDesc: "Send attachments embedded in a file to github. This option can be overridden by the frontmatter key \"attachment\".", - transferEmbeddedNotes: "Transfer embedded notes", - transferEmbeddedNotesDesc: "Send embedded notes in a shared file to github. Only shared files will be send! This option can be overridden by the frontmatter key \"embed\".", - defaultImageFolder: "Default attachment folder", - defaultImageFolderDesc: "To use a folder different from default", - transferMetaFile: "Send files using a metadata field", - transferMetaFileDesc: 'Set the names of the metadata field you want to use to send files. Separate fields with a comma. Dataview inline field are supported.', - // --- - // # Github Workflow # // - githubActionName: "Github action name", - githubActionNameDesc: "If you want to activate a github action when the plugin push the file, set the name of the file (in your .github/worfklows folder).", - autoCleanUp: "Auto clean up", - autoCleanUpDesc: "If the plugin must remove from github the removed files (stop share or deleted)", - excludedFiles: "Excluded files", - excludedFilesDesc: "If you want to exclude some folder from the auto clean up, set their path.", - - // --- - // # Plugin settings # // - pluginSettings: "Plugin Settings", - shareKey: "Share Key", - shareKeyDesc: "The frontmatter key to publish your file on the website.", - excludedFolder: "Excluded Folder", - excludedFolderDesc: "Never publish file in these folder, regardless of the share key. Separate folder name by comma.", - fileMenu: "File Menu", - fileMenuDesc: "Add an sharing commands in the file menu", - editorMenu: "Editor Menu", - editorMenuDesc: "Add a sharing commands in the right-click menu", - copylinkSetting: "Copy link", - copylinkDesc: "Send a link to your note in your clipboard", - baselink: "Blog link", - baselinkDesc: "Create the clipboard link with this base. By default : https://username.github.io/repo/", - linkpathremover: "Remove link part", - linkpathremoverDesc: "Remove this part from the created links. Separate by comma if multiple value must be removed.", - logNoticeHeader: 'Notice every error', - logNoticeDesc: 'On mobile, it can be hard to debug the plugin. Enable this option to log every error in a Notice.', - shareExternalModifiedTitle: "Share external modified file", - shareExternalModifiedDesc: "Send edited file if they are different from the active file. Useful when editing metadata using MetaEdit or Metadata Menu.", - - /* ------------ * - * Notice * - * ------------ */ - unablePublishNote: (fileInfo: string): string => `Unable to publish note ${fileInfo},skipping it`, - errorPublish: (repoInfo: string): string => `Error publishing to ${repoInfo}.`, - unablePublishMultiNotes: "Unable to publish multiple notes, something went wrong.", - startingClean: (repoInfo: string): string => `Starting cleaning ${repoInfo}`, - scanningRepo: "Scanning the repository, may take a while...", - foundNoteToSend: (noteLength: string)=> `Found ${noteLength} new notes to send`, - noNewNote: "No new notes to share.", - successfullPublish:(noticeValue: string[])=>`Successfully published ${noticeValue[0]} to ${noticeValue[1]}.`, - waitingWorkflow: "Now, waiting for the workflow to be completed...", - sendMessage:(noticeValue: string[])=>`Send ${noticeValue[0]} to ${noticeValue[1]}${noticeValue[2]}`, - mergeconflic: `Pull-request is not mergeable, you need to do it manually.`, - errorConfig: (repoInfo: string): string => `Error configuring ${repoInfo}. Please check your settings.`, -} diff --git a/plugin/i18n/locales/en.ts b/plugin/i18n/locales/en.ts new file mode 100644 index 00000000..451fc95a --- /dev/null +++ b/plugin/i18n/locales/en.ts @@ -0,0 +1,145 @@ +export default { + commands : { + shareActiveFile: "Share active file", + publisherDeleteClean: "Remove unshared and deleted file in repository", + uploadAllNotes: "Upload all shared notes", + uploadNewNotes: "Upload new shared notes", + uploadAllNewEditedNote: "Upload all new and edited note since last upload", + uploadAllEditedNote: "Upload all edited note since last upload", + shareViewFiles:(viewFile:string): string => `Share "${viewFile}" with Github Publisher`, + }, + deletion: { + errorDeleteDefaultFolder: "You need a default folder name in the settings to use this command.", + errorDeleteRootFolder: 'You need to configure a root folder in the settings to use this command.', + successDeleting:(nb:string): string => `Successfully deleted ${nb} files.`, + failedDeleting:(nb:string): string => `Failed to delete ${nb} files.`, + noFileDeleted: 'No files have been deleted.', + }, + settings: { + github: { + githubConfiguration: "Github Configuration", + repoName: "Repo Name", + repoNameDesc: "The name of the repository where you store your blog.", + mkdocsTemplate: "mkdocs-template", + githubUsername: "Github Username", + githubUsernameDesc: "Your github username.", + ghTokenDesc: "A github token with repository permission. You can generate it ", + here: "here.", + githubToken: "Github Token", + githubBranchHeading: "Main branch", + githubBranchDesc: 'If you use a different main branch than "main", you can specify it here.', + automaticallyMergePR: "Automatically merge pull requests", + }, + uploadConfig: { + uploadConfig: "Upload configuration", + pathSetting: "Path settings", + folderBehavior: "Folder behavior", + folderBehaviorDesc: "Choose between a fixed folder, the value of a frontmatter key or your obsidian relative path.", + fixedFolder: "Fixed Folder", + yaml: "YAML frontmatter", + obsidianPath: "Obsidian Path", + defaultFolder: "Default Folder", + defaultFolderDesc: "Set the default reception folder", + defaultFolderPlaceholder: "docs", + pathRemoving: "Path removing", + pathRemovingDesc: "Allow to publish only subfolder by removing the path before that :", + pathRemovingPlaceholder: "GardenSketch", + frontmatterKey: "Frontmatter key", + frontmatterKeyDesc: "Set the key where to get the value of the folder", + frontmatterKeyPlaceholder: "category", + rootFolder: "Root folder", + rootFolderDesc: "Append this path to the folder set by the frontmatter key.", + useFrontmatterTitle: "Set the title from the frontmatter", + useFrontmatterTitleDesc: "Use a frontmatter value to generate the filename. By default, \"title\" is used.", + }, + textConversion:{ + textConversion: "Content's conversion", + textConversionDesc:'Theses option won\'t change the content of the file in your Obsidian Vault, but will change the content of the file in Github.', + textHeader: "Text", + linkHeader: "Links", + folderNote: "Folder note", + folderNoteDesc: "Rename files to \"index.md\" if it has the same name as their parent folder/category (also works if the note is out of the folder).", + internalsLinks: "Internals Links", + internalsLinksDesc: "Convert the internal link in shared file to match the folder settings", + linkDesc: 'You can prevent links to be converted and keep the alt text (or filename) by using the frontmatter key "links" with the value "false".', + wikilinks: "Wikilinks", + wikilinksDesc: "Convert Wikilinks to MDlinks, without changing the contents. This option can be overridden by the frontmatter key \"mdlinks\".", + hardBreakTitle: "Markdown hard line break", + hardBreakDesc: "Add a markdown hard line break (double whitespace) after each line. This settings can be overridden by the frontmatter key \"hardbreak\".", + headerDataview: "Dataview", + headerDataviewDesc: "Convert dataview to markdown. This settings can be overridden by the frontmatter key \"dataview\".", + censorTextHeader: "Text replacer", + censorTextDesc: "Replace text (or regex) in the file with the given value.", + censorTextInsensitive: "Case insensitive", + censorTextEmpty: 'Replacement can be empty to remove the whole string.', + censorToolTipAdd: 'Add a new text replacer', + censorToolTipRemove: 'Delete this text replacer', + censorPlaceHolder: 'Regex or text to replace', + censorValuePlaceHolder: 'Replacement value', + censorBefore: 'Run it before the other plugin conversion (link, dataview, etc.)', + censorAfter: 'Run it after the other plugin conversion (link, dataview, etc.)', + inlineTagsHeader: 'Inline tags', + inlineTagsDesc: 'Add your inline tags in your frontmatter tags field and converting nested tags with replacing "/" with "_"', + dataviewFieldHeader: 'Convert frontmatter/dataview field to tags', + dataviewFieldDesc: 'This will convert any frontmatter or dataview inline field into frontmatter tags. Separate fields with a comma.', + dataviewExcludeHeader: 'Exclude value from conversion', + dataviewExcludeDesc: 'This will exclude value from being converted. Separate fields with a comma.', + }, + embed : { + embed: "Embed", + transferImage: "Transfer attachments", + transferImageDesc: "Send attachments embedded in a file to github. This option can be overridden by the frontmatter key \"attachment\".", + transferEmbeddedNotes: "Transfer embedded notes", + transferEmbeddedNotesDesc: "Send embedded notes in a shared file to github. Only shared files will be send! This option can be overridden by the frontmatter key \"embed\".", + defaultImageFolder: "Default attachment folder", + defaultImageFolderDesc: "To use a folder different from default", + transferMetaFile: "Send files using a metadata field", + transferMetaFileDesc: 'Set the names of the metadata field you want to use to send files. Separate fields with a comma. Dataview inline field are supported.', + }, + githubWorkflow: { + githubActionName: "Github action name", + githubActionNameDesc: "If you want to activate a github action when the plugin push the file, set the name of the file (in your .github/worfklows folder).", + autoCleanUp: "Auto clean up", + autoCleanUpDesc: "If the plugin must remove from github the removed files (stop share or deleted)", + excludedFiles: "Excluded files", + excludedFilesDesc: "If you want to exclude some folder from the auto clean up, set their path.", + }, + plugin: { + pluginSettings: "Plugin Settings", + shareKey: "Share Key", + shareKeyDesc: "The frontmatter key to publish your file on the website.", + excludedFolder: "Excluded Folder", + excludedFolderDesc: "Never publish file in these folder, regardless of the share key. Separate folder name by comma.", + fileMenu: "File Menu", + fileMenuDesc: "Add an sharing commands in the file menu", + editorMenu: "Editor Menu", + editorMenuDesc: "Add a sharing commands in the right-click menu", + copylinkSetting: "Copy link", + copylinkDesc: "Send a link to your note in your clipboard", + baselink: "Blog link", + baselinkDesc: "Create the clipboard link with this base. By default : https://username.github.io/repo/", + linkpathremover: "Remove link part", + linkpathremoverDesc: "Remove this part from the created links. Separate by comma if multiple value must be removed.", + logNoticeHeader: 'Notice every error', + logNoticeDesc: 'On mobile, it can be hard to debug the plugin. Enable this option to log every error in a Notice.', + shareExternalModifiedTitle: "Share external modified file", + shareExternalModifiedDesc: "Send edited file if they are different from the active file. Useful when editing metadata using MetaEdit or Metadata Menu." + } + }, + informations: { + startingClean: (repoInfo: string): string => `Starting cleaning ${repoInfo}`, + scanningRepo: "Scanning the repository, may take a while...", + foundNoteToSend: (noteLength: string)=> `Found ${noteLength} new notes to send`, + noNewNote: "No new notes to share.", + successfullPublish:(noticeValue: string[])=>`Successfully published ${noticeValue[0]} to ${noticeValue[1]}.`, + waitingWorkflow: "Now, waiting for the workflow to be completed...", + sendMessage:(noticeValue: string[])=>`Send ${noticeValue[0]} to ${noticeValue[1]}${noticeValue[2]}`, + }, + error:{ + unablePublishNote: (fileInfo: string): string => `Unable to publish note ${fileInfo},skipping it`, + errorPublish: (repoInfo: string): string => `Error publishing to ${repoInfo}.`, + unablePublishMultiNotes: "Unable to publish multiple notes, something went wrong.", + mergeconflic: `Pull-request is not mergeable, you need to do it manually.`, + errorConfig: (repoInfo: string): string => `Error configuring ${repoInfo}. Please check your settings.`, + } +} diff --git a/plugin/i18n/locales/fr-fr.ts b/plugin/i18n/locales/fr-fr.ts deleted file mode 100644 index 3c08ba38..00000000 --- a/plugin/i18n/locales/fr-fr.ts +++ /dev/null @@ -1,152 +0,0 @@ -export default { - /* ------------ * - * Commands * - * ------------ */ - shareActiveFile: "Partager le fichier actif", - publisherDeleteClean: "Suppression des fichiers non partagés et/ou supprimé du dépôt ", - uploadAllNotes: "Publier toutes les notes partagées", - uploadNewNotes: "Publier les nouvelles notes", - uploadAllNewEditedNote: "Publier toutes les notes nouvelles et modifiées depuis le dernier envoi.", - uploadAllEditedNote: "Publier toutes les notes éditées depuis le dernier envoie", - shareViewFiles:(viewFile:string): string => `Partager "${viewFile}" avec Github Publisher`, - /* ------ Delete string ----- */ - errorDeleteDefaultFolder: "Vous avez besoin d'un dossier par défaut dans les paramètres pour utiliser cette commande.", - errorDeleteRootFolder: 'Vous devez configurer un dossier racine dans les paramètres pour utiliser cette commande.', - successDeleting:(nb:string): string => `Suppression réussie de ${nb} fichiers.`, - failedDeleting:(nb:string): string => `Échec de la suppression de ${nb} files.`, - noFileDeleted: "Aucun fichier n'a été supprimé", - /* ------------ * - * Settings * - * ------------ */ - - githubConfiguration: "Configuration GitHub", - repoName: "Nom du dépôt", - repoNameDesc: "Le nom du dépôt dans lequel vous enregistrez votre blog.", - mkdocsTemplate: "mkdocs-template", - githubUsername: "Nom d'utilisateur GitHub", - githubUsernameDesc: "Votre nom d'utilisateur GitHub.", - ghTokenDesc: "Un token GitHub avec autorisation de dépôt. Vous pouvez le générer ", - here: "ici.", - githubToken: "Token GitHub", - githubBranchHeading: "Branche principale", - githubBranchDesc: "Si vous utilisez une branche principale différente de main, vous pouvez la spécifier ici.", - automaticallyMergePR: "Fusionner automatiquement les pull requests", - // --- - // # Upload configuration # // - - uploadConfig: "Configuration d'upload", //désolée du franglais ici mais je trouve pas de traduction propre - pathSetting: "Paramètres du chemin d'accès", - folderBehavior: "Comportement du dossier", - folderBehaviorDesc: "Choisissez entre un dossier fixe, la valeur d'une clé de métadonnée ou votre chemin relatif dans Obsidian.", - fixedFolder: "Dossier fixé", - yaml: "Clé de métadonnée", - obsidianPath: "Chemin Obsidian", - defaultFolder: "Dossier par défaut", - defaultFolderDesc: "Définir le dossier de réception par défaut.", - defaultFolderPlaceholder: "docs", - pathRemoving: "Suppression de chemin", - pathRemovingDesc: "Permettre de publier uniquement le sous-dossier en supprimant le chemin avant celui-ci :", - pathRemovingPlaceholder: "Blog", - frontmatterKey: "Clé de métadonnées", - frontmatterKeyDesc: "Définir la clé où obtenir la valeur du dossier.", - frontmatterKeyPlaceholder: "catégorie", - rootFolder: "Dossier racine", - rootFolderDesc: "Ajoutez ce chemin au dossier défini par la clé de métadonnées.", - useFrontmatterTitle: "Utiliser une clé de métadonnées pour le titre", - useFrontmatterTitleDesc: "Utilisez un champ du frontmatter pour générer le nom du fichier. Par défaut \"title\" est utilisé.", - // --- - // # Text conversions # // - textConversion: "Conversion du contenu", - textConversionDesc:'Ces options ne changent pas le contenu du fichier dans votre coffre Obsidian, mais changeront le contenu du fichier publié sur GitHub.', - textHeader: "Texte", - linkHeader: "Liens", - folderNote: "Folder Note", - folderNoteDesc: "Renommer les fichiers en \"index.md\" s'il porte le même nom que leur dossier/catégorie parent (fonctionne aussi si la note est à l'extérieur du dossier).", - internalsLinks: "Liens internes", - internalsLinksDesc: "Convertir le lien interne dans le fichier partagé pour qu'il corresponde aux paramètres du dossier.", - linkDesc: 'Vous pouvez empêcher la conversion des liens et conserver le texte alt (ou le nom du fichier) en utilisant la clé frontmatter "links" avec la valeur "false".', - wikilinks: "Wikilinks", - wikilinksDesc: "Convertir les liens Wikilinks en liens markdown, sans en modifier le contenu. Ce paramètre peut être outrepassé par la clé de métadonnées \"mdlinks\".", - hardBreakTitle: "Saut de ligne strict", - hardBreakDesc: "Ajoutez un retour à la ligne Markdown (double espace) après chaque ligne. Ce paramètre peut être outrepassé par la clé de métadonnées \"hardbreak\".", - headerDataview: "Dataview", - headerDataviewDesc: "Convertir dataview en markdown. Ce paramètre peut être outrepassé par la clé de métadonnées \"dataview\".", - - censorTextHeader: "Replacement de texte", - censorTextDesc: "Replacement de texte (ou regex) par un autre texte.", - censorTextInsensitive: "Insensible à la casse.", - censorTextEmpty: 'Le remplacement de texte peut être vide afin de supprimer le texte.', - censorToolTipAdd: 'Ajouter un nouveau remplacement', - censorToolTipRemove: 'Supprimer ce remplacement', - censorPlaceHolder: 'Regex ou text à remplacer', - censorValuePlaceHolder: 'Remplacement', - censorBefore: 'Exécuté avant les autres conversions (liens, dataview, etc.)', - censorAfter: 'Exécuté après les autres conversions (liens, dataview, etc.)', - - - inlineTagsHeader: 'Inlines tags', - inlineTagsDesc: 'Ajoute vos tags inline dans votre bloc de métadonnée et convertit les tags imbriqués en remplaçant "/" par "_".', - dataviewFieldHeader: 'Conversion des champs du frontmatter/dataview en tags', - dataviewFieldDesc: 'Ceci convertira tous les champs du frontmatter/dataview en tags. Séparez les champs par une virgule.', - dataviewExcludeHeader: 'Exclure des valeurs de la conversion', - dataviewExcludeDesc: 'Exclure la valeur de la conversion. Séparez les valeurs par une virgule.', - // --- - // # Embed # // - - embed: "Transclusion", - transferImage: "Transférer les pièces jointes", - transferImageDesc: "Envoyer les pièces-jointes intégrées dans un fichier dans le dépôt. Ce paramètre peut être outrepassé par la clé de métadonnées \"attachment\".", - transferEmbeddedNotes: "Transférer les notes transclues", - transferEmbeddedNotesDesc: "Envoyez des notes transcluent dans un fichier partagé dans le dépôt. Seuls les fichiers partagés seront envoyés ! Ce paramètre peut être outrepassé par la clé de métadonnées \"embed\".", - defaultImageFolder: "Dossier de pièces-jointes par défaut", - defaultImageFolderDesc: "Pour utiliser un dossier différent de celui par défaut pour les pièces-jointes.", - transferMetaFile: "Envoyer des fichiers en utilisant une clé de métadonnée", - transferMetaFileDesc: 'Mettez les noms des champs de métadonnées que vous voulez utiliser pour envoyer les fichiers. Séparez les champs par une virgule. Les champs Dataview sont pris en charge.', - // --- - // # Github Workflow # // - - githubActionName: "Nom de l'action GitHub", - githubActionNameDesc: "Si vous souhaitez activer une action github lorsque le plugin push le fichier, indiquez le nom du fichier (dans votre dossier \".github/worfklows\").", - autoCleanUp: "Auto-nettoyage", - autoCleanUpDesc: "Si le plugin doit retirer de votre dépôt les fichiers supprimés (arrêt de partage ou supprimé).", - excludedFiles: "Fichier exclus", - excludedFilesDesc: "Si vous voulez exclure certains dossiers du nettoyage automatique, définissez leur chemin.", - - // --- - // # Plugin settings # // - pluginSettings: "Paramètres du plugin", - shareKey: "Clé de partage", - shareKeyDesc: "La clé de métadonnées pour publier votre fichier sur le dépôt.", - excludedFolder: "Dossier exclus", - excludedFolderDesc: "Les fichiers dans ses dossiers ne seront jamais publiés, quelle que soit l'état de la clé de partage. Séparez les noms de dossier par une virgule.", - fileMenu: "Menu \"Fichier\"", - fileMenuDesc: "Ajouter une commande de partage dans le menu \"Fichier\"", - editorMenu: "Menu \"Edition\"", - editorMenuDesc: "Ajouter une commande de partage dans le menu du clic droit.", - copylinkSetting: "Copie de lien.", - copylinkDesc: "Envoyer un lien vers votre note dans votre presse-papier.", - baselink: "Lien du blog", - baselinkDesc: "Créer le lien du presse-papiers avec cette base. Par défaut : https://username.github.io/repo/.", - linkpathremover: "Retirer une partie du lien", - linkpathremoverDesc: "Supprimer cette partie des liens créés. Séparer par une virgule si plusieurs valeurs doivent être supprimées.", - logNoticeHeader: 'Notifier toutes les erreurs', - logNoticeDesc: 'Sur mobile, il peut être difficile de debug le module. Activer cette option pour notifier toutes les erreurs via une notification Obsidian.', - shareExternalModifiedTitle: "Partager les fichiers modifiés externes", - shareExternalModifiedDesc: "Envoyer les fichiers modifiés s'ils sont différents du fichier actif. Utile si vous modifier les métadonnées à l'aide de Metadata Menu ou MetaEdit.", - /* ------------ * - * Notice * - * ------------ */ - - unablePublishNote: (fileInfo: string): string => `Impossible de publier la note ${fileInfo}, ignorée.`, - errorPublish: (repoInfo: string): string => `Erreur lors de la publication sur ${repoInfo}.`, - unablePublishMultiNotes: "Impossible de publier plusieurs notes, quelque chose s'est mal passé.", - startingClean: (repoInfo: string): string => `Début du nettoyage ${repoInfo}...`, - scanningRepo: "Scan du dépôt, cela peut prendre un moment...", - foundNoteToSend: (noteLength: string)=> `Trouvé ${noteLength} nouvelles notes à envoyer !`, - noNewNote: "Aucune nouvelle note à partager.", - successfullPublish:(noticeValue: string[])=>`Publication réussie de ${noticeValue[0]} vers ${noticeValue[1]}.`, - waitingWorkflow: "Maintenant, attente de la complétion du workflow...", - sendMessage:(noticeValue: string[])=>`Envoi de ${noticeValue[0]} à ${noticeValue[1]}${noticeValue[2]}.`, - mergeconflic: `La pull-request n'est pas fusionnable, vous avez besoin de le faire manuellement.`, - errorConfig: (repoInfo: string): string => `Erreur de configuration pour ${repoInfo}. Merci de vérifier vos paramètres.`, -} diff --git a/plugin/i18n/locales/fr.ts b/plugin/i18n/locales/fr.ts new file mode 100644 index 00000000..81a87201 --- /dev/null +++ b/plugin/i18n/locales/fr.ts @@ -0,0 +1,145 @@ +export default { + commands : { + shareActiveFile: "Partager le fichier actif", + publisherDeleteClean: "Suppression des fichiers non partagés et/ou supprimé du dépôt ", + uploadAllNotes: "Publier toutes les notes partagées", + uploadNewNotes: "Publier les nouvelles notes", + uploadAllNewEditedNote: "Publier toutes les notes nouvelles et modifiées depuis le dernier envoi.", + uploadAllEditedNote: "Publier toutes les notes éditées depuis le dernier envoie", + shareViewFiles: (viewFile: string): string => `Partager "${viewFile}" avec Github Publisher`, + }, + deletion: { + errorDeleteDefaultFolder: "Vous avez besoin d'un dossier par défaut dans les paramètres pour utiliser cette commande.", + errorDeleteRootFolder: 'Vous devez configurer un dossier racine dans les paramètres pour utiliser cette commande.', + successDeleting:(nb:string): string => `Suppression réussie de ${nb} fichiers.`, + failedDeleting:(nb:string): string => `Échec de la suppression de ${nb} files.`, + noFileDeleted: "Aucun fichier n'a été supprimé", + }, + settings: { + github: { + githubConfiguration: "Configuration GitHub", + repoName: "Nom du dépôt", + repoNameDesc: "Le nom du dépôt dans lequel vous enregistrez votre blog.", + mkdocsTemplate: "mkdocs-template", + githubUsername: "Nom d'utilisateur GitHub", + githubUsernameDesc: "Votre nom d'utilisateur GitHub.", + ghTokenDesc: "Un token GitHub avec autorisation de dépôt. Vous pouvez le générer ", + here: "ici.", + githubToken: "Token GitHub", + githubBranchHeading: "Branche principale", + githubBranchDesc: "Si vous utilisez une branche principale différente de main, vous pouvez la spécifier ici.", + automaticallyMergePR: "Fusionner automatiquement les pull requests", + }, + uploadConfig: { + uploadConfig: "Configuration d'upload", //désolée du franglais ici mais je trouve pas de traduction propre + pathSetting: "Paramètres du chemin d'accès", + folderBehavior: "Comportement du dossier", + folderBehaviorDesc: "Choisissez entre un dossier fixe, la valeur d'une clé de métadonnée ou votre chemin relatif dans Obsidian.", + fixedFolder: "Dossier fixé", + yaml: "Clé de métadonnée", + obsidianPath: "Chemin Obsidian", + defaultFolder: "Dossier par défaut", + defaultFolderDesc: "Définir le dossier de réception par défaut.", + defaultFolderPlaceholder: "docs", + pathRemoving: "Suppression de chemin", + pathRemovingDesc: "Permettre de publier uniquement le sous-dossier en supprimant le chemin avant celui-ci :", + pathRemovingPlaceholder: "Blog", + frontmatterKey: "Clé de métadonnées", + frontmatterKeyDesc: "Définir la clé où obtenir la valeur du dossier.", + frontmatterKeyPlaceholder: "catégorie", + rootFolder: "Dossier racine", + rootFolderDesc: "Ajoutez ce chemin au dossier défini par la clé de métadonnées.", + useFrontmatterTitle: "Utiliser une clé de métadonnées pour le titre", + useFrontmatterTitleDesc: "Utilisez un champ du frontmatter pour générer le nom du fichier. Par défaut \"title\" est utilisé.", + }, + textConversion:{ + textConversion: "Conversion du contenu", + textConversionDesc:'Ces options ne changent pas le contenu du fichier dans votre coffre Obsidian, mais changeront le contenu du fichier publié sur GitHub.', + textHeader: "Texte", + linkHeader: "Liens", + folderNote: "Folder Note", + folderNoteDesc: "Renommer les fichiers en \"index.md\" s'il porte le même nom que leur dossier/catégorie parent (fonctionne aussi si la note est à l'extérieur du dossier).", + internalsLinks: "Liens internes", + internalsLinksDesc: "Convertir le lien interne dans le fichier partagé pour qu'il corresponde aux paramètres du dossier.", + linkDesc: 'Vous pouvez empêcher la conversion des liens et conserver le texte alt (ou le nom du fichier) en utilisant la clé frontmatter "links" avec la valeur "false".', + wikilinks: "Wikilinks", + wikilinksDesc: "Convertir les liens Wikilinks en liens markdown, sans en modifier le contenu. Ce paramètre peut être outrepassé par la clé de métadonnées \"mdlinks\".", + hardBreakTitle: "Saut de ligne strict", + hardBreakDesc: "Ajoutez un retour à la ligne Markdown (double espace) après chaque ligne. Ce paramètre peut être outrepassé par la clé de métadonnées \"hardbreak\".", + headerDataview: "Dataview", + headerDataviewDesc: "Convertir dataview en markdown. Ce paramètre peut être outrepassé par la clé de métadonnées \"dataview\".", + censorTextHeader: "Replacement de texte", + censorTextDesc: "Replacement de texte (ou regex) par un autre texte.", + censorTextInsensitive: "Insensible à la casse.", + censorTextEmpty: 'Le remplacement de texte peut être vide afin de supprimer le texte.', + censorToolTipAdd: 'Ajouter un nouveau remplacement', + censorToolTipRemove: 'Supprimer ce remplacement', + censorPlaceHolder: 'Regex ou text à remplacer', + censorValuePlaceHolder: 'Remplacement', + censorBefore: 'Exécuté avant les autres conversions (liens, dataview, etc.)', + censorAfter: 'Exécuté après les autres conversions (liens, dataview, etc.)', + inlineTagsHeader: 'Inlines tags', + inlineTagsDesc: 'Ajoute vos tags inline dans votre bloc de métadonnée et convertit les tags imbriqués en remplaçant "/" par "_".', + dataviewFieldHeader: 'Conversion des champs du frontmatter/dataview en tags', + dataviewFieldDesc: 'Ceci convertira tous les champs du frontmatter/dataview en tags. Séparez les champs par une virgule.', + dataviewExcludeHeader: 'Exclure des valeurs de la conversion', + dataviewExcludeDesc: 'Exclure la valeur de la conversion. Séparez les valeurs par une virgule.', + }, + embed : { + embed: "Transclusion", + transferImage: "Transférer les pièces jointes", + transferImageDesc: "Envoyer les pièces-jointes intégrées dans un fichier dans le dépôt. Ce paramètre peut être outrepassé par la clé de métadonnées \"attachment\".", + transferEmbeddedNotes: "Transférer les notes transclues", + transferEmbeddedNotesDesc: "Envoyez des notes transcluent dans un fichier partagé dans le dépôt. Seuls les fichiers partagés seront envoyés ! Ce paramètre peut être outrepassé par la clé de métadonnées \"embed\".", + defaultImageFolder: "Dossier de pièces-jointes par défaut", + defaultImageFolderDesc: "Pour utiliser un dossier différent de celui par défaut pour les pièces-jointes.", + transferMetaFile: "Envoyer des fichiers en utilisant une clé de métadonnée", + transferMetaFileDesc: 'Mettez les noms des champs de métadonnées que vous voulez utiliser pour envoyer les fichiers. Séparez les champs par une virgule. Les champs Dataview sont pris en charge.', + }, + githubWorkflow: { + githubActionName: "Nom de l'action GitHub", + githubActionNameDesc: "Si vous souhaitez activer une action github lorsque le plugin push le fichier, indiquez le nom du fichier (dans votre dossier \".github/worfklows\").", + autoCleanUp: "Auto-nettoyage", + autoCleanUpDesc: "Si le plugin doit retirer de votre dépôt les fichiers supprimés (arrêt de partage ou supprimé).", + excludedFiles: "Fichier exclus", + excludedFilesDesc: "Si vous voulez exclure certains dossiers du nettoyage automatique, définissez leur chemin.", + }, + plugin: { + pluginSettings: "Paramètres du plugin", + shareKey: "Clé de partage", + shareKeyDesc: "La clé de métadonnées pour publier votre fichier sur le dépôt.", + excludedFolder: "Dossier exclus", + excludedFolderDesc: "Les fichiers dans ses dossiers ne seront jamais publiés, quelle que soit l'état de la clé de partage. Séparez les noms de dossier par une virgule.", + fileMenu: "Menu \"Fichier\"", + fileMenuDesc: "Ajouter une commande de partage dans le menu \"Fichier\"", + editorMenu: "Menu \"Edition\"", + editorMenuDesc: "Ajouter une commande de partage dans le menu du clic droit.", + copylinkSetting: "Copie de lien.", + copylinkDesc: "Envoyer un lien vers votre note dans votre presse-papier.", + baselink: "Lien du blog", + baselinkDesc: "Créer le lien du presse-papiers avec cette base. Par défaut : https://username.github.io/repo/.", + linkpathremover: "Retirer une partie du lien", + linkpathremoverDesc: "Supprimer cette partie des liens créés. Séparer par une virgule si plusieurs valeurs doivent être supprimées.", + logNoticeHeader: 'Notifier toutes les erreurs', + logNoticeDesc: 'Sur mobile, il peut être difficile de debug le module. Activer cette option pour notifier toutes les erreurs via une notification Obsidian.', + shareExternalModifiedTitle: "Partager les fichiers modifiés externes", + shareExternalModifiedDesc: "Envoyer les fichiers modifiés s'ils sont différents du fichier actif. Utile si vous modifier les métadonnées à l'aide de Metadata Menu ou MetaEdit.", + } + }, + informations: { + startingClean: (repoInfo: string): string => `Début du nettoyage ${repoInfo}...`, + scanningRepo: "Scan du dépôt, cela peut prendre un moment...", + foundNoteToSend: (noteLength: string)=> `Trouvé ${noteLength} nouvelles notes à envoyer !`, + noNewNote: "Aucune nouvelle note à partager.", + successfullPublish:(noticeValue: string[])=>`Publication réussie de ${noticeValue[0]} vers ${noticeValue[1]}.`, + waitingWorkflow: "Maintenant, attente de la complétion du workflow...", + sendMessage:(noticeValue: string[])=>`Envoi de ${noticeValue[0]} à ${noticeValue[1]}${noticeValue[2]}.`, + }, + error:{ + unablePublishNote: (fileInfo: string): string => `Impossible de publier la note ${fileInfo}, ignorée.`, + errorPublish: (repoInfo: string): string => `Erreur lors de la publication sur ${repoInfo}.`, + unablePublishMultiNotes: "Impossible de publier plusieurs notes, quelque chose s'est mal passé.", + mergeconflic: `La pull-request n'est pas fusionnable, vous avez besoin de le faire manuellement.`, + errorConfig: (repoInfo: string): string => `Erreur de configuration pour ${repoInfo}. Merci de vérifier vos paramètres.`, + } +} diff --git a/plugin/i18n/locales/ru.ts b/plugin/i18n/locales/ru.ts index 1822e0d8..4766de6f 100644 --- a/plugin/i18n/locales/ru.ts +++ b/plugin/i18n/locales/ru.ts @@ -1,144 +1,148 @@ export default { - /* ------------ * - * Commands * - * ------------ */ - shareActiveFile: "Поделиться текущим файлом", - publisherDeleteClean: "Удалить больше не доступные и удаленные файлы из репозитория", - uploadAllNotes: "Загрузить все общие заметки", - uploadNewNotes: "Загрузить новые общие заметки", - uploadAllNewEditedNote: "Загрузить все ноые и отредактированные заметки с последней загрузки", - uploadAllEditedNote: "Загрузить все отредактированные заметки с последней загрузки", - shareViewFiles:(viewFile:string): string => `Поделиться "${viewFile}" с Github Publisher`, - /* ------ Delete string ----- */ - errorDeleteDefaultFolder: "Вы должны указать название папки по умолчанию в настройках, чтобы воспользоваться этой командой.", - errorDeleteRootFolder: 'Вы должны указать корневую папку в настройках, чтобы воспользоваться этой командой.', - successDeleting:(nb:string): string => `Успешно удалено ${nb} файлов.`, - failedDeleting:(nb:string): string => `Неудалось удалить ${nb} файлов.`, - noFileDeleted: 'Файлы не были удалены.', - - /* ------------ * - * Settings * - * ------------ */ - githubConfiguration: "Настройки интеграции с Github", - repoName: "Repo Name", - repoNameDesc: "Название репозитория в котором будет храниться блог.", - mkdocsTemplate: "mkdocs-template", - githubUsername: "Github Username", - githubUsernameDesc: "Ваше имя пользователя github.", - ghTokenDesc: "Github token с правами на доступ к репозиторию. Вы можете сгенерировать его ", - here: "здесь.", - githubToken: "Github Token", - githubBranchHeading: "Main branch", - githubBranchDesc: 'If you use a different main branch than "main", you can specify it here.', - automaticallyMergePR: "Automatically merge PR", - // --- - // # Upload configuration # // - uploadConfig: "Настройки загрузки", - pathSetting: "Настройки путей", - folderBehavior: "Поведение при создание папок", - folderBehaviorDesc: "Выберите между фиксированной папкой, значением из Frontmatter или путем относительно хранилища obsidian", - fixedFolder: "Фиксированная папка", - yaml: "YAML frontmatter", - obsidianPath: "Относительно хранилища Obsidian", - defaultFolder: "Папка по умолчанию", - defaultFolderDesc: "Укажите папку по умолчанию для публикации", - defaultFolderPlaceholder: "docs", - pathRemoving: "Удалять из пути", - pathRemovingDesc: "Разрешать публикацию только подпапок удаляя из пути следующую строку :", - pathRemovingPlaceholder: "GardenSketch", - frontmatterKey: "Frontmatter свойство", - frontmatterKeyDesc: "Укажите свойство в котором будет указана папка", - frontmatterKeyPlaceholder: "category", - rootFolder: "Корневая папка", - rootFolderDesc: "Добавлять этут папку к путям заданным через свойство frontmatter.", - useFrontmatterTitle: "Set the title from the frontmatter", - useFrontmatterTitleDesc: "Use a frontmatter value to generate the filename. By default, \"title\" is used.", - - // --- - // # Text conversion # // - textConversion: "Преобразования текста", - textHeader: "Текст", - linkHeader: "Ссылки", - folderNote: "Индексный файл в папке", - folderNoteDesc: "Переименовывать файл в \"index.md\" в случае если он называется также как родительская папка (работает и в том случае если файл вне папки).", - internalsLinks: "Внутренние ссылки", - internalsLinksDesc: "Преобразовывать внутренние ссылки в общих файла в соответствие с настройками папки", - wikilinks: "[[Wiki-ссылки]]", - wikilinksDesc: "Преобразовывать Wiki-ссылки в MarkDown ссылки, не трогая содержимое", - hardBreakTitle: "Жесткие переносы строк в Markdown", - hardBreakDesc: "Использовать видимый перенос строки (двойной перенос) в markdown после каждой строки.", - headerDataview: "Dataview", - headerDataviewDesc: "Преобразовать dataview в markdown.", - censorTextHeader: "Text replacer", - censorTextDesc: "Replace text (or regex) in the file with the given value.", - censorTextInsensitive: "Case insensitive", - censorTextEmpty: 'Replacement can be empty to remove the whole string.', - censorToolTipAdd: 'Add a new text replacer', - censorToolTipRemove: 'Delete this text replacer', - censorPlaceHolder: 'Regex or text to replace', - censorValuePlaceHolder: 'Replacement value', - censorBefore: 'Run it before the other plugin conversion (link, dataview, etc.)', - censorAfter: 'Run it after the other plugin conversion (link, dataview, etc.)', - inlineTagsHeader: 'Inline tags', - inlineTagsDesc: 'Add your inline tags in your frontmatter tags field and converting nested tags with replacing "/" with "_"', - dataviewFieldHeader: 'Convert frontmatter/dataview field to tags', - dataviewFieldDesc: 'This will convert any frontmatter or dataview inline field into frontmatter tags. Separate fields with a comma.', - dataviewExcludeHeader: 'Exclude value from conversion', - dataviewExcludeDesc: 'This will exclude value from being converted. Separate fields with a comma.', - // --- - // # Embed # // - embed: "Вставки", - transferImage: "Отправлять изображения", - transferImageDesc: "Отправлять вставленые в заметки изображения на github", - transferEmbeddedNotes: "Отправлять вставленые заметки", - transferEmbeddedNotesDesc: "Отправлять вставленые заметки из общих файлов на github. Только общие файлы будут отправлены!", - defaultImageFolder: "Папка по умолчанию для изображений", - defaultImageFolderDesc: "Если вы хотите использовать папку отличную от папки по умолчанию", - transferMetaFile: "Send files using a metadata field", - transferMetaFileDesc: 'Set the names of the metadata field you want to use to send files. Separate fields with a comma. Dataview inline field are supported.', - - // --- - // # Github Workflow # // - githubActionName: "Название Github action", - githubActionNameDesc: "Если вы хотите активировать github action после того как плагин запушит файл, укажите название файла (в папке .github/worfklows).", - autoCleanUp: "Автоматическая очистка", - autoCleanUpDesc: "Если плагин должен удалять с github'а удаленные файлы (больше не общедоступные или удаленные)", - excludedFiles: "Исключенные файлы", - excludedFilesDesc: "Если вы хотите исключить папки из автоматической очистки, укажите путь к ним.", - - // --- - // # Plugin settings # // - pluginSettings: "Настройки плагина", - shareKey: "Share Key", - shareKeyDesc: "Свойство Frontmatter(Yaml) для пометке файлов как доступных для публикации.", - excludedFolder: "Исключенные папки", - excludedFolderDesc: "Никогда не публиковать файлы из этих папок, вне зависимости от флага публикации. Разделяйте папки с помощью запятой.", - fileMenu: "Файловое меню", - fileMenuDesc: "Добавить команды в файловое меню", - editorMenu: "Меню редактора", - editorMenuDesc: "Добавить команды в меню по правой-кнопки мыши", - copylinkSetting: "Скопировать ссылку", - copylinkDesc: "Скопировать ссылку на общедоступный файл в буфер обмена", - baselink: "Ссылка на блог", - baselinkDesc: "Ссылки для буфера обмена будут созданы на базе этой ссылки. По умолчанию : https://username.github.io/repo/", - linkpathremover: "Удалять часть ссылки", - linkpathremoverDesc: "Удалять эту часть из созданных ссылок. Если нужно удалять множественные значения, используте запятую.", - logNoticeHeader: 'Уведомлять о каждой ошибке', - logNoticeDesc: 'На мобильных устройствах сложно отлаживать плагин. Включите эту опцию, чтобы логгировать каждую ошибку', - shareExternalModifiedTitle: "Share external modified file", - shareExternalModifiedDesc: "Send edited file if they are different from the active file. Useful when editing metadata using MetaEdit or Metadata Menu.", - /* ------------ * - * Notice * - * ------------ */ - unablePublishNote: (fileInfo: string): string => `Не получилось опубликовать заметку ${fileInfo},пропускаю`, - errorPublish: (repoInfo: string): string => `Ошибка публикации в ${repoInfo}.`, - unablePublishMultiNotes: "Не получилось опубликовать несколько заметок, что-то пошло не так.", - startingClean: (repoInfo: string): string => `Начинаю очистку ${repoInfo}`, - scanningRepo: "Сканирую репозиторий, это может занять какое-то время...", - foundNoteToSend: (noteLength: string)=> `Найдено ${noteLength} заметок для отправки`, - noNewNote: "Отсутствуют новые заметки для публикации.", - successfullPublish:(noticeValue: string[])=>`Успешно опубликовано ${noticeValue[0]} в ${noticeValue[1]}.`, - waitingWorkflow: "Ожидаю завершения процесса обработки...", - sendMessage:(noticeValue: string[])=>`Отправляю ${noticeValue[0]} в ${noticeValue[1]}${noticeValue[2]}`, - mergeconflic: `Pull-request is not mergeable, you need to do it manually.` + commands: { + shareActiveFile: "Поделиться текущим файлом", + publisherDeleteClean: "Удалить больше не доступные и удаленные файлы из репозитория", + uploadAllNotes: "Загрузить все общие заметки", + uploadNewNotes: "Загрузить новые общие заметки", + uploadAllNewEditedNote: "Загрузить все ноые и отредактированные заметки с последней загрузки", + uploadAllEditedNote: "Загрузить все отредактированные заметки с последней загрузки", + shareViewFiles: (viewFile: string): string => `Поделиться "${viewFile}" с Github Publisher`, + }, + deletion: { + errorDeleteDefaultFolder: "Вы должны указать название папки по умолчанию в настройках, чтобы воспользоваться этой командой.", + errorDeleteRootFolder: 'Вы должны указать корневую папку в настройках, чтобы воспользоваться этой командой.', + successDeleting: (nb: string): string => `Успешно удалено ${nb} файлов.`, + failedDeleting: (nb: string): string => `Неудалось удалить ${nb} файлов.`, + noFileDeleted: 'Файлы не были удалены.', + }, + settings: { + github: { + githubConfiguration: "Настройки интеграции с Github", + repoName: "Repo Name", + repoNameDesc: "Название репозитория в котором будет храниться блог.", + mkdocsTemplate: "mkdocs-template", + githubUsername: "Github Username", + githubUsernameDesc: "Ваше имя пользователя github.", + ghTokenDesc: "Github token с правами на доступ к репозиторию. Вы можете сгенерировать его ", + here: "здесь.", + githubToken: "Github Token", + githubBranchHeading: "Main branch", + githubBranchDesc: 'If you use a different main branch than "main", you can specify it here.', + automaticallyMergePR: "Automatically merge PR", + }, + uploadConfig: { + uploadConfig: "Настройки загрузки", + pathSetting: "Настройки путей", + folderBehavior: "Поведение при создание папок", + folderBehaviorDesc: "Выберите между фиксированной папкой, значением из Frontmatter или путем относительно хранилища obsidian", + fixedFolder: "Фиксированная папка", + yaml: "YAML frontmatter", + obsidianPath: "Относительно хранилища Obsidian", + defaultFolder: "Папка по умолчанию", + defaultFolderDesc: "Укажите папку по умолчанию для публикации", + defaultFolderPlaceholder: "docs", + pathRemoving: "Удалять из пути", + pathRemovingDesc: "Разрешать публикацию только подпапок удаляя из пути следующую строку :", + pathRemovingPlaceholder: "GardenSketch", + frontmatterKey: "Frontmatter свойство", + frontmatterKeyDesc: "Укажите свойство в котором будет указана папка", + frontmatterKeyPlaceholder: "category", + rootFolder: "Корневая папка", + rootFolderDesc: "Добавлять этут папку к путям заданным через свойство frontmatter.", + useFrontmatterTitle: "Set the title from the frontmatter", + useFrontmatterTitleDesc: "Use a frontmatter value to generate the filename. By default, \"title\" is used.", + }, + textConversion: { + textConversion: "Преобразования текста", + textConversionDesc: 'Theses option won\'t change the content of the file in your Obsidian Vault, but will change the content of the file in Github.', + textHeader: "Текст", + linkHeader: "Ссылки", + folderNote: "Индексный файл в папке", + folderNoteDesc: "Переименовывать файл в \"index.md\" в случае если он называется также как родительская папка (работает и в том случае если файл вне папки).", + internalsLinks: "Внутренние ссылки", + internalsLinksDesc: "Преобразовывать внутренние ссылки в общих файла в соответствие с настройками папки", + linkDesc: 'You can prevent links to be converted and keep the alt text (or filename) by using the frontmatter key "links" with the value "false".', + wikilinks: "[[Wiki-ссылки]]", + wikilinksDesc: "Преобразовывать Wiki-ссылки в MarkDown ссылки, не трогая содержимое", + hardBreakTitle: "Жесткие переносы строк в Markdown", + hardBreakDesc: "Использовать видимый перенос строки (двойной перенос) в markdown после каждой строки.", + headerDataview: "Dataview", + headerDataviewDesc: "Преобразовать dataview в markdown.", + censorTextHeader: "Text replacer", + censorTextDesc: "Replace text (or regex) in the file with the given value.", + censorTextInsensitive: "Case insensitive", + censorTextEmpty: 'Replacement can be empty to remove the whole string.', + censorToolTipAdd: 'Add a new text replacer', + censorToolTipRemove: 'Delete this text replacer', + censorPlaceHolder: 'Regex or text to replace', + censorValuePlaceHolder: 'Replacement value', + censorBefore: 'Run it before the other plugin conversion (link, dataview, etc.)', + censorAfter: 'Run it after the other plugin conversion (link, dataview, etc.)', + inlineTagsHeader: 'Inline tags', + inlineTagsDesc: 'Add your inline tags in your frontmatter tags field and converting nested tags with replacing "/" with "_"', + dataviewFieldHeader: 'Convert frontmatter/dataview field to tags', + dataviewFieldDesc: 'This will convert any frontmatter or dataview inline field into frontmatter tags. Separate fields with a comma.', + dataviewExcludeHeader: 'Exclude value from conversion', + dataviewExcludeDesc: 'This will exclude value from being converted. Separate fields with a comma.', + }, + embed: { + embed: "Вставки", + transferImage: "Отправлять изображения", + transferImageDesc: "Отправлять вставленые в заметки изображения на github", + transferEmbeddedNotes: "Отправлять вставленые заметки", + transferEmbeddedNotesDesc: "Отправлять вставленые заметки из общих файлов на github. Только общие файлы будут отправлены!", + defaultImageFolder: "Папка по умолчанию для изображений", + defaultImageFolderDesc: "Если вы хотите использовать папку отличную от папки по умолчанию", + transferMetaFile: "Send files using a metadata field", + transferMetaFileDesc: 'Set the names of the metadata field you want to use to send files. Separate fields with a comma. Dataview inline field are supported.', + }, + githubWorkflow: { + // --- + // # Github Workflow # // + githubActionName: "Название Github action", + githubActionNameDesc: "Если вы хотите активировать github action после того как плагин запушит файл, укажите название файла (в папке .github/worfklows).", + autoCleanUp: "Автоматическая очистка", + autoCleanUpDesc: "Если плагин должен удалять с github'а удаленные файлы (больше не общедоступные или удаленные)", + excludedFiles: "Исключенные файлы", + excludedFilesDesc: "Если вы хотите исключить папки из автоматической очистки, укажите путь к ним.", + }, + plugin: { + pluginSettings: "Настройки плагина", + shareKey: "Share Key", + shareKeyDesc: "Свойство Frontmatter(Yaml) для пометке файлов как доступных для публикации.", + excludedFolder: "Исключенные папки", + excludedFolderDesc: "Никогда не публиковать файлы из этих папок, вне зависимости от флага публикации. Разделяйте папки с помощью запятой.", + fileMenu: "Файловое меню", + fileMenuDesc: "Добавить команды в файловое меню", + editorMenu: "Меню редактора", + editorMenuDesc: "Добавить команды в меню по правой-кнопки мыши", + copylinkSetting: "Скопировать ссылку", + copylinkDesc: "Скопировать ссылку на общедоступный файл в буфер обмена", + baselink: "Ссылка на блог", + baselinkDesc: "Ссылки для буфера обмена будут созданы на базе этой ссылки. По умолчанию : https://username.github.io/repo/", + linkpathremover: "Удалять часть ссылки", + linkpathremoverDesc: "Удалять эту часть из созданных ссылок. Если нужно удалять множественные значения, используте запятую.", + logNoticeHeader: 'Уведомлять о каждой ошибке', + logNoticeDesc: 'На мобильных устройствах сложно отлаживать плагин. Включите эту опцию, чтобы логгировать каждую ошибку', + shareExternalModifiedTitle: "Share external modified file", + shareExternalModifiedDesc: "Send edited file if they are different from the active file. Useful when editing metadata using MetaEdit or Metadata Menu.", + }, + }, + informations: { + startingClean: (repoInfo: string): string => `Начинаю очистку ${repoInfo}`, + scanningRepo: "Сканирую репозиторий, это может занять какое-то время...", + foundNoteToSend: (noteLength: string)=> `Найдено ${noteLength} заметок для отправки`, + noNewNote: "Отсутствуют новые заметки для публикации.", + successfullPublish:(noticeValue: string[])=>`Успешно опубликовано ${noticeValue[0]} в ${noticeValue[1]}.`, + waitingWorkflow: "Ожидаю завершения процесса обработки...", + sendMessage:(noticeValue: string[])=>`Отправляю ${noticeValue[0]} в ${noticeValue[1]}${noticeValue[2]}`, + + }, + error: { + unablePublishNote: (fileInfo: string): string => `Не получилось опубликовать заметку ${fileInfo},пропускаю`, + errorPublish: (repoInfo: string): string => `Ошибка публикации в ${repoInfo}.`, + unablePublishMultiNotes: "Не получилось опубликовать несколько заметок, что-то пошло не так.", + mergeconflic: `Pull-request is not mergeable, you need to do it manually.`, + errorConfig: (repoInfo: string): string => `Error configuring ${repoInfo}. Please check your settings.`, + } } diff --git a/plugin/i18n/locales/zh-cn.ts b/plugin/i18n/locales/zh-cn.ts index c1db1541..a86fb942 100644 --- a/plugin/i18n/locales/zh-cn.ts +++ b/plugin/i18n/locales/zh-cn.ts @@ -1,148 +1,151 @@ export default { - /* ------------ * - * Commands * - * ------------ */ - shareActiveFile: "上传当前文件", - publisherDeleteClean: "云端移除本地未分享和已删除的文件", - uploadAllNotes: "上传所有分享的文件", - uploadNewNotes: "上传新分享的文件", - uploadAllNewEditedNote: "上传新建立文件的和更新已编辑的分享文件", - uploadAllEditedNote: "更新所有已编辑的文件", - shareViewFiles:(viewFile:string): string => `用Mkdocs Publisher共享"${viewFile}"。`, + commands : { + shareActiveFile: "上传当前文件", + publisherDeleteClean: "云端移除本地未分享和已删除的文件", + uploadAllNotes: "上传所有分享的文件", + uploadNewNotes: "上传新分享的文件", + uploadAllNewEditedNote: "上传新建立文件的和更新已编辑的分享文件", + uploadAllEditedNote: "更新所有已编辑的文件", + shareViewFiles: (viewFile: string): string => `用Mkdocs Publisher共享"${viewFile}"。`, + }, + deletion: { + errorDeleteDefaultFolder: "You need a default folder name in the settings to use this command.", + errorDeleteRootFolder: 'You need to configure a root folder in the settings to use this command.', + successDeleting: (nb: string): string => `Successfully deleted ${nb} files.`, + failedDeleting: (nb: string): string => `Failed to delete ${nb} files.`, + noFileDeleted: 'No files have been deleted.', + }, + settings: { + github: { + githubConfiguration: "Github设置", + repoName: "仓库名", + repoNameDesc: "你博客所在的github仓库名", + mkdocsTemplate: "mkdocs模板", + githubUsername: "Github用户名", + githubUsernameDesc: "你github的用户名", + ghTokenDesc: "github仓库的操作需要github token给予权限,你可以在", + here: "这里生成", + githubToken: "Github Token", + githubBranchHeading: "Main branch", + githubBranchDesc: 'If you use a different main branch than "main", you can specify it here.', + automaticallyMergePR: "Automatically merge PR", + }, + uploadConfig: { + // --- + // # Upload configuration # // + uploadConfig: "上传设置", + pathSetting: "路径设置", + folderBehavior: "文件夹操作", + folderBehaviorDesc: "选择依据固定文件夹,frontmatter key还是ob的相对路径上传文件", + fixedFolder: "固定文件夹", + yaml: "YAML frontmatter", + obsidianPath: "Obsidian相对路径", + defaultFolder: "默认github接收的文件夹", + defaultFolderDesc: "默认github默认接收的文件夹", + defaultFolderPlaceholder: "docs", + pathRemoving: "移除路径", + pathRemovingDesc: "允许通过删除之前的路径仅发布子文件夹:", + pathRemovingPlaceholder: "GardenSketch", + frontmatterKey: "Frontmatter key", + frontmatterKeyDesc: "设置云端用于建立文件夹名的键,默认为category", + frontmatterKeyPlaceholder: "category", + rootFolder: "根文件夹", + rootFolderDesc: "将此路径追加到文件夹前", + useFrontmatterTitle: "Set the title from the frontmatter", + useFrontmatterTitleDesc: "Use a frontmatter value to generate the filename. By default, \"title\" is used.", + }, + textConversion: { + textConversion: "文本转换", + textConversionDesc:'Theses option won\'t change the content of the file in your Obsidian Vault, but will change the content of the file in Github.', - /* ------ Delete string ----- */ - errorDeleteDefaultFolder: "You need a default folder name in the settings to use this command.", - errorDeleteRootFolder: 'You need to configure a root folder in the settings to use this command.', - successDeleting:(nb:string): string => `Successfully deleted ${nb} files.`, - failedDeleting:(nb:string): string => `Failed to delete ${nb} files.`, - noFileDeleted: 'No files have been deleted.', + textHeader: "文本", + linkHeader: "链接", + folderNote: "Folder note", + folderNoteDesc: "重命名文件为其父文件夹名(或category名) \"index.md\"", + internalsLinks: "内部链接", + internalsLinksDesc: "转换发布文件中的内部链接", + linkDesc: 'You can prevent links to be converted and keep the alt text (or filename) by using the frontmatter key "links" with the value "false".', - /* ------------ * - * Settings * - * ------------ */ - githubConfiguration: "Github设置", - repoName: "仓库名", - repoNameDesc: "你博客所在的github仓库名", - mkdocsTemplate: "mkdocs模板", - githubUsername: "Github用户名", - githubUsernameDesc: "你github的用户名", - ghTokenDesc: "github仓库的操作需要github token给予权限,你可以在", - here: "这里生成", - githubToken: "Github Token", - githubBranchHeading: "Main branch", - githubBranchDesc: 'If you use a different main branch than "main", you can specify it here.', - automaticallyMergePR: "Automatically merge PR", - - // --- - // # Upload configuration # // - uploadConfig: "上传设置", - pathSetting: "路径设置", - folderBehavior: "文件夹操作", - folderBehaviorDesc: "选择依据固定文件夹,frontmatter key还是ob的相对路径上传文件", - fixedFolder: "固定文件夹", - yaml: "YAML frontmatter", - obsidianPath: "Obsidian相对路径", - defaultFolder: "默认github接收的文件夹", - defaultFolderDesc: "默认github默认接收的文件夹", - defaultFolderPlaceholder: "docs", - pathRemoving: "移除路径", - pathRemovingDesc: "允许通过删除之前的路径仅发布子文件夹:", - pathRemovingPlaceholder: "GardenSketch", - frontmatterKey: "Frontmatter key", - frontmatterKeyDesc: "设置云端用于建立文件夹名的键,默认为category", - frontmatterKeyPlaceholder: "category", - rootFolder: "根文件夹", - rootFolderDesc: "将此路径追加到文件夹前", - useFrontmatterTitle: "Set the title from the frontmatter", - useFrontmatterTitleDesc: "Use a frontmatter value to generate the filename. By default, \"title\" is used.", - - // --- - // # Text conversion # // - textConversion: "文本转换", - textHeader: "文本", - linkHeader: "链接", - folderNote: "Folder note", - folderNoteDesc: "重命名文件为其父文件夹名(或category名) \"index.md\"", - internalsLinks: "内部链接", - internalsLinksDesc: "转换发布文件中的内部链接", - wikilinks: "Wikilinks", - wikilinksDesc: "转换wiki link为md link,不改变文件内容", - hardBreakTitle: "马克顿的硬断行", - hardBreakDesc: "在每一行之后添加一个标记性的硬断行(双倍空白)。", - headerDataview: "Dataview", - headerDataviewDesc: "Convert dataview to markdown.", - censorTextHeader: "Text replacer", - censorTextDesc: "Replace text (or regex) in the file with the given value.", - censorTextInsensitive: "Case insensitive", - censorTextEmpty: 'Replacement can be empty to remove the whole string.', - censorToolTipAdd: 'Add a new text replacer', - censorToolTipRemove: 'Delete this text replacer', - censorPlaceHolder: 'Regex or text to replace', - censorValuePlaceHolder: 'Replacement value', - censorBefore: 'Run it before the other plugin conversion (link, dataview, etc.)', - censorAfter: 'Run it after the other plugin conversion (link, dataview, etc.)', - inlineTagsHeader: 'Inline tags', - inlineTagsDesc: 'Add your inline tags in your frontmatter tags field and converting nested tags with replacing "/" with "_"', - dataviewFieldHeader: 'Convert frontmatter/dataview field to tags', - dataviewFieldDesc: 'This will convert any frontmatter or dataview inline field into frontmatter tags. Separate fields with a comma.', - dataviewExcludeHeader: 'Exclude value from conversion', - dataviewExcludeDesc: 'This will exclude value from being converted. Separate fields with a comma.', - - // --- - // # Embed # // - embed: "嵌入", - transferImage: "转换图片", - transferImageDesc: "发送文件中插入的图片至github", - transferEmbeddedNotes: "转换嵌入的笔记", - transferEmbeddedNotesDesc: "发布文件中嵌入的文件至github.该嵌入文件需要允许被发布", - defaultImageFolder: "默认图片文件夹", - defaultImageFolderDesc: "使用与默认文档夹不同的文档夹", - transferMetaFile: "Send files using a metadata field", - transferMetaFileDesc: 'Set the names of the metadata field you want to use to send files. Separate fields with a comma. Dataview inline field are supported.', - - // --- - // # Github Workflow # // - githubActionName: "Github action名", - githubActionNameDesc: "如果要在插件推送文档时激活 github action,请设置对应的action名称(在 .github/worfklows 文档夹中)。", - autoCleanUp: "自动清理", - autoCleanUpDesc: "如果插件必须从github中删除本地已删除的文档(停止共享或删除)", - excludedFiles: "排除文件", - excludedFilesDesc: "如果要从自动清理中排除某些文档夹,请设置其路径。", - - // --- - // # Plugin settings # // - pluginSettings: "插件设置", - shareKey: "分享键", - shareKeyDesc: "在网站上发布文档的frontmatter的键", - excludedFolder: "排除文件夹", - excludedFolderDesc: "排除该文档夹中所有文档,无论是否有分享键的frontmatter。多个文件夹用逗号分隔。", - fileMenu: "文件菜单", - fileMenuDesc: "在文件树添加右键分享命令", - editorMenu: "编辑器菜单", - editorMenuDesc: "在右键添加分享命令", - copylinkSetting: "复制链接设置", - copylinkDesc: "在你的剪贴板中发送一个链接到你的笔记上", - baselink: "博客链接", - baselinkDesc: "以此为基础创建剪贴板链接。默认情况下 : https://username.github.io/repo/", - linkpathremover: "删除链接部分", - linkpathremoverDesc: "从创建的链接中删除这部分。如果必须删除多个值,请用逗号分开。", - logNoticeHeader: '注意每一个错误', - logNoticeDesc: '在移动设备上,调试模块可能很困难。启用该选项可以通过Obsidian通知来通知所有错误。', - shareExternalModifiedTitle: "Share external modified file", - shareExternalModifiedDesc: "Send edited file if they are different from the active file. Useful when editing metadata using MetaEdit or Metadata Menu.", - - /* ------------ * - * Notice * - * ------------ */ - unablePublishNote: (fileInfo: string): string => { return `不能上传文件${fileInfo},已跳过` }, - errorPublish: (repoInfo: string): string => `上传至${repoInfo}错误!`, - unablePublishMultiNotes: "不能上传多个文件,出了点问题", - startingClean: (repoInfo: string): string => `开始清理 ${repoInfo}`, - scanningRepo: "扫描仓库中,稍等...", - foundNoteToSend: (noteLength: string)=> `发现 ${noteLength} 篇笔记需要上传`, - noNewNote: "没有新笔记需要上传.", - successfullPublish:(noticeValue: string[])=>`成功地将${noticeValue[0]}发布到${noticeValue[1]}。`, - waitingWorkflow: "现在,等待工作流程的完成...", - sendMessage:(noticeValue: string[])=>`将${noticeValue[0]}发送到${noticeValue[1]}${noticeValue[2]}。`, - mergeconflic: `Pull-request is not mergeable, you need to do it manually.` + wikilinks: "Wikilinks", + wikilinksDesc: "转换wiki link为md link,不改变文件内容", + hardBreakTitle: "马克顿的硬断行", + hardBreakDesc: "在每一行之后添加一个标记性的硬断行(双倍空白)。", + headerDataview: "Dataview", + headerDataviewDesc: "Convert dataview to markdown.", + censorTextHeader: "Text replacer", + censorTextDesc: "Replace text (or regex) in the file with the given value.", + censorTextInsensitive: "Case insensitive", + censorTextEmpty: 'Replacement can be empty to remove the whole string.', + censorToolTipAdd: 'Add a new text replacer', + censorToolTipRemove: 'Delete this text replacer', + censorPlaceHolder: 'Regex or text to replace', + censorValuePlaceHolder: 'Replacement value', + censorBefore: 'Run it before the other plugin conversion (link, dataview, etc.)', + censorAfter: 'Run it after the other plugin conversion (link, dataview, etc.)', + inlineTagsHeader: 'Inline tags', + inlineTagsDesc: 'Add your inline tags in your frontmatter tags field and converting nested tags with replacing "/" with "_"', + dataviewFieldHeader: 'Convert frontmatter/dataview field to tags', + dataviewFieldDesc: 'This will convert any frontmatter or dataview inline field into frontmatter tags. Separate fields with a comma.', + dataviewExcludeHeader: 'Exclude value from conversion', + dataviewExcludeDesc: 'This will exclude value from being converted. Separate fields with a comma.', + }, + embed: { + embed: "嵌入", + transferImage: "转换图片", + transferImageDesc: "发送文件中插入的图片至github", + transferEmbeddedNotes: "转换嵌入的笔记", + transferEmbeddedNotesDesc: "发布文件中嵌入的文件至github.该嵌入文件需要允许被发布", + defaultImageFolder: "默认图片文件夹", + defaultImageFolderDesc: "使用与默认文档夹不同的文档夹", + transferMetaFile: "Send files using a metadata field", + transferMetaFileDesc: 'Set the names of the metadata field you want to use to send files. Separate fields with a comma. Dataview inline field are supported.', + }, + githubWorkflow: { + githubActionName: "Github action名", + githubActionNameDesc: "如果要在插件推送文档时激活 github action,请设置对应的action名称(在 .github/worfklows 文档夹中)。", + autoCleanUp: "自动清理", + autoCleanUpDesc: "如果插件必须从github中删除本地已删除的文档(停止共享或删除)", + excludedFiles: "排除文件", + excludedFilesDesc: "如果要从自动清理中排除某些文档夹,请设置其路径。", + }, + plugin: { + pluginSettings: "插件设置", + shareKey: "分享键", + shareKeyDesc: "在网站上发布文档的frontmatter的键", + excludedFolder: "排除文件夹", + excludedFolderDesc: "排除该文档夹中所有文档,无论是否有分享键的frontmatter。多个文件夹用逗号分隔。", + fileMenu: "文件菜单", + fileMenuDesc: "在文件树添加右键分享命令", + editorMenu: "编辑器菜单", + editorMenuDesc: "在右键添加分享命令", + copylinkSetting: "复制链接设置", + copylinkDesc: "在你的剪贴板中发送一个链接到你的笔记上", + baselink: "博客链接", + baselinkDesc: "以此为基础创建剪贴板链接。默认情况下 : https://username.github.io/repo/", + linkpathremover: "删除链接部分", + linkpathremoverDesc: "从创建的链接中删除这部分。如果必须删除多个值,请用逗号分开。", + logNoticeHeader: '注意每一个错误', + logNoticeDesc: '在移动设备上,调试模块可能很困难。启用该选项可以通过Obsidian通知来通知所有错误。', + shareExternalModifiedTitle: "Share external modified file", + shareExternalModifiedDesc: "Send edited file if they are different from the active file. Useful when editing metadata using MetaEdit or Metadata Menu.", + }, + }, + information: { + startingClean: (repoInfo: string): string => `开始清理 ${repoInfo}`, + scanningRepo: "扫描仓库中,稍等...", + foundNoteToSend: (noteLength: string)=> `发现 ${noteLength} 篇笔记需要上传`, + noNewNote: "没有新笔记需要上传.", + successfullPublish:(noticeValue: string[])=>`成功地将${noticeValue[0]}发布到${noticeValue[1]}。`, + waitingWorkflow: "现在,等待工作流程的完成...", + sendMessage:(noticeValue: string[])=>`将${noticeValue[0]}发送到${noticeValue[1]}${noticeValue[2]}。`, + + }, + error: { + unablePublishNote: (fileInfo: string): string => { return `不能上传文件${fileInfo},已跳过` }, + errorPublish: (repoInfo: string): string => `上传至${repoInfo}错误!`, + unablePublishMultiNotes: "不能上传多个文件,出了点问题", + mergeconflic: `Pull-request is not mergeable, you need to do it manually.`, + errorConfig: (repoInfo: string): string => `Error configuring ${repoInfo}. Please check your settings.`, + } + } diff --git a/plugin/main.ts b/plugin/main.ts index 42956fe8..82c8b213 100644 --- a/plugin/main.ts +++ b/plugin/main.ts @@ -15,7 +15,7 @@ import { shareOneNote, shareOnlyEdited, } from "./commands"; -import t, { StringFunc } from "./i18n"; +import {StringFunc, commands} from "./i18n"; export default class GithubPublisher extends Plugin { settings: GitHubPublisherSettings; @@ -25,7 +25,6 @@ export default class GithubPublisher extends Plugin { await this.loadSettings(); this.addSettingTab(new GithubPublisherSettings(this.app, this)); const octokit = new Octokit({ auth: this.settings.GhToken }); - const PublisherManager = new GithubBranch( this.settings, octokit, @@ -48,7 +47,7 @@ export default class GithubPublisher extends Plugin { menu.addItem((item) => { item.setSection("action"); item.setTitle( - (t("shareViewFiles") as StringFunc)(file.basename) + (commands("shareViewFiles") as StringFunc)(file.basename) ) .setIcon("share") .onClick(async () => { @@ -77,7 +76,7 @@ export default class GithubPublisher extends Plugin { menu.addItem((item) => { item.setSection("mkdocs-publisher"); item.setTitle( - (t("shareViewFiles") as StringFunc)( + (commands("shareViewFiles") as StringFunc)( view.file.basename ) ) @@ -122,7 +121,7 @@ export default class GithubPublisher extends Plugin { this.addCommand({ id: "publisher-one", - name: t("shareActiveFile") as string, + name: commands("shareActiveFile") as string, hotkeys: [], checkCallback: (checking) => { if ( @@ -150,18 +149,30 @@ export default class GithubPublisher extends Plugin { this.addCommand({ id: "publisher-delete-clean", - name: t("publisherDeleteClean") as string, + name: commands("publisherDeleteClean") as string, hotkeys: [], checkCallback: (checking) => { if (this.settings.autoCleanUp) { if (!checking) { - deleteUnsharedDeletedNotes( - PublisherManager, - this.settings, - octokit, - branchName, - repo - ); + if (repo instanceof Array) { + for (const r of repo) { + deleteUnsharedDeletedNotes( + PublisherManager, + this.settings, + octokit, + branchName, + r + ); + } + } else { + deleteUnsharedDeletedNotes( + PublisherManager, + this.settings, + octokit, + branchName, + repo + ); + } } return true; } @@ -171,65 +182,122 @@ export default class GithubPublisher extends Plugin { this.addCommand({ id: "publisher-publish-all", - name: t("uploadAllNotes") as string, + name: commands("uploadAllNotes") as string, callback: async () => { const sharedFiles = PublisherManager.getSharedFiles(); const statusBarItems = this.addStatusBarItem(); - await shareAllMarkedNotes( - PublisherManager, - this.settings, - octokit, - statusBarItems, - branchName, - repo, - sharedFiles, - true - ); + if (repo instanceof Array) { + for (const r of repo) { + await shareAllMarkedNotes( + PublisherManager, + this.settings, + octokit, + statusBarItems, + branchName, + r, + sharedFiles, + true + ); + } + } else { + await shareAllMarkedNotes( + PublisherManager, + this.settings, + octokit, + statusBarItems, + branchName, + repo, + sharedFiles, + true + ); + } + }, }); this.addCommand({ id: "publisher-upload-new", - name: t("uploadNewNotes") as string, + name: commands("uploadNewNotes") as string, callback: async () => { - await shareNewNote( - PublisherManager, - octokit, - branchName, - this.app.vault, - this, - repo - ); + if (repo instanceof Array) { + for (const r of repo) { + await shareNewNote( + PublisherManager, + octokit, + branchName, + this.app.vault, + this, + r + ); + } + } else { + await shareNewNote( + PublisherManager, + octokit, + branchName, + this.app.vault, + this, + repo + ); + } }, }); this.addCommand({ id: "publisher-upload-all-edited-new", - name: t("uploadAllNewEditedNote") as string, + name: commands("uploadAllNewEditedNote") as string, callback: async () => { - await shareAllEditedNotes( - PublisherManager, - octokit, - branchName, - this.app.vault, - this, - repo - ); + if (repo instanceof Array) { + for (const r of repo) { + await shareAllEditedNotes( + PublisherManager, + octokit, + branchName, + this.app.vault, + this, + r + ); + } + } else { + await shareAllEditedNotes( + PublisherManager, + octokit, + branchName, + this.app.vault, + this, + repo + ); + } + }, }); this.addCommand({ id: "publisher-upload-edited", - name: t("uploadAllEditedNote") as string, + name: commands("uploadAllEditedNote") as string, callback: async () => { - await shareOnlyEdited( - PublisherManager, - octokit, - branchName, - this.app.vault, - this, - repo - ); + if (repo instanceof Array) { + for (const r of repo) { + await shareOnlyEdited( + PublisherManager, + octokit, + branchName, + this.app.vault, + this, + r + ); + } + } else { + await shareOnlyEdited( + PublisherManager, + octokit, + branchName, + this.app.vault, + this, + repo + ); + } + }, }); } diff --git a/plugin/publishing/branch.ts b/plugin/publishing/branch.ts index 1a9fa079..a0d2c040 100644 --- a/plugin/publishing/branch.ts +++ b/plugin/publishing/branch.ts @@ -3,7 +3,7 @@ import {GitHubPublisherSettings, RepoFrontmatter} from "../settings/interface"; import {FilesManagement} from "./filesManagement"; import {MetadataCache, Notice, Vault} from "obsidian"; import GithubPublisherPlugin from "../main"; -import t, {StringFunc} from "../i18n"; +import {StringFunc, error} from "../i18n"; export class GithubBranch extends FilesManagement { settings: GitHubPublisherSettings; @@ -148,7 +148,7 @@ export class GithubBranch extends FilesManagement { } catch (e) { console.log(e) - new Notice(t('mergeconflic') as string); + new Notice(error('mergeconflic') as string); return false; } } @@ -186,7 +186,7 @@ export class GithubBranch extends FilesManagement { } catch (e) { console.log(e); - new Notice((t("errorConfig") as StringFunc)(`${repoFrontmatter.owner}/${repoFrontmatter.repo}`)); + new Notice((error("errorConfig") as StringFunc)(`${repoFrontmatter.owner}/${repoFrontmatter.repo}`)); return false } } diff --git a/plugin/publishing/delete.ts b/plugin/publishing/delete.ts index 40833ad5..dd3d6d58 100644 --- a/plugin/publishing/delete.ts +++ b/plugin/publishing/delete.ts @@ -4,7 +4,7 @@ import {folderSettings, GitHubPublisherSettings, GithubRepo, RepoFrontmatter} fr import {FilesManagement} from "./filesManagement"; import {Base64} from "js-base64"; import {isAttachment, noticeLog, trimObject} from "../src/utils"; -import t, {StringFunc} from "../i18n" +import {StringFunc, deletion} from "../i18n" export async function deleteFromGithub(silent=false, settings: GitHubPublisherSettings, octokit: Octokit, branchName = "main", filesManagement: FilesManagement, repoFrontmatter: RepoFrontmatter[]|RepoFrontmatter) { if (repoFrontmatter instanceof Array) { @@ -34,12 +34,12 @@ async function deleteFromGithubOneRepo(silent = false, settings: GitHubPublisher let errorMsg = ""; if (settings.folderDefaultName.length > 0) { if (settings.folderDefaultName.length > 0) { - errorMsg = (t("errorDeleteDefaultFolder") as string) + errorMsg = (deletion("errorDeleteDefaultFolder") as string) } else if ( settings.downloadedFolder === folderSettings.yaml && settings.rootFolder.length === 0 ) { - errorMsg = (t("errorDeleteRootFolder") as string) + errorMsg = (deletion("errorDeleteRootFolder") as string) } if (!silent) { new Notice("Error : " + errorMsg); @@ -82,13 +82,13 @@ async function deleteFromGithubOneRepo(silent = false, settings: GitHubPublisher } } } - let successMsg = t('noFileDeleted') as string; + let successMsg = deletion('noFileDeleted') as string; let failedMsg = ''; if (deletedSuccess > 0) { - successMsg = (t("successDeleting") as StringFunc)(deletedSuccess.toString()); + successMsg = (deletion("successDeleting") as StringFunc)(deletedSuccess.toString()); } if (deletedFailed > 0) { - failedMsg = (t('failedDeleting') as StringFunc)(deletedFailed.toString()); + failedMsg = (deletion('failedDeleting') as StringFunc)(deletedFailed.toString()); } if (!silent) { new Notice(successMsg + failedMsg) diff --git a/plugin/publishing/upload.ts b/plugin/publishing/upload.ts index ef64f5de..a5f9032a 100644 --- a/plugin/publishing/upload.ts +++ b/plugin/publishing/upload.ts @@ -10,7 +10,7 @@ import { FilesManagement } from "./filesManagement"; import { Octokit } from "@octokit/core"; import { Base64 } from "js-base64"; import {deleteFromGithub} from "./delete" -import t, {StringFunc} from "../i18n"; +import {StringFunc, error} from "../i18n"; import { @@ -67,14 +67,14 @@ export default class Publisher { } statusBar.increment(); } catch (e) { - new Notice((t("unablePublishNote") as StringFunc)(image.name)); + new Notice((error("unablePublishNote") as StringFunc)(image.name)); console.error(e); } } statusBar.finish(8000); } catch (e) { noticeLog(e, this.settings); - new Notice((t('errorPublish') as StringFunc)(repoFrontmatter.repo)); + new Notice((error('errorPublish') as StringFunc)(repoFrontmatter.repo)); statusBar.error(); } } else { // 1 one item to send diff --git a/plugin/settings.ts b/plugin/settings.ts index f61dd4f0..e04973c3 100644 --- a/plugin/settings.ts +++ b/plugin/settings.ts @@ -8,7 +8,7 @@ import { autoCleanUpSettingsOnCondition, shortcutsHideShow } from "./settings/style"; import {folderSettings, TextCleaner} from "./settings/interface"; -import t from './i18n' +import {settings} from './i18n' function openDetails(groupName: string, detailsState: boolean) { @@ -36,10 +36,10 @@ export class GithubPublisherSettings extends PluginSettingTab { * Github Config * * ------------------------------ */ - containerEl.createEl('h1', {text: t('githubConfiguration') as string}) + containerEl.createEl('h1', {text: settings('github','githubConfiguration') as string}) new Setting(containerEl) - .setName(t('repoName') as string) - .setDesc(t('repoNameDesc') as string) + .setName(settings('github', 'repoName') as string) + .setDesc(settings('github','repoNameDesc') as string) .addText((text) => text .setPlaceholder('mkdocs-template') @@ -50,11 +50,11 @@ export class GithubPublisherSettings extends PluginSettingTab { }) ) new Setting(containerEl) - .setName(t('githubUsername') as string) - .setDesc(t('githubUsernameDesc') as string) + .setName(settings('github','githubUsername') as string) + .setDesc(settings('github','githubUsernameDesc') as string) .addText((text) => text - .setPlaceholder(t('githubUsername') as string) + .setPlaceholder(settings('github','githubUsername') as string) .setValue(this.plugin.settings.githubName) .onChange(async (value) => { this.plugin.settings.githubName = value.trim() @@ -63,14 +63,14 @@ export class GithubPublisherSettings extends PluginSettingTab { ) const desc_ghToken = document.createDocumentFragment() desc_ghToken.createEl('span', null, (span) => { - span.innerText = t('ghTokenDesc') as string + span.innerText = settings('github', 'ghTokenDesc') as string span.createEl('a', null, (link) => { - link.innerText = t('here') as string + link.innerText = settings('github','here') as string link.href = 'https://github.com/settings/tokens/new?scopes=repo,workflow' }) }) new Setting(containerEl) - .setName(t('githubToken') as string) + .setName(settings('github','githubToken') as string) .setDesc(desc_ghToken) .addText((text) => text @@ -83,8 +83,8 @@ export class GithubPublisherSettings extends PluginSettingTab { ) new Setting(containerEl) - .setName(t('githubBranchHeading') as string) - .setDesc(t('githubBranchDesc') as string) + .setName(settings('github','githubBranchHeading') as string) + .setDesc(settings('github', 'githubBranchDesc') as string) .addText((text) => text .setPlaceholder('main') @@ -96,7 +96,7 @@ export class GithubPublisherSettings extends PluginSettingTab { ) new Setting(containerEl) - .setName(t('automaticallyMergePR') as string) + .setName(settings('github','automaticallyMergePR') as string) .addToggle((toggle) => toggle .setValue(this.plugin.settings.automaticallyMergePR) @@ -109,19 +109,19 @@ export class GithubPublisherSettings extends PluginSettingTab { /* ------------------------------ * * Upload config * * ------------------------------ */ - containerEl.createEl('h2', {text: t('uploadConfig') as string}) + containerEl.createEl('h2', {text: settings('uploadConfig','uploadConfig') as string}) - containerEl.createEl('h3', {text: t('pathSetting') as string}) + containerEl.createEl('h3', {text: settings('uploadConfig','pathSetting') as string}) new Setting(this.containerEl) - .setName(t('folderBehavior') as string) - .setDesc(t('folderBehaviorDesc') as string) + .setName(settings('uploadConfig','folderBehavior') as string) + .setDesc(settings('uploadConfig','folderBehaviorDesc') as string) .addDropdown((dropDown) => { dropDown .addOptions({ - fixed : t('fixedFolder') as string, - yaml: t('yaml') as string, - obsidian: t('obsidianPath') as string + fixed : settings('uploadConfig','fixedFolder') as string, + yaml: settings('uploadConfig','yaml') as string, + obsidian: settings('uploadConfig','obsidianPath') as string }) .setValue(this.plugin.settings.downloadedFolder) .onChange(async(value: string)=>{ @@ -141,8 +141,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); new Setting(this.containerEl) - .setName(t('defaultFolder') as string) - .setDesc(t('defaultFolderDesc') as string) + .setName(settings('uploadConfig','defaultFolder') as string) + .setDesc(settings('uploadConfig','defaultFolderDesc') as string) .addText((text) => { text .setPlaceholder('docs') @@ -155,12 +155,12 @@ export class GithubPublisherSettings extends PluginSettingTab { }); const subFolderSettings = new Setting(this.containerEl) - .setName(t('pathRemoving') as string) + .setName(settings('uploadConfig','pathRemoving') as string) .setClass('obs-git-publisher') - .setDesc(t('pathRemovingDesc') as string) + .setDesc(settings('uploadConfig','pathRemovingDesc') as string) .addText((text) => { text - .setPlaceholder(t('pathRemovingPlaceholder') as string) + .setPlaceholder(settings('textConversion','pathRemovingPlaceholder') as string) .setValue(this.plugin.settings.subFolder) .onChange(async (value) => { this.plugin.settings.subFolder = value.replace(/\/$/, '').trim(); @@ -169,9 +169,9 @@ export class GithubPublisherSettings extends PluginSettingTab { }); const frontmatterKeySettings = new Setting(this.containerEl) - .setName(t('frontmatterKey') as string) + .setName(settings('uploadConfig','frontmatterKey') as string) .setClass('obs-git-publisher') - .setDesc(t('frontmatterKeyDesc') as string) + .setDesc(settings('uploadConfig','frontmatterKeyDesc') as string) .addText((text) => { text .setPlaceholder('category') @@ -182,9 +182,9 @@ export class GithubPublisherSettings extends PluginSettingTab { }); }); const rootFolderSettings = new Setting(this.containerEl) - .setName(t('rootFolder') as string) + .setName(settings('uploadConfig','rootFolder') as string) .setClass('obs-git-publisher') - .setDesc(t('rootFolderDesc') as string) + .setDesc(settings('uploadConfig','rootFolderDesc') as string) .addText((text)=>{ text .setPlaceholder('docs') @@ -196,8 +196,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); }); const frontmatterTitleSet=new Setting(this.containerEl) - .setName(t('useFrontmatterTitle') as string) - .setDesc(t('useFrontmatterTitleDesc') as string) + .setName(settings('uploadConfig','useFrontmatterTitle') as string) + .setDesc(settings('uploadConfig','useFrontmatterTitleDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.useFrontmatterTitle) @@ -225,12 +225,12 @@ export class GithubPublisherSettings extends PluginSettingTab { * Text conversion * * ------------------------------ */ - containerEl.createEl('h3', {text: t('textConversion') as string}) - containerEl.createEl('span', {text: t('textConversionDesc') as string}) - containerEl.createEl('h5', {text: t('textHeader') as string}) + containerEl.createEl('h3', {text: settings('textConversion','textConversion') as string}) + containerEl.createEl('span', {text: settings('textConversion','textConversionDesc') as string}) + containerEl.createEl('h5', {text: settings('textConversion','textHeader') as string}) new Setting(this.containerEl) - .setName(t('hardBreakTitle') as string) - .setDesc(t('hardBreakDesc') as string) + .setName(settings('textConversion','hardBreakTitle') as string) + .setDesc(settings('textConversion','hardBreakDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.hardBreak) @@ -240,8 +240,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); }); new Setting(this.containerEl) - .setName(t('headerDataview') as string) - .setDesc(t('headerDataviewDesc') as string) + .setName(settings('textConversion','headerDataview') as string) + .setDesc(settings('textConversion','headerDataviewDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.convertDataview) @@ -252,18 +252,18 @@ export class GithubPublisherSettings extends PluginSettingTab { }); const censorTextDesc = document.createDocumentFragment(); - censorTextDesc.createEl('p', {text: t('censorTextDesc') as string}) - censorTextDesc.createEl('li', {text: t('censorTextInsensitive') as string}) - censorTextDesc.createEl('li', {text: t('censorTextEmpty') as string}) + censorTextDesc.createEl('p', {text: settings('textConversion','censorTextDesc') as string}) + censorTextDesc.createEl('li', {text: settings('textConversion','censorTextInsensitive') as string}) + censorTextDesc.createEl('li', {text: settings('textConversion','censorTextEmpty') as string}) const details = containerEl.createEl('details'); - details.createEl('summary', {text: t('censorTextHeader') as string}) + details.createEl('summary', {text: settings('textConversion','censorTextHeader') as string}) new Setting(details) .setClass('obs-git-publisher-censor-desc') .setDesc(censorTextDesc) .addButton((btn) => { btn .setIcon('plus') - .setTooltip(t('censorToolTipAdd') as string) + .setTooltip(settings('textConversion','censorToolTipAdd') as string) .onClick(async () => { const censorText: TextCleaner = { entry: '', @@ -273,18 +273,18 @@ export class GithubPublisherSettings extends PluginSettingTab { this.plugin.settings.censorText.push(censorText); await this.plugin.saveSettings(); this.display(); - openDetails(t('censorTextHeader') as string, true) + openDetails(settings('textConversion','censorTextHeader') as string, true) }) }) for (const censorText of this.plugin.settings.censorText) { const afterIcon = censorText.after ? 'double-down-arrow-glyph' : 'double-up-arrow-glyph'; - const afterDesc = censorText.after ? t('censorAfter') as string : t('censorBefore') as string; + const afterDesc = censorText.after ? settings('textConversion','censorAfter') as string : settings('textConversion','censorBefore') as string; new Setting(details) .setClass('obs-git-publisher-censor-entry') .addText((text) => { text - .setPlaceholder(t('censorPlaceHolder') as string) + .setPlaceholder(settings('textConversion','censorPlaceHolder') as string) .setValue(censorText.entry) .onChange(async (value) => { censorText.entry = value; @@ -293,7 +293,7 @@ export class GithubPublisherSettings extends PluginSettingTab { }) .addText((text) => { text - .setPlaceholder(t('censorValuePlaceHolder') as string) + .setPlaceholder(settings('textConversion','censorValuePlaceHolder') as string) .setValue(censorText.replace) .onChange(async (value) => { censorText.replace = value; @@ -303,12 +303,12 @@ export class GithubPublisherSettings extends PluginSettingTab { .addExtraButton((btn) => { btn .setIcon('trash') - .setTooltip(t('censorToolTipRemove') as string) + .setTooltip(settings('textConversion','censorToolTipRemove') as string) .onClick(async () => { this.plugin.settings.censorText.splice(this.plugin.settings.censorText.indexOf(censorText), 1); await this.plugin.saveSettings(); this.display(); - openDetails(t('censorTextHeader') as string, true) + openDetails(settings('textConversion','censorTextHeader') as string, true) }) }) .addExtraButton((btn) => { @@ -319,7 +319,7 @@ export class GithubPublisherSettings extends PluginSettingTab { censorText.after = !censorText.after; await this.plugin.saveSettings(); this.display(); - openDetails(t('censorTextHeader') as string, true) + openDetails(settings('textConversion','censorTextHeader') as string, true) }) }) @@ -327,8 +327,8 @@ export class GithubPublisherSettings extends PluginSettingTab { containerEl.createEl('h5', {text: 'Tags'}) new Setting(this.containerEl) - .setName(t('inlineTagsHeader') as string) - .setDesc(t('inlineTagsDesc') as string) + .setName(settings('textConversion','inlineTagsHeader') as string) + .setDesc(settings('textConversion','inlineTagsDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.inlineTags) @@ -339,8 +339,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); new Setting(this.containerEl) - .setName(t('dataviewFieldHeader') as string) - .setDesc(t('dataviewFieldDesc') as string) + .setName(settings('textConversion','dataviewFieldHeader') as string) + .setDesc(settings('textConversion','dataviewFieldDesc') as string) .addTextArea((text) => { text .setPlaceholder('field_name') @@ -351,8 +351,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); }); new Setting(this.containerEl) - .setName(t('dataviewExcludeHeader') as string) - .setDesc(t('dataviewExcludeDesc') as string) + .setName(settings('textConversion','dataviewExcludeHeader') as string) + .setDesc(settings('textConversion','dataviewExcludeDesc') as string) .addTextArea((text) => { text .setPlaceholder('field value') @@ -363,12 +363,12 @@ export class GithubPublisherSettings extends PluginSettingTab { }); }); - containerEl.createEl('h5', {text: t('linkHeader') as string}) - containerEl.createEl('p', {text: t('linkDesc') as string}) + containerEl.createEl('h5', {text: settings('textConversion','linkHeader') as string}) + containerEl.createEl('p', {text: settings('textConversion','linkDesc') as string}) const folderNoteSettings = new Setting(containerEl) - .setName(t('folderNote') as string) + .setName(settings('textConversion','folderNote') as string) .setClass('obs-git-publisher') - .setDesc(t('folderNoteDesc') as string) + .setDesc(settings('textConversion','folderNoteDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.folderNote) @@ -378,8 +378,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) }) new Setting(containerEl) - .setName(t('internalsLinks') as string) - .setDesc(t('internalsLinksDesc') as string) + .setName(settings('textConversion','internalsLinks') as string) + .setDesc(settings('textConversion','internalsLinksDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.convertForGithub) @@ -390,8 +390,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) new Setting(containerEl) - .setName(t('wikilinks') as string) - .setDesc(t('wikilinksDesc') as string) + .setName(settings('textConversion','wikilinks') as string) + .setDesc(settings('textConversion','wikilinksDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.convertWikiLinks) @@ -404,12 +404,12 @@ export class GithubPublisherSettings extends PluginSettingTab { /* ------------------------------ * * Embed * * ------------------------------ */ - containerEl.createEl('h3', {text: t('embed') as string}) + containerEl.createEl('h3', {text: settings('embed','embed') as string}) new Setting(containerEl) - .setName(t('transferImage') as string) - .setDesc(t('transferImageDesc') as string) + .setName(settings('embed','transferImage') as string) + .setDesc(settings('embed','transferImageDesc') as string) .addToggle((toggle) => { toggle .setValue(this.plugin.settings.embedImage) @@ -421,8 +421,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); new Setting(containerEl) - .setName(t('transferMetaFile') as string) - .setDesc(t('transferMetaFileDesc') as string) + .setName(settings('embed','transferMetaFile') as string) + .setDesc(settings('embed','transferMetaFileDesc') as string) .addTextArea((text) => { text .setPlaceholder('banner') @@ -435,8 +435,8 @@ export class GithubPublisherSettings extends PluginSettingTab { new Setting(containerEl) - .setName(t('transferEmbeddedNotes') as string) - .setDesc(t('transferEmbeddedNotesDesc') as string) + .setName(settings('embed','transferEmbeddedNotes') as string) + .setDesc(settings('embed','transferEmbeddedNotesDesc') as string) .addToggle((toggle)=>{ toggle .setValue(this.plugin.settings.embedNotes) @@ -447,8 +447,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) const settingsDefaultImage = new Setting(containerEl) - .setName(t('defaultImageFolder') as string) - .setDesc(t('defaultImageFolderDesc') as string) + .setName(settings('embed','defaultImageFolder') as string) + .setDesc(settings('embed','defaultImageFolderDesc') as string) .addText((text)=>{ text .setPlaceholder('docs/images') @@ -461,8 +461,8 @@ export class GithubPublisherSettings extends PluginSettingTab { containerEl.createEl('h3', {text: 'Github Workflow'}) new Setting(containerEl) - .setName(t('githubActionName') as string) - .setDesc(t('githubActionNameDesc') as string) + .setName(settings('githubWorkflow','githubActionName') as string) + .setDesc(settings('githubWorkflow','githubActionNameDesc') as string) .addText((text)=>{ text .setPlaceholder('ci') @@ -478,8 +478,8 @@ export class GithubPublisherSettings extends PluginSettingTab { (this.plugin.settings.folderDefaultName.length === 0)); const autoCleanSetting = new Setting(containerEl) - .setName(t('autoCleanUp') as string) - .setDesc(t('autoCleanUpDesc') as string) + .setName(settings('githubWorkflow','autoCleanUp') as string) + .setDesc(settings('githubWorkflow','autoCleanUpDesc') as string) .setDisabled(condition) .addToggle((toggle)=>{ toggle @@ -492,8 +492,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); const autoCleanExcludedSettings = new Setting(containerEl) - .setName(t('excludedFiles') as string) - .setDesc(t('excludedFilesDesc') as string) + .setName(settings('githubWorkflow','excludedFiles') as string) + .setDesc(settings('githubWorkflow','excludedFilesDesc') as string) .addTextArea((textArea)=>{ textArea .setPlaceholder('docs/assets/js, docs/assets/logo') @@ -507,11 +507,11 @@ export class GithubPublisherSettings extends PluginSettingTab { /* ------------------------------ * * Plugin settings * * ------------------------------ */ - containerEl.createEl('h1', { text: t('pluginSettings') as string }) + containerEl.createEl('h1', { text: settings('plugin','pluginSettings') as string }) new Setting(containerEl) - .setName(t('shareKey') as string) - .setDesc(t('shareKeyDesc') as string) + .setName(settings('plugin','shareKey') as string) + .setDesc(settings('plugin','shareKeyDesc') as string) .addText((text) => text .setPlaceholder('share') @@ -522,8 +522,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) ) new Setting(containerEl) - .setName(t('excludedFolder') as string) - .setDesc(t('excludedFolderDesc') as string) + .setName(settings('plugin','excludedFolder') as string) + .setDesc(settings('plugin','excludedFolderDesc') as string) .addTextArea((textArea) => textArea .setPlaceholder('_assets, Archive') @@ -534,8 +534,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) ) new Setting(containerEl) - .setName(t('fileMenu') as string) - .setDesc(t('fileMenuDesc') as string) + .setName(settings('plugin','fileMenu') as string) + .setDesc(settings('plugin','fileMenuDesc') as string) .addToggle((toggle) => toggle .setValue(this.plugin.settings.fileMenu) @@ -545,8 +545,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) ) new Setting(containerEl) - .setName(t('editorMenu') as string) - .setDesc(t('editorMenuDesc') as string) + .setName(settings('plugin','editorMenu') as string) + .setDesc(settings('plugin','editorMenuDesc') as string) .addToggle((toggle) => toggle .setValue(this.plugin.settings.editorMenu) @@ -556,8 +556,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) ) new Setting(containerEl) - .setName(t("copylinkSetting") as string) - .setDesc(t("copylinkDesc") as string) + .setName(settings('plugin',"copylinkSetting") as string) + .setDesc(settings('plugin',"copylinkDesc") as string) .addToggle((toggle) => toggle .setValue(this.plugin.settings.copyLink) @@ -569,8 +569,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) ) new Setting(containerEl) - .setName(t("shareExternalModifiedTitle") as string) - .setDesc(t("shareExternalModifiedDesc") as string) + .setName(settings('plugin',"shareExternalModifiedTitle") as string) + .setDesc(settings('plugin',"shareExternalModifiedDesc") as string) .addToggle((toggle) => toggle .setValue(this.plugin.settings.shareExternalModified) @@ -581,8 +581,8 @@ export class GithubPublisherSettings extends PluginSettingTab { ); const baseLinkSettings = new Setting(containerEl) - .setName(t('baselink') as string) - .setDesc(t("baselinkDesc") as string) + .setName(settings('plugin','baselink') as string) + .setDesc(settings('plugin',"baselinkDesc") as string) .setClass('obs-git-publisher') .addText((text) =>{ text @@ -594,8 +594,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }); }); const pathRemover=new Setting(containerEl) - .setName(t("linkpathremover") as string) - .setDesc(t("linkpathremoverDesc") as string) + .setName(settings('plugin',"linkpathremover") as string) + .setDesc(settings('plugin',"linkpathremoverDesc") as string) .setClass('obs-git-publisher') .addText((text)=>{ text @@ -607,8 +607,8 @@ export class GithubPublisherSettings extends PluginSettingTab { }) }) new Setting(containerEl) - .setName(t('logNoticeHeader') as string) - .setDesc(t('logNoticeDesc') as string) + .setName(settings('plugin','logNoticeHeader') as string) + .setDesc(settings('plugin','logNoticeDesc') as string) .addToggle((toggle) => toggle .setValue(this.plugin.settings.logNotice) diff --git a/plugin/src/utils.ts b/plugin/src/utils.ts index 9055440f..f8d6a914 100644 --- a/plugin/src/utils.ts +++ b/plugin/src/utils.ts @@ -1,7 +1,7 @@ import {App, FrontMatterCache, MetadataCache, Notice, TFile, Vault} from 'obsidian' import {GitHubPublisherSettings, RepoFrontmatter} from '../settings/interface' import Publisher from "../publishing/upload"; -import t from '../i18n' +import {informations} from '../i18n' import type { StringFunc } from "../i18n"; import {getReceiptFolder} from "../contents_conversion/filePathConvertor"; import {frontmatterConvert} from "../settings/interface"; @@ -122,17 +122,17 @@ async function noticeMessageOneRepo(PublisherManager: Publisher, file: TFile | s */ const noticeValue = (file instanceof TFile) ? '"' + file.basename + '"' : file if (settings.workflowName.length > 0) { - new Notice((t("sendMessage") as StringFunc)([noticeValue, repo.owner+':'+repo.repo, `.\n${t("waitingWorkflow")}`])); + new Notice((informations("sendMessage") as StringFunc)([noticeValue, repo.owner+':'+repo.repo, `.\n${informations("waitingWorkflow")}`])); const successWorkflow = await PublisherManager.workflowGestion(repo); if (successWorkflow) { new Notice( - (t("successfullPublish") as StringFunc)([noticeValue, repo.owner+':'+repo.repo]) + (informations("successfullPublish") as StringFunc)([noticeValue, repo.owner+':'+repo.repo]) ); } } else { new Notice( - (t("successfullPublish") as StringFunc)([noticeValue, repo.owner+':'+repo.repo]) + (informations("successfullPublish") as StringFunc)([noticeValue, repo.owner+':'+repo.repo]) ); } }