Conversation
📝 WalkthroughWalkthroughUpdated UI text labels and error messages to reflect broader media type support beyond images. Conditional logic now distinguishes between image media (displaying "thumbnail(s) processed") and non-image media (displaying "file(s) processed"). Renamed error reason constant for consistency. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (3 warnings, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🤖 Pull request artifacts
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/admin/class-meta-box.php (1)
209-215: Translator string extraction & image-only emoji.Two minor concerns:
- Embedding
esc_html__()calls inside a ternary as thesprintfformat argument works at runtime but can confuse some gettext scanners/translator context. Safer pattern:♻️ Proposed refactor
-echo '🏞️ ' . sprintf( - /* translators: %s: bulk optimization count */ - $is_image_media - ? esc_html__( '%s thumbnail(s) processed', 'cimo-image-optimizer' ) - : esc_html__( '%s file(s) processed', 'cimo-image-optimizer' ), - '<span class="cimo-value">' . esc_html( $bulk_optimization_count ) . '</span>' -); +/* translators: %s: bulk optimization count */ +$bulk_label = $is_image_media + ? esc_html__( '%s thumbnail(s) processed', 'cimo-image-optimizer' ) + : esc_html__( '%s file(s) processed', 'cimo-image-optimizer' ); +$icon = $is_image_media ? '🏞️' : '📦'; +echo $icon . ' ' . sprintf( + $bulk_label, + '<span class="cimo-value">' . esc_html( $bulk_optimization_count ) . '</span>' +);
- The 🏞️ emoji is image-themed; for video/audio it reads oddly alongside "file(s) processed".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/admin/class-meta-box.php` around lines 209 - 215, Extract the translatable format string out of the ternary and store it in a variable (e.g., $format) by assigning $format = $is_image_media ? esc_html__( '%s thumbnail(s) processed', 'cimo-image-optimizer' ) : esc_html__( '%s file(s) processed', 'cimo-image-optimizer' ); then call echo with sprintf( $format, '<span class="cimo-value">' . esc_html( $bulk_optimization_count ) . '</span>' ); also avoid the image-specific 🏞️ emoji for non-image media—either use a neutral icon (e.g., 📁) or conditionally prepend the emoji based on $is_image_media so video/audio lines aren’t mislabeled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/admin/js/media-manager/sidebar-info.js`:
- Line 189: Replace the hardcoded 🏞️ emoji and literal strings with a neutral
or media-aware icon and proper i18n calls: use the existing isImageMedia boolean
to choose an emoji (e.g., '🏞️' for images, '🎞️' for video, '🎵' for audio or a
neutral '📦' when unknown) and wrap the label text in the translation helper
(use the same JS i18n function pattern used elsewhere) instead of the raw
`'thumbnail(s) processed'` / `'file(s) processed'`; update the template
expression that references customMetadata.bulk_optimization and escape(...) so
it outputs the chosen icon and translated label while preserving the existing
escape(...) usage and semantics.
---
Nitpick comments:
In `@src/admin/class-meta-box.php`:
- Around line 209-215: Extract the translatable format string out of the ternary
and store it in a variable (e.g., $format) by assigning $format =
$is_image_media ? esc_html__( '%s thumbnail(s) processed',
'cimo-image-optimizer' ) : esc_html__( '%s file(s) processed',
'cimo-image-optimizer' ); then call echo with sprintf( $format, '<span
class="cimo-value">' . esc_html( $bulk_optimization_count ) . '</span>' ); also
avoid the image-specific 🏞️ emoji for non-image media—either use a neutral icon
(e.g., 📁) or conditionally prepend the emoji based on $is_image_media so
video/audio lines aren’t mislabeled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 856ef830-aa05-4e4c-af56-dcba53d8bee2
📒 Files selected for processing (3)
src/admin/class-meta-box.phpsrc/admin/js/media-manager/sidebar-info.jssrc/shared/converters/image-converter.js
| html += ` | ||
| <li class="cimo-bulk-optimization-number"> | ||
| 🏞️ <span class="cimo-value">${ escape( Object.keys( customMetadata.bulk_optimization ).length.toString() ) }</span> thumbnail(s) processed | ||
| 🏞️ <span class="cimo-value">${ escape( Object.keys( customMetadata.bulk_optimization ).length.toString() ) }</span> ${ escape( isImageMedia ? 'thumbnail(s) processed' : 'file(s) processed' ) } |
There was a problem hiding this comment.
Emoji still image-specific for non-image media.
The 🏞️ (landscape) emoji prefix remains for video/audio too, which visually contradicts the new "file(s) processed" label. Consider a neutral icon (e.g., 📦 or 🎞️/🎵 by media type) when !isImageMedia.
Also note: the literal strings 'thumbnail(s) processed' and 'file(s) processed' bypass __() i18n (unlike the PHP counterpart which uses esc_html__). Pre-existing pattern nearby, but worth aligning for translators.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/admin/js/media-manager/sidebar-info.js` at line 189, Replace the
hardcoded 🏞️ emoji and literal strings with a neutral or media-aware icon and
proper i18n calls: use the existing isImageMedia boolean to choose an emoji
(e.g., '🏞️' for images, '🎞️' for video, '🎵' for audio or a neutral '📦' when
unknown) and wrap the label text in the translation helper (use the same JS i18n
function pattern used elsewhere) instead of the raw `'thumbnail(s) processed'` /
`'file(s) processed'`; update the template expression that references
customMetadata.bulk_optimization and escape(...) so it outputs the chosen icon
and translated label while preserving the existing escape(...) usage and
semantics.
fixes #37
Summary by CodeRabbit