Replace hardcoded French strings with i18n calls
Initialize i18n before auth so t() works when rendering auth-dependent UI, and build the command palette lazily so translations are loaded first. Bump service worker cache version.
This commit is contained in:
+13
-13
@@ -499,7 +499,7 @@ export function renderFile(data) {
|
||||
const sourceBtn = el("button", { class: "btn-action", title: "Voir la source" }, [icon("code", 14), document.createTextNode("Source")]);
|
||||
|
||||
// MD download button
|
||||
const mdBtn = el("button", { class: "btn-action", title: "Télécharger en .md" }, [icon("file-text", 14), document.createTextNode(".md")]);
|
||||
const mdBtn = el("button", { class: "btn-action", title: t("viewer.download_md") }, [icon("file-text", 14), document.createTextNode(".md")]);
|
||||
mdBtn.addEventListener("click", () => {
|
||||
const dlUrl = `/api/file/${encodeURIComponent(data.vault)}/download?path=${encodeURIComponent(data.path)}`;
|
||||
const a = document.createElement("a");
|
||||
@@ -511,7 +511,7 @@ export function renderFile(data) {
|
||||
});
|
||||
|
||||
// PDF download button
|
||||
const pdfBtn = el("button", { class: "btn-action", title: "Télécharger en PDF" }, [icon("file", 14), document.createTextNode("PDF")]);
|
||||
const pdfBtn = el("button", { class: "btn-action", title: t("viewer.download_pdf") }, [icon("file", 14), document.createTextNode("PDF")]);
|
||||
pdfBtn.addEventListener("click", () => {
|
||||
const pdfUrl = `/api/file/${encodeURIComponent(data.vault)}/pdf?path=${encodeURIComponent(data.path)}`;
|
||||
window.open(pdfUrl, "_blank");
|
||||
@@ -522,7 +522,7 @@ export function renderFile(data) {
|
||||
openEditor(data.vault, data.path);
|
||||
});
|
||||
|
||||
const forgeBtn = el("button", { class: "btn-action btn-forge", title: "Forge (nouvel editeur)" }, [icon("hammer", 14), document.createTextNode("Forge")]);
|
||||
const forgeBtn = el("button", { class: "btn-action btn-forge", title: t("viewer.forge_title") }, [icon("hammer", 14), document.createTextNode("Forge")]);
|
||||
forgeBtn.addEventListener("click", () => {
|
||||
var modal = document.getElementById("editor-modal");
|
||||
var container = modal.querySelector(".editor-container");
|
||||
@@ -534,7 +534,7 @@ export function renderFile(data) {
|
||||
var brand = modal.querySelector(".editor-brand");
|
||||
var titleInp = document.getElementById("editor-title-input");
|
||||
var fileInp = document.getElementById("editor-filename-input");
|
||||
if (brand) brand.textContent = "Forge";
|
||||
if (brand) brand.textContent = t("viewer.forge_brand");
|
||||
if (titleInp) { titleInp.value = data.title || ''; titleInp.placeholder = t('forge.title_placeholder'); }
|
||||
if (fileInp) fileInp.value = data.path.split('/').pop();
|
||||
bodyEl.innerHTML = "";
|
||||
@@ -574,14 +574,14 @@ export function renderFile(data) {
|
||||
shareBtn.addEventListener("click", () => openShareDialog(data.vault, data.path));
|
||||
|
||||
// Bookmark button — check if already bookmarked
|
||||
const bookmarkBtn = el("button", { class: "btn-action btn-bookmark", title: "Ajouter/Retirer des bookmarks" }, [icon("bookmark-plus", 14), document.createTextNode("Bookmark")]);
|
||||
const bookmarkBtn = el("button", { class: "btn-action btn-bookmark", title: t("viewer.bookmark_toggle") }, [icon("bookmark-plus", 14), document.createTextNode("Bookmark")]);
|
||||
// Check bookmark status and color the button
|
||||
(async () => {
|
||||
try {
|
||||
const bms = await api("/api/bookmarks");
|
||||
if (Array.isArray(bms) && bms.some(b => b.vault === data.vault && b.path === data.path)) {
|
||||
bookmarkBtn.classList.add("active");
|
||||
bookmarkBtn.title = "Retirer des bookmarks";
|
||||
bookmarkBtn.title = t("viewer.bookmark_remove");
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
})();
|
||||
@@ -589,7 +589,7 @@ export function renderFile(data) {
|
||||
try {
|
||||
const res = await api("/api/bookmarks/toggle", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ vault: data.vault, path: data.path, title: data.title }) });
|
||||
bookmarkBtn.classList.toggle("active", res.bookmarked);
|
||||
bookmarkBtn.title = res.bookmarked ? "Retirer des bookmarks" : "Ajouter aux bookmarks";
|
||||
bookmarkBtn.title = res.bookmarked ? t("viewer.bookmark_remove") : t("viewer.bookmark_add");
|
||||
showToast(res.bookmarked ? "Ajouté aux bookmarks" : "Retiré des bookmarks", "success");
|
||||
if (typeof DashboardBookmarkWidget !== "undefined") DashboardBookmarkWidget.load();
|
||||
} catch (err) { showToast("Erreur: " + err.message, "error"); }
|
||||
@@ -1351,7 +1351,7 @@ const IndexUpdateManager = (() => {
|
||||
disconnected: "Déconnecté",
|
||||
connecting: "Connexion...",
|
||||
connected: "Synchronisé",
|
||||
syncing: "Mise à jour...",
|
||||
syncing: t("viewer.syncing"),
|
||||
};
|
||||
badge.title = labels[connectionState] || connectionState;
|
||||
}
|
||||
@@ -1444,12 +1444,12 @@ function _renderSyncPanel(panel) {
|
||||
events.slice(0, 10).forEach((ev) => {
|
||||
const time = new Date(ev.timestamp).toLocaleTimeString();
|
||||
const typeLabels = {
|
||||
index_updated: "Mise à jour",
|
||||
index_updated: t("viewer.index_updated"),
|
||||
index_reloaded: "Rechargement",
|
||||
vault_added: "Vault ajouté",
|
||||
vault_removed: "Vault supprimé",
|
||||
index_start: "Démarrage index.",
|
||||
index_progress: "Vault indexé",
|
||||
vault_added: t("sync.vault_added_label"),
|
||||
vault_removed: t("sync.vault_removed_label"),
|
||||
index_start: t("viewer.index_start"),
|
||||
index_progress: t("sync.vault_indexed_label"),
|
||||
index_complete: "Indexation tech.",
|
||||
};
|
||||
const label = typeLabels[ev.type] || ev.type;
|
||||
|
||||
Reference in New Issue
Block a user