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 Oct 9, 2024
1 parent c8b4953 commit 319f524
Show file tree
Hide file tree
Showing 28 changed files with 487 additions and 152 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ concurrency:
on:
push:
branches-ignore:
- 'master'
- "master"

jobs:
phplint:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: "7.4"
extensions: simplexml
- name: Checkout source code
uses: actions/checkout@v2
Expand All @@ -38,7 +38,7 @@ jobs:

phpunit:
name: PHPUnit
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
services:
mysql:
image: mysql:5.7
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: "7.4"
extensions: simplexml, mysql
tools: phpunit-polyfills
- name: Checkout source code
Expand Down
6 changes: 3 additions & 3 deletions feedzy-rss-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function() {
'location' => 'feedzy-admin-menu',
'has_upgrade_menu' => ! feedzy_is_pro(),
'upgrade_text' => esc_html__( 'Upgrade to Pro', 'feedzy-rss-feeds' ),
'upgrade_link' => tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ),
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ), 'query' ),
);
}
);
Expand Down Expand Up @@ -217,8 +217,8 @@ function feedzy_themeisle_log_event( $name, $msg, $type, $file, $line ) {
'primary_color' => '#4268CF',
'pages' => array( 'feedzy_imports', 'edit-feedzy_imports', 'edit-feedzy_categories', 'feedzy_page_feedzy-settings', 'feedzy_page_feedzy-support' ),
'has_upgrade_menu' => ! feedzy_is_pro(),
'upgrade_link' => tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ),
'documentation_link' => tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ),
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ), 'query' ),
'documentation_link' => tsdk_translate_link( tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ), 'query' ),
'wizard_link' => ! feedzy_is_pro() && ! empty( get_option( 'feedzy_fresh_install', false ) ) ? admin_url( 'admin.php?page=feedzy-setup-wizard&tab#step-1' ) : '',
);
}
Expand Down
19 changes: 9 additions & 10 deletions form/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@
$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 ) );
$output .= '<strong>' . __( 'NEW!', 'feedzy-rss-feeds' ) . '</strong>';
$output .= 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 .= '</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
17 changes: 12 additions & 5 deletions includes/admin/feedzy-rss-feeds-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function render_upsell_rn() {
<li>- Translate content</li>
<li>- Elementor Templates support</li>
</ul>';
echo '<a class="button button-primary " href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'metabox', 'new-category' ) . '" target="_blank">View more details</a>';
echo '<a class="button button-primary " href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'metabox', 'new-category' ), 'query' ) ) . '" target="_blank">View more details</a>';

}

Expand All @@ -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 Expand Up @@ -540,9 +547,9 @@ public function feedzy_filter_plugin_row_meta( $links, $file ) {
$new_links['doc'] = '<a href="https://docs.themeisle.com/article/658-feedzy-rss-feeds" target="_blank" title="' . __( 'Documentation and examples', 'feedzy-rss-feeds' ) . '">' . __( 'Documentation and examples', 'feedzy-rss-feeds' ) . '</a>';

if ( ! feedzy_is_pro() ) {
$new_links['more_features'] = '<a href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmeta', 'plugins' ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade to Pro', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
$new_links['more_features'] = '<a href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmeta', 'plugins' ), 'query' ) ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade to Pro', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
} elseif ( false === apply_filters( 'feedzy_is_license_of_type', false, 'agency' ) ) {
$new_links['more_features'] = '<a href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmetamore', 'plugins' ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade your license', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
$new_links['more_features'] = '<a href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmetamore', 'plugins' ), 'query' ) ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade your license', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
}
$links = array_merge( $links, $new_links );
}
Expand Down
73 changes: 62 additions & 11 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function upsell_content( $content, $area, $location ) {
<div class="only-pro-container">
<div class="only-pro-inner upgrade-alert">
' . __( 'This feature is available in the Pro version. Unlock more features, by', 'feedzy-rss-feeds' ) . '
<a target="_blank" href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, $area, $location ) . '" title="' . __( 'Buy Now', 'feedzy-rss-feeds' ) . '">' . __( 'upgrading to Feedzy Pro', 'feedzy-rss-feeds' ) . '</a>
<a target="_blank" href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, $area, $location ), 'query' ) ) . '" title="' . __( 'Buy Now', 'feedzy-rss-feeds' ) . '">' . __( 'upgrading to Feedzy Pro', 'feedzy-rss-feeds' ) . '</a>
</div>
</div>
</div>';
Expand Down 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
Loading

0 comments on commit 319f524

Please sign in to comment.