Skip to content

Commit

Permalink
fix: translation string
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Sep 27, 2024
1 parent c8b4953 commit 47a73dd
Show file tree
Hide file tree
Showing 21 changed files with 443 additions and 122 deletions.
23 changes: 13 additions & 10 deletions form/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,20 @@
$output .= '<div class="container feedzy_' . $item . '">';
$output .= '<h5>' . $section['title'] . '</h5>';
if ( ! feedzy_is_pro() && 'section_feed' === $item ) {
$upsell_url = add_query_arg(
array(
'utm_source' => 'wpadmin',
'utm_medium' => 'classiceditorshortcode',
'utm_campaign' => 'amazonproductadvertising',
'utm_content' => 'feedzy-rss-feeds',
),
FEEDZY_UPSELL_LINK
);
$upsell_url = tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'amazonproductadvertising', 'classiceditorshortcode' ), 'query' );
$output .= '<div class="upgrade-alert">';
$output .= wp_sprintf( __( '<strong>NEW! </strong>Enable Amazon Product Advertising feeds to generate affiliate revenue by <a href="%s" target="_blank">upgrading to Feedzy Pro.</a>', 'feedzy-rss-feeds' ), esc_url_raw( $upsell_url ) );

$upsell_msg = '<strong>';
$upsell_msg .= __( 'NEW!', 'feedzy-rss-feeds' );
$upsell_msg .= '</strong>';
$upsell_msg .= wp_sprintf(
// translators: %1$s: opening anchor tag, %2$s: closing anchor tag
__( 'Enable Amazon Product Advertising feeds to generate affiliate revenue by %1$s upgrading to Feedzy Pro %2$s .', 'feedzy-rss-feeds' ),
'<a target="_blank" href="' . esc_url( $upsell_url ) . '" >',
'</a>'
);

