refactor(ui): i18n: remove unnecessary wrappers

This commit is contained in:
Edouard Vanbelle
2026-04-25 23:19:36 +02:00
parent 4e2029969e
commit 75d3984b8f
8 changed files with 223 additions and 272 deletions
+7 -12
View File
@@ -137,14 +137,12 @@ const Modal = {
* @returns {Promise<string|null>}
*/
promptNewFolder() {
const t = i18n.t.bind(i18n);
return this.prompt({
title: t('dialogs.new_folder_title') || 'New folder',
label: t('dialogs.folder_name') || 'Folder name',
placeholder: t('dialogs.folder_placeholder') || 'My folder',
title: i18n.t('dialogs.new_folder_title'),
label: i18n.t('dialogs.folder_name'),
placeholder: i18n.t('dialogs.folder_placeholder'),
icon: 'fa-folder-plus',
confirmText: t('actions.create') || 'Create'
confirmText: i18n.t('actions.create')
});
},
@@ -155,18 +153,15 @@ const Modal = {
* @returns {Promise<string|null>}
*/
promptRename(currentName, isFolder = false) {
const t = i18n.t.bind(i18n);
// For files, we want to select only the name part (without extension)
this._selectNameOnly = !isFolder;
return this.prompt({
title: t('dialogs.rename_title') || 'Renombrar',
label: t('dialogs.new_name') || 'Nuevo nombre',
title: i18n.t('dialogs.rename_title'),
label: i18n.t('dialogs.new_name'),
placeholder: '',
value: currentName,
icon: isFolder ? 'fa-folder' : 'fa-file',
confirmText: t('actions.rename') || 'Renombrar'
confirmText: i18n.t('actions.rename')
});
},
+4 -7
View File
@@ -149,9 +149,8 @@ const notifications = (() => {
item.className = 'notif-item';
item.id = batchId;
const t = i18n.t.bind(i18n);
const uploadingText = folderName ? `📁 ${t('upload.uploading')} ${_esc(folderName)}…` : t('upload.uploading');
const filesLabel = t('upload.files');
const uploadingText = folderName ? `📁 ${i18n.t('upload.uploading')} ${_esc(folderName)}…` : i18n.t('upload.uploading');
const filesLabel = i18n.t('upload.files');
item.innerHTML = `
<div class="notif-item-icon upload"><i class="fas fa-cloud-upload-alt"></i></div>
@@ -254,8 +253,7 @@ const notifications = (() => {
const pctEl = $(`${batchId}-pct`);
const statsEl = $(`${batchId}-stats`);
const t = i18n.t.bind(i18n);
const filesLabel = t('upload.files');
const filesLabel = i18n.t('upload.files');
if (fillEl) fillEl.style.width = `${pctVal}%`;
if (pctEl) pctEl.textContent = `${pctVal}%`;
@@ -282,8 +280,7 @@ const notifications = (() => {
const curEl = $(`${batchId}-current`);
if (curEl) curEl.textContent = '';
const t = i18n.t.bind(i18n);
const completeText = t('upload.complete', {
const completeText = i18n.t('upload.complete', {
count: successCount,
total: totalFiles
});