Skip to content

Commit

Permalink
refactor: add more context with sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Nov 18, 2024
1 parent 064769d commit bd7987a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions includes/abstract/feedzy-rss-feeds-admin-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}

Expand Down
9 changes: 6 additions & 3 deletions js/FeedzyBlock/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<li key={i} style={ { padding: '15px 0 25px' } } className={ `rss_item feedzy-rss-col-${ this.props.attributes.columns }` }>
Expand Down

0 comments on commit bd7987a

Please sign in to comment.