$output .= $upsell_msg;
$output .= '</div>';
}
if ( isset( $section['description'] ) ) {
Expand Down
30 changes: 25 additions & 5 deletions includes/abstract/feedzy-rss-feeds-admin-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,13 @@ public function feedzy_default_error_notice( $errors, $feed, $feed_url ) {
$final_msg = '';

if ( $show_error ) {
$final_msg = '<div id="message" class="error"><p>' . sprintf( __( 'Sorry, some part of this feed is currently unavailable or does not exist anymore. The detailed error is %s', 'feedzy-rss-feeds' ), '<p style="font-weight: bold">' . wp_strip_all_tags( $error_msg ) . '</p>' );
$final_msg = '<div id="message" class="error"><p>' . sprintf(
// translators: %s: Detailed error message.
__( 'Sorry, some part of this feed is currently unavailable or does not exist anymore. The detailed error is %s', 'feedzy-rss-feeds' ),
'<p style="font-weight: bold">' . wp_strip_all_tags( $error_msg ) . '</p>'
);
if ( ! is_admin() ) {
$final_msg .= sprintf( __( '%1$s(Only you are seeing this detailed error because you are the creator of this post. Other users will see the error message as below.)%2$s', 'feedzy-rss-feeds' ), '<small>', '</small>' );
$final_msg .= '<small>(' . __( 'Only you are seeing this detailed error because you are the creator of this post. Other users will see the error message as below.', 'feedzy-rss-feeds' ) . ')</small>';
}
$final_msg .= '</p></div>';
} else {
Expand Down Expand Up @@ -989,7 +993,13 @@ protected function get_valid_source_urls( $feed_url, $cache, $echo = true ) {
$valid_feed_url[] = $url;
} else {
if ( $echo ) {
echo wp_kses_post( sprintf( __( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ), '<b>' . esc_url( $url ) . '</b>' ) );
echo wp_kses_post(
sprintf(
// translators: %s: Feed URL.
__( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ),
'<b>' . esc_url( $url ) . '</b>'
)
);
}
}
}
Expand All @@ -1005,7 +1015,13 @@ protected function get_valid_source_urls( $feed_url, $cache, $echo = true ) {
$valid_feed_url[] = $feed_url;
} else {
if ( $echo ) {
echo wp_kses_post( sprintf( __( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ), '<b>' . esc_url( $feed_url ) . '</b>' ) );
echo wp_kses_post(
sprintf(
// translators: %s: Feed URL.
__( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ),
'<b>' . esc_url( $feed_url ) . '</b>'
)
);
}
}
}
Expand Down Expand Up @@ -1245,7 +1261,11 @@ private function get_dry_run_results( $sc, $item ) {
if ( ! empty( $item['full_content_error'] ) ) {
$statuses[] = array(
'success' => false,
'msg' => sprintf( __( 'Full content: %s', 'feedzy-rss-feeds' ), $item['full_content_error'] ),
'msg' => sprintf(
// translators: %s: Error message for full content extraction.
__( 'Full content: %s', 'feedzy-rss-feeds' ),
$item['full_content_error']
),
);
} elseif ( isset( $item['item_full_content'] ) ) {
if ( ! empty( $item['item_full_content'] ) ) {
Expand Down
11 changes: 9 additions & 2 deletions includes/admin/feedzy-rss-feeds-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,17 @@ public function feedzy_category_feed() {

$output = '
<input type="hidden" name="feedzy_category_meta_noncename" id="feedzy_category_meta_noncename" value="' . $nonce . '" />
<strong>' . sprintf( __( 'Please be aware that multiple feeds, when mashed together, may sometimes not work as expected as explained %1$shere%2$s.', 'feedzy-rss-feeds' ), '<a href="http://simplepie.org/wiki/faq/typical_multifeed_gotchas" target="_blank">', '</a>' ) . '</strong><br/><br/>'
<strong>' .
sprintf(
// translators: %1$s and %2$s are placeholders for HTML anchor tags.
__( 'Please be aware that multiple feeds, when mashed together, may sometimes not work as expected as explained %1$s here %2$s.', 'feedzy-rss-feeds' ),
'<a href="' . esc_url( 'https://simplepie.org/wiki/faq/typical_multifeed_gotchas' ) . '" target="_blank">',
'</a>'
)
. '</strong><br/><br/>'
. $invalid
. '<textarea name="feedzy_category_feed" rows="15" class="widefat" placeholder="' . __( 'Place your URL\'s here followed by a comma.', 'feedzy-rss-feeds' ) . '" >' . $feed . '</textarea>
<p><a href="https://docs.themeisle.com/article/1119-feedzy-rss-feeds-documentation#categories" target="_blank">' . __( 'Learn how to organize feeds in Categories', 'feedzy-rss-feeds' ) . '</a></p>
<p><a href="' . esc_url( 'https://docs.themeisle.com/article/1119-feedzy-rss-feeds-documentation#categories' ) . '" target="_blank">' . __( 'Learn how to organize feeds in Categories', 'feedzy-rss-feeds' ) . '</a></p>
';
echo wp_kses( $output, apply_filters( 'feedzy_wp_kses_allowed_html', array() ) );
}
Expand Down
71 changes: 61 additions & 10 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,12 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
$then = new DateTime();
$then = $then->setTimestamp( $last );
$in = $now->diff( $then );
$msg = sprintf( __( 'Ran %1$d hours %2$d minutes ago', 'feedzy-rss-feeds' ), $in->format( '%h' ), $in->format( '%i' ) );
$msg = sprintf(
// translators: %1$d: number of hours, %2$d: number of minutes
__( 'Ran %1$d hours %2$d minutes ago', 'feedzy-rss-feeds' ),
$in->format( '%h' ),
$in->format( '%i' )
);
}

$msg .= $this->get_last_run_details( $post_id );
Expand All @@ -726,7 +731,14 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
$then = new DateTime();
$then = $then->setTimestamp( $next );
$in = $now->diff( $then );
echo wp_kses_post( sprintf( __( 'In %1$d hours %2$d minutes', 'feedzy-rss-feeds' ), $in->format( '%h' ), $in->format( '%i' ) ) );
echo wp_kses_post(
sprintf(
// translators: %1$d: number of hours, %2$d: number of minutes
__( 'In %1$d hours %2$d minutes', 'feedzy-rss-feeds' ),
$in->format( '%h' ),
$in->format( '%i' )
)
);
}
break;
default:
Expand Down Expand Up @@ -1134,15 +1146,45 @@ private function dry_run() {
'feedzy_default_error',
function ( $errors, $feed, $url ) {
$errors .=
sprintf( __( 'For %1$ssingle feeds%2$s, this could be because of the following reasons:', 'feedzy-rss-feeds' ), '<b>', '</b>' )
sprintf(
// translators: %1$s and %2$s are opening and closing bold tags respectively.
__( 'For %1$ssingle feeds%2$s, this could be because of the following reasons:', 'feedzy-rss-feeds' ),
'<b>', '</b>'
)
. '<ol>'
. '<li>' . sprintf( __( '%1$sSource invalid%2$s: Check that your source is valid by clicking the validate button adjacent to the source box.', 'feedzy-rss-feeds' ), '<b>', '</b>' ) . '</li>'
. '<li>' . sprintf( __( '%1$sSource unavailable%2$s: Copy the source and paste it on the browser to check that it is available. It could be an intermittent issue.', 'feedzy-rss-feeds' ), '<b>', '</b>' ) . '</li>'
. '<li>' . sprintf( __( '%1$sSource inaccessible from server%2$s: Check that your source is accessible from the server (not the browser). It could be an intermittent issue.', 'feedzy-rss-feeds' ), '<b>', '</b>' ) . '</li>'
. '<li>'
. sprintf(
// translators: %1$s and %2$s are opening and closing bold tags respectively.
__( '%1$sSource invalid%2$s: Check that your source is valid by clicking the validate button adjacent to the source box.', 'feedzy-rss-feeds' ),
'<b>', '</b>'
)
. '</li>'
. '<li>'
. sprintf(
// translators: %1$s and %2$s are opening and closing bold tags respectively.
__( '%1$sSource unavailable%2$s: Copy the source and paste it on the browser to check that it is available. It could be an intermittent issue.', 'feedzy-rss-feeds' ), '<b>', '</b>'
)
. '</li>'
. '<li>'
. sprintf(
// translators: %1$s and %2$s are opening and closing bold tags respectively.
__( '%1$sSource inaccessible from server%2$s: Check that your source is accessible from the server (not the browser). It could be an intermittent issue.', 'feedzy-rss-feeds' ), '<b>', '</b>'
)
. '</li>'
. '</ol>'
. sprintf( __( 'For %1$smultiple feeds%2$s (comma-separated or in a Feedzy Category), this could be because of the following reasons:', 'feedzy-rss-feeds' ), '<b>', '</b>' )
. sprintf(
// translators: %1$s and %2$s are opening and closing bold tags respectively.
__( 'For %1$smultiple feeds%2$s (comma-separated or in a Feedzy Category), this could be because of the following reasons:', 'feedzy-rss-feeds' ),
'<b>', '</b>'
)
. '<ol>'
. '<li>' . sprintf( __( '%1$sSource invalid%2$s: One or more feeds may be misbehaving. Check each feed individually as mentioned above to weed out the problematic feed.', 'feedzy-rss-feeds' ), '<b>', '</b>' ) . '</li>'
. '<li>'
. sprintf(
// translators: %1$s and %2$s are opening and closing bold tags respectively.
__( '%1$sSource invalid%2$s: One or more feeds may be misbehaving. Check each feed individually as mentioned above to weed out the problematic feed.', 'feedzy-rss-feeds' ),
'<b>', '</b>'
)
. '</li>'
. '</ol>';

return $errors;
Expand Down Expand Up @@ -1574,7 +1616,11 @@ function ( $attr, $key ) {
if ( empty( $full_content_error ) ) {
$full_content_error = __( 'Unknown', 'feedzy-rss-feeds' );
}
$import_errors[] = sprintf( __( 'Full content is empty. Error: %s', 'feedzy-rss-feeds' ), $full_content_error );
$import_errors[] = sprintf(
// translators: %s: Error message for empty full content.
__( 'Full content is empty. Error: %s', 'feedzy-rss-feeds' ),
$full_content_error
);
}

$post_content = str_replace(
Expand Down Expand Up @@ -1923,7 +1969,12 @@ function( $term ) {
update_post_meta( $job->ID, 'imported_items_count', $count );

if ( $import_image_errors > 0 ) {
$import_errors[] = sprintf( __( 'Unable to find an image for %1$d out of %2$d items imported', 'feedzy-rss-feeds' ), $import_image_errors, $count );
$import_errors[] = sprintf(
// translators: %1$d is the number of items without images, %2$d is the total number of items imported.
__( 'Unable to find an image for %1$d out of %2$d items imported', 'feedzy-rss-feeds' ),
$import_image_errors,
$count
);
}
update_post_meta( $job->ID, 'import_errors', $import_errors );

Expand Down
50 changes: 43 additions & 7 deletions includes/admin/feedzy-rss-feeds-ui-lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,39 @@ public static function get_form_defaults() {
* @return array|mixed|void
*/
public static function get_form_elements() {
$meta = sprintf( __( 'Should we display additional meta fields out of %1$sauthor%2$s, %3$sdate%4$s and %5$stime%6$s? (comma-separated list, in order of display). View documentation %7$shere%8$s.', 'feedzy-rss-feeds' ), '<code>', '</code>', '<code>', '</code>', '<code>', '</code>', '<a href="https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed" target="_new">', '</a>' );
$meta = sprintf(
// translators: 1: <code> tag for author, 2: closing </code> tag, 3: <code> tag for date, 4: closing </code> tag, 5: <code> tag for time, 6: closing </code> tag, 7: <a> tag for documentation link, 8: closing </a> tag
__( 'Should we display additional meta fields out of %1$s author %2$s, %3$s date %4$s and %5$s time %6$s? (comma-separated list, in order of display). View documentation %7$s here %8$s.', 'feedzy-rss-feeds' ),
'<code>', '</code>', '<code>', '</code>', '<code>', '</code>', '<a href="' . esc_url( 'https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed' ) . '" target="_new">', '</a>'
);
if ( has_filter( 'feedzy_retrieve_categories' ) ) {
$meta = sprintf( __( 'Should we display additional meta fields out of %1$sauthor%2$s, %3$sdate%4$s, %5$stime%6$s and %7$scategories%8$s? (comma-separated list). View documentation %9$shere%10$s.', 'feedzy-rss-feeds' ), '<code>', '</code>', '<code>', '</code>', '<code>', '</code>', '<code>', '</code>', '<a href="https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed" target="_new">', '</a>' );
$meta = sprintf(
// translators: 1: <code> tag for author, 2: closing </code> tag, 3: <code> tag for date, 4: closing </code> tag, 5: <code> tag for time, 6: closing </code> tag, 7: <code> tag for categories, 8: closing </code> tag, 9: <a> tag for documentation link, 10: closing </a> tag
__( 'Should we display additional meta fields out of %1$s author%2$s, %3$s date%4$s, %5$s time %6$s and %7$s categories %8$s? (comma-separated list). View documentation %9$s here %10$s.', 'feedzy-rss-feeds' ),
'<code>', '</code>', '<code>', '</code>', '<code>', '</code>', '<code>', '</code>', '<a href="' . esc_url( 'https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed' ) . '" target="_new">', '</a>'
);
}

$multiple = sprintf( __( 'When using multiple sources, should we display additional meta fields? %1$ssource%2$s (feed title).', 'feedzy-rss-feeds' ), '<code>', '</code>', '<a href="https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed" target="_new">', '</a>' );
$multiple = sprintf(
// translators: 1: <code> tag for source, 2: closing </code> tag
__( 'When using multiple sources, should we display additional meta fields? %1$s source %2$s (feed title).', 'feedzy-rss-feeds' ),
'<code>', '</code>'
);

$elements = array(
'section_feed' => array(
'title' => __( 'Feed Source', 'feedzy-rss-feeds' ),
'elements' => array(
'feeds' => array(
'label' => __( 'The feed(s) URL (comma-separated list).', 'feedzy-rss-feeds' ) . ' ' . sprintf( __( 'Click %1$shere%2$s to check if feed is valid.', 'feedzy-rss-feeds' ), '<a href="https://validator.w3.org/feed/" target="_new">', '</a>' ) . '<br><b>' . __( 'Invalid feeds will NOT display items.', 'feedzy-rss-feeds' ) . '</b>',
'label' => (
__( 'The feed(s) URL (comma-separated list).', 'feedzy-rss-feeds' ) . ' ' .
sprintf(
// translators: 1: <a> tag opening, 2: </a> tag closing
__( 'Click %1$s here %2$s to check if feed is valid.', 'feedzy-rss-feeds' ),
'<a href="' . esc_url( 'https://validator.w3.org/feed/' ) . '" target="_new">', '</a>'
)
. '<br><b>' . __( 'Invalid feeds will NOT display items.', 'feedzy-rss-feeds' ) . '</b>'
),
'placeholder' => __( 'Feed URL', 'feedzy-rss-feeds' ),
'type' => 'text',
'value' => '',
Expand Down Expand Up @@ -437,7 +457,13 @@ public static function get_form_elements() {
'description' => __( 'Get access to more options and customizations with full version of Feedzy RSS Feeds . Use existing templates or extend them and make them your own.', 'feedzy-rss-feeds' ) . '<br/>' . '<a href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'sectionpro' ) . '" target="_blank"><small>' . __( 'See more features of Feedzy RSS Feeds PRO', 'feedzy-rss-feeds' ) . '</small></a>',
'elements' => array(
'price' => array(
'label' => sprintf( __( 'Should we display the price from the feed if it is available? <br/> You can read about how to extract price from a custom tag %1$shere%2$s', 'feedzy-rss-feeds' ), '<a href="https://docs.themeisle.com/article/977-how-do-i-extract-values-from-custom-tags-in-feedzy" target="_blank">', '</a>' ),
'label' => sprintf(
// translators: 1: <br/> tag, 2: <a> tag opening, 3: </a> tag closing
__( 'Should we display the price from the feed if it is available? %1$s You can read about how to extract price from a custom tag %2$s here %3$s', 'feedzy-rss-feeds' ),
'<br/>',
'<a href="' . esc_url( 'https://docs.themeisle.com/article/977-how-do-i-extract-values-from-custom-tags-in-feedzy' ) . '" target="_blank">',
'</a>'
),
'type' => 'select',
'disabled' => true,
'value' => '',
Expand All @@ -453,7 +479,12 @@ public static function get_form_elements() {
),
),
'referral_url' => array(
'label' => sprintf( __( 'Referral URL parameters as per %1$sthis document here%2$s', 'feedzy-rss-feeds' ), '<a href="https://docs.themeisle.com/article/1073-how-to-add-referral-parameters-in-feedzy" target="_blank">', '</a>' ),
'label' => sprintf(
// translators: 1: <a> tag opening, 2: </a> tag closing
__( 'Referral URL parameters as per %1$s this document here %2$s', 'feedzy-rss-feeds' ),
'<a href="' . esc_url( 'https://docs.themeisle.com/article/1073-how-to-add-referral-parameters-in-feedzy' ) . '" target="_blank">',
'</a>'
),
'placeholder' => '',
'type' => 'text',
'disabled' => true,
Expand All @@ -467,7 +498,12 @@ public static function get_form_elements() {
'value' => '1',
),
'mapping' => array(
'label' => sprintf( __( 'Provide mapping for custom feed elements as per %1$sthis document here%2$s. This will only work for single feeds, not comma-separated feeds.', 'feedzy-rss-feeds' ), '<a href="https://docs.themeisle.com/article/977-how-do-i-extract-values-from-custom-tags-in-feedzy" target="_blank">', '</a>' ),
'label' => sprintf(
// translators: 1: <a> tag opening, 2: </a> tag closing
__( 'Provide mapping for custom feed elements as per %1$s this document here %2$s. This will only work for single feeds, not comma-separated feeds.', 'feedzy-rss-feeds' ),
'<a href="' . esc_url( 'https://docs.themeisle.com/article/977-how-do-i-extract-values-from-custom-tags-in-feedzy' ) . '" target="_blank">',
'</a>'
),
'type' => 'text',
'disabled' => true,
'value' => '',
Expand Down
8 changes: 7 additions & 1 deletion includes/admin/feedzy-rss-feeds-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ public function feedzy_import_post_title_section() {
<?php if ( ! feedzy_is_pro() ) : ?>
<div class="upgrade-alert mb-24">
<?php
echo wp_kses_post( wp_sprintf( __( 'You\'re using Feedzy Lite. Unlock more powerful features, by <a href="%s" target="_blank">upgrading to Feedzy Pro</a>', 'feedzy-rss-feeds' ), tsdk_utmify( FEEDZY_UPSELL_LINK, 'post_title', 'import-screen' ) ) );
$upgrade_url = tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'post_title', 'import-screen' ), 'query' );

$content = __( 'You are using Feedzy Lite.', 'feedzy-rss-feeds' ) . ' ';
// translators: %1$s and %2$s are opening and closing anchor tags respectively.
$content .= wp_sprintf( __( 'Unlock more powerful features, by %1$s upgrading to Feedzy Pro %2$s', 'feedzy-rss-feeds' ), '<a href="' . esc_url( $upgrade_url ) . '" target="_blank">', '</a>' );

echo wp_kses_post( $content );
?>
<button type="button" class="remove-alert"><span class="dashicons dashicons-no-alt"></span></button>
</div>
Expand Down
Loading

0 comments on commit 47a73dd

Please sign in to comment.