From 9677434c001405e3af060fd395f5a994fe143f0c Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Mon, 26 Jan 2026 16:28:13 +0000 Subject: [PATCH] Add new localization strings and improve image metadata utility functions - Updated localization files for multiple languages (Hungarian, Indonesian, Japanese, Lithuanian, Latvian, Dutch, Norwegian, Persian, Portuguese, Brazilian Portuguese, Russian, Slovenian, Swedish, Tamil, Turkish, Ukrainian, Vietnamese, Simplified Chinese, Traditional Chinese) to include new strings for image management features such as "Delete Selected", "Uploading", "Tag Images", and storage information. - Enhanced the `getDataUrlSize` and `formatBytes` functions in `imageMetadata.js` for better readability and maintainability by adding braces for conditional statements. --- .../scss/settings/modules/tabs/_order.scss | 1 + .../background/api/backgroundLoader.js | 4 ++- src/features/background/options/Custom.jsx | 35 ++++++++++++++----- src/i18n/locales/ar.json | 28 ++++++++++++--- src/i18n/locales/arz.json | 28 ++++++++++++--- src/i18n/locales/az.json | 28 ++++++++++++--- src/i18n/locales/azb.json | 28 ++++++++++++--- src/i18n/locales/bn.json | 28 ++++++++++++--- src/i18n/locales/de_DE.json | 28 ++++++++++++--- src/i18n/locales/el.json | 28 ++++++++++++--- src/i18n/locales/en_GB.json | 2 +- src/i18n/locales/en_US.json | 28 ++++++++++++--- src/i18n/locales/es.json | 28 ++++++++++++--- src/i18n/locales/es_419.json | 28 ++++++++++++--- src/i18n/locales/et.json | 28 ++++++++++++--- src/i18n/locales/fa.json | 28 ++++++++++++--- src/i18n/locales/fr.json | 28 ++++++++++++--- src/i18n/locales/hu.json | 28 ++++++++++++--- src/i18n/locales/id_ID.json | 28 ++++++++++++--- src/i18n/locales/ja.json | 28 ++++++++++++--- src/i18n/locales/lt.json | 28 ++++++++++++--- src/i18n/locales/lv.json | 28 ++++++++++++--- src/i18n/locales/nl.json | 28 ++++++++++++--- src/i18n/locales/no.json | 28 ++++++++++++--- src/i18n/locales/peo.json | 28 ++++++++++++--- src/i18n/locales/pt.json | 28 ++++++++++++--- src/i18n/locales/pt_BR.json | 28 ++++++++++++--- src/i18n/locales/ru.json | 28 ++++++++++++--- src/i18n/locales/sl.json | 28 ++++++++++++--- src/i18n/locales/sv.json | 28 ++++++++++++--- src/i18n/locales/ta.json | 28 ++++++++++++--- src/i18n/locales/tr_TR.json | 28 ++++++++++++--- src/i18n/locales/uk.json | 28 ++++++++++++--- src/i18n/locales/vi.json | 28 ++++++++++++--- src/i18n/locales/zh_CN.json | 28 ++++++++++++--- src/i18n/locales/zh_Hant.json | 28 ++++++++++++--- src/utils/imageMetadata.js | 12 +++++-- 37 files changed, 809 insertions(+), 141 deletions(-) diff --git a/src/components/Elements/MainModal/scss/settings/modules/tabs/_order.scss b/src/components/Elements/MainModal/scss/settings/modules/tabs/_order.scss index b4c5c147..b912ff01 100644 --- a/src/components/Elements/MainModal/scss/settings/modules/tabs/_order.scss +++ b/src/components/Elements/MainModal/scss/settings/modules/tabs/_order.scss @@ -117,6 +117,7 @@ overflow: hidden; transition: all 0.3s ease; box-shadow: t($boxShadow); + cursor: pointer; &.selected { outline: 3px solid #ff5c25; diff --git a/src/features/background/api/backgroundLoader.js b/src/features/background/api/backgroundLoader.js index 0f3806df..bcd217c1 100644 --- a/src/features/background/api/backgroundLoader.js +++ b/src/features/background/api/backgroundLoader.js @@ -193,7 +193,9 @@ async function getCustomBackground(isOffline) { const url = selected.url || selected; - if (isOffline && !url.startsWith('data:')) return getOfflineImage('custom'); + if (isOffline && !url.startsWith('data:')) { + return getOfflineImage('custom'); + } const data = { url, diff --git a/src/features/background/options/Custom.jsx b/src/features/background/options/Custom.jsx index 3af6202b..0464775a 100644 --- a/src/features/background/options/Custom.jsx +++ b/src/features/background/options/Custom.jsx @@ -267,7 +267,9 @@ const CustomSettings = memo(() => { }, []); const handleBatchDelete = async () => { - if (selectedImages.size === 0) return; + if (selectedImages.size === 0) { + return; + } try { const indices = Array.from(selectedImages).sort((a, b) => b - a); @@ -357,9 +359,12 @@ const CustomSettings = memo(() => { } try { - localStorage.setItem('customBackground', JSON.stringify(backgrounds.map((bg) => bg.url))); + localStorage.setItem( + 'customBackground', + JSON.stringify(updatedBackgrounds.map((bg) => bg.url)), + ); } catch (_quotaError) { - localStorage.setItem('customBackgroundCount', backgrounds.length.toString()); + localStorage.setItem('customBackgroundCount', updatedBackgrounds.length.toString()); } EventBus.emit('refresh', 'background'); @@ -445,7 +450,9 @@ const CustomSettings = memo(() => { const files = Array.from(e.dataTransfer.files); - if (files.length === 0) return; + if (files.length === 0) { + return; + } if (files.length > 1) { // Multiple files - show tagging modal @@ -476,9 +483,12 @@ const CustomSettings = memo(() => { if (isLoading) { return ( -
-
- {variables.getMessage('modals.main.loading')} +
+
+
+
+ {variables.getMessage('modals.main.loading')} +
); } @@ -664,7 +674,16 @@ const CustomSettings = memo(() => { const isVideo = bg && videoCheck(bg.url); return ( -
+
{ + // Only select if clicking the card itself, not navigation buttons + if (!e.target.closest('.image-nav-buttons')) { + toggleImageSelection(originalIndex); + } + }} + >