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.
This commit is contained in:
alexsparkes
2026-01-26 16:28:13 +00:00
parent cac58cdaeb
commit 9677434c00
37 changed files with 809 additions and 141 deletions

View File

@@ -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,

View File

@@ -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 (
<div className="loaderHolder">
<div id="loader"></div>
<span className="subtitle">{variables.getMessage('modals.main.loading')}</span>
<div className="photosEmpty">
<div className="emptyNewMessage"></div>
<div className="loaderHolder">
<div id="loader"></div>
<span className="subtitle">{variables.getMessage('modals.main.loading')}</span>
</div>
</div>
);
}
@@ -664,7 +674,16 @@ const CustomSettings = memo(() => {
const isVideo = bg && videoCheck(bg.url);
return (
<div key={originalIndex} className="image-card">
<div
key={originalIndex}
className="image-card"
onClick={(e) => {
// Only select if clicking the card itself, not navigation buttons
if (!e.target.closest('.image-nav-buttons')) {
toggleImageSelection(originalIndex);
}
}}
>
<div className="image-checkbox">
<input
type="checkbox"