Skip to content

Commit

Permalink
fix: deleted translation forgotten
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Aug 6, 2022
1 parent 672e33f commit a2835c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
6 changes: 6 additions & 0 deletions plugin/i18n/locales/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ export default {
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 *
Expand Down
7 changes: 6 additions & 1 deletion plugin/i18n/locales/fr-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export default {
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 *
* ------------ */
Expand Down
16 changes: 6 additions & 10 deletions plugin/publishing/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {folderSettings, MkdocsPublicationSettings} from "../settings/interface";
import { FilesManagement } from "./filesManagement";
import {Base64} from "js-base64";
import {noticeLog, trimObject} from "../src/utils";

import t, {StringFunc} from "../i18n"
export async function deleteFromGithub(silent = false, settings: MkdocsPublicationSettings, octokit: Octokit, branchName='main', filesManagement: FilesManagement) {
/**
* Delete file from github
Expand All @@ -22,16 +22,12 @@ export async function deleteFromGithub(silent = false, settings: MkdocsPublicati
let errorMsg = "";
if (settings.folderDefaultName.length > 0) {
if (settings.folderDefaultName.length > 0) {
errorMsg =
"You need to configure a" +
" default folder name in the" +
" settings to use this command.";
errorMsg = (t("errorDeleteDefaultFolder") as string)
} else if (
settings.downloadedFolder === folderSettings.yaml &&
settings.rootFolder.length === 0
) {
errorMsg =
"You need to configure a root folder in the settings to use this command.";
errorMsg = (t("errorDeleteRootFolder") as string)
}
if (!silent) {
new Notice("Error : " + errorMsg);
Expand Down Expand Up @@ -71,13 +67,13 @@ export async function deleteFromGithub(silent = false, settings: MkdocsPublicati
}
}
}
let successMsg = 'No files have been deleted';
let successMsg = t('noFileDeleted') as string;
let failedMsg = '';
if (deletedSuccess > 0) {
successMsg = `Successfully deleted ${deletedSuccess} files`
successMsg = (t("successDeleting") as StringFunc)(deletedSuccess.toString());
}
if (deletedFailed > 0) {
failedMsg = `Failed to delete ${deletedFailed} files.`
failedMsg = (t('failedDeleting') as StringFunc)(deletedFailed.toString());
}
if (!silent) {
new Notice(successMsg + failedMsg)
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Octokit } from "@octokit/core";
import {MetadataCache, Notice, TFile, Vault} from "obsidian";
import MkdocsPublication from "../main";
import t from '../i18n'
import type { StringFunc } from "../i18n";
import { StringFunc } from "../i18n";


export async function shareAllMarkedNotes(PublisherManager: GithubBranch, settings: MkdocsPublicationSettings, octokit: Octokit, statusBarItems: HTMLElement, branchName: string, sharedFiles: TFile[], createGithubBranch=true) {
Expand Down

0 comments on commit a2835c1

Please sign in to comment.