From bd7987a32792901c40b53f2e5178d23f89d0dae7 Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Fri, 15 Nov 2024 18:16:06 +0200 Subject: [PATCH] refactor: add more context with sprintf --- includes/abstract/feedzy-rss-feeds-admin-abstract.php | 9 ++++++--- js/FeedzyBlock/Editor.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/includes/abstract/feedzy-rss-feeds-admin-abstract.php b/includes/abstract/feedzy-rss-feeds-admin-abstract.php index e43cdbca..bbba08f9 100644 --- a/includes/abstract/feedzy-rss-feeds-admin-abstract.php +++ b/includes/abstract/feedzy-rss-feeds-admin-abstract.php @@ -1594,18 +1594,21 @@ private function get_feed_item_filter( $sc, $sizes, $item, $feed_url, $index, $i $date_time = apply_filters( 'feedzy_feed_timestamp', $date_time, $feed_url, $item ); if ( $meta_args['date'] && ! empty( $meta_args['date_format'] ) ) { - $content_meta_values['date'] = apply_filters( 'feedzy_meta_date', __( 'on', 'feedzy-rss-feeds' ) . ' ' . date_i18n( $meta_args['date_format'], $date_time ) . ' ', $date_time, $feed_url, $item ); + // translators: %s: the date of the imported content. + $content_meta_values['date'] = apply_filters( 'feedzy_meta_date', sprintf( __( 'on %s', 'feedzy-rss-feeds' ), date_i18n( $meta_args['date_format'], $date_time ) ) . ' ', $date_time, $feed_url, $item ); } if ( $meta_args['time'] && ! empty( $meta_args['time_format'] ) ) { - $content_meta_values['time'] = apply_filters( 'feedzy_meta_time', __( 'at', 'feedzy-rss-feeds' ) . ' ' . date_i18n( $meta_args['time_format'], $date_time ) . ' ', $date_time, $feed_url, $item ); + // translators: %s: the time of the imported content. + $content_meta_values['time'] = apply_filters( 'feedzy_meta_time', sprintf( __( 'at %s', 'feedzy-rss-feeds' ), date_i18n( $meta_args['time_format'], $date_time ) ) . ' ', $date_time, $feed_url, $item ); } // categories. if ( $meta_args['categories'] && has_filter( 'feedzy_retrieve_categories' ) ) { $categories = apply_filters( 'feedzy_retrieve_categories', null, $item ); if ( ! empty( $categories ) ) { - $content_meta_values['categories'] = apply_filters( 'feedzy_meta_categories', __( 'in', 'feedzy-rss-feeds' ) . ' ' . $categories . ' ', $categories, $feed_url, $item ); + // translators: %s: the category of the imported content. + $content_meta_values['categories'] = apply_filters( 'feedzy_meta_categories', sprintf( __( 'in %s', 'feedzy-rss-feeds' ), $categories ) . ' ', $categories, $feed_url, $item ); } } diff --git a/js/FeedzyBlock/Editor.js b/js/FeedzyBlock/Editor.js index 77cc4389..71525cd6 100644 --- a/js/FeedzyBlock/Editor.js +++ b/js/FeedzyBlock/Editor.js @@ -490,9 +490,12 @@ class Editor extends Component { let meta_values = new Object(); meta_values['author'] = __( 'by', 'feedzy-rss-feeds' ) + ' ' + author; - meta_values['date'] = __( 'on', 'feedzy-rss-feeds' ) + ' ' + unescapeHTML( itemDate ); - meta_values['time'] = __( 'at', 'feedzy-rss-feeds' ) + ' ' + unescapeHTML( itemTime ); - meta_values['categories'] = __( 'in', 'feedzy-rss-feeds' ) + ' ' + unescapeHTML( categories ); + // translators: %s: the date of the imported content. + meta_values['date'] = sprintf( __( 'on %s', 'feedzy-rss-feeds' ), unescapeHTML( itemDate ) ); + // translators: %s: the time of the imported content. + meta_values['time'] = sprintf( __( 'at %s', 'feedzy-rss-feeds' ), unescapeHTML( itemTime ) ); + // translators: %s: the category of the imported content. + meta_values['categories'] = sprintf( __( 'in %s', 'feedzy-rss-feeds' ), unescapeHTML( categories ) ); return (