Skip to content

Commit 1373e69

Browse files
Merge pull request #980 from Codeinwp/fix/translations
fix: translation string
2 parents c8b4953 + bffe585 commit 1373e69

27 files changed

+486
-151
lines changed

.github/workflows/test-php.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ concurrency:
55
on:
66
push:
77
branches-ignore:
8-
- 'master'
8+
- "master"
99

1010
jobs:
1111
phplint:
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup PHP version
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.4'
18+
php-version: "7.4"
1919
extensions: simplexml
2020
- name: Checkout source code
2121
uses: actions/checkout@v2
@@ -38,7 +38,7 @@ jobs:
3838

3939
phpunit:
4040
name: PHPUnit
41-
runs-on: ubuntu-latest
41+
runs-on: ubuntu-22.04
4242
services:
4343
mysql:
4444
image: mysql:5.7
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup PHP version
5252
uses: shivammathur/setup-php@v2
5353
with:
54-
php-version: '7.4'
54+
php-version: "7.4"
5555
extensions: simplexml, mysql
5656
tools: phpunit-polyfills
5757
- name: Checkout source code

feedzy-rss-feed.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function() {
161161
'location' => 'feedzy-admin-menu',
162162
'has_upgrade_menu' => ! feedzy_is_pro(),
163163
'upgrade_text' => esc_html__( 'Upgrade to Pro', 'feedzy-rss-feeds' ),
164-
'upgrade_link' => tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ),
164+
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ), 'query' ),
165165
);
166166
}
167167
);
@@ -217,8 +217,8 @@ function feedzy_themeisle_log_event( $name, $msg, $type, $file, $line ) {
217217
'primary_color' => '#4268CF',
218218
'pages' => array( 'feedzy_imports', 'edit-feedzy_imports', 'edit-feedzy_categories', 'feedzy_page_feedzy-settings', 'feedzy_page_feedzy-support' ),
219219
'has_upgrade_menu' => ! feedzy_is_pro(),
220-
'upgrade_link' => tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ),
221-
'documentation_link' => tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ),
220+
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ), 'query' ),
221+
'documentation_link' => tsdk_translate_link( tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ), 'query' ),
222222
'wizard_link' => ! feedzy_is_pro() && ! empty( get_option( 'feedzy_fresh_install', false ) ) ? admin_url( 'admin.php?page=feedzy-setup-wizard&tab#step-1' ) : '',
223223
);
224224
}

form/form.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@
3232
$output .= '<div class="container feedzy_' . $item . '">';
3333
$output .= '<h5>' . $section['title'] . '</h5>';
3434
if ( ! feedzy_is_pro() && 'section_feed' === $item ) {
35-
$upsell_url = add_query_arg(
36-
array(
37-
'utm_source' => 'wpadmin',
38-
'utm_medium' => 'classiceditorshortcode',
39-
'utm_campaign' => 'amazonproductadvertising',
40-
'utm_content' => 'feedzy-rss-feeds',
41-
),
42-
FEEDZY_UPSELL_LINK
43-
);
35+
$upsell_url = tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'amazonproductadvertising', 'classiceditorshortcode' ), 'query' );
36+
4437
$output .= '<div class="upgrade-alert">';
45-
$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 ) );
38+
$output .= '<strong>' . __( 'NEW!', 'feedzy-rss-feeds' ) . '</strong>';
39+
$output .= wp_sprintf(
40+
// translators: %1$s: opening anchor tag, %2$s: closing anchor tag
41+
__( 'Enable Amazon Product Advertising feeds to generate affiliate revenue by %1$s upgrading to Feedzy Pro. %2$s', 'feedzy-rss-feeds' ),
42+
'<a target="_blank" href="' . esc_url( $upsell_url ) . '" >',
43+
'</a>'
44+
);
4645
$output .= '</div>';
4746
}
4847
if ( isset( $section['description'] ) ) {

includes/abstract/feedzy-rss-feeds-admin-abstract.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,13 @@ public function feedzy_default_error_notice( $errors, $feed, $feed_url ) {
208208
$final_msg = '';
209209

210210
if ( $show_error ) {
211-
$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>' );
211+
$final_msg = '<div id="message" class="error"><p>' . sprintf(
212+
// translators: %s: Detailed error message.
213+
__( 'Sorry, some part of this feed is currently unavailable or does not exist anymore. The detailed error is %s', 'feedzy-rss-feeds' ),
214+
'<p style="font-weight: bold">' . wp_strip_all_tags( $error_msg ) . '</p>'
215+
);
212216
if ( ! is_admin() ) {
213-
$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>' );
217+
$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>';
214218
}
215219
$final_msg .= '</p></div>';
216220
} else {
@@ -989,7 +993,13 @@ protected function get_valid_source_urls( $feed_url, $cache, $echo = true ) {
989993
$valid_feed_url[] = $url;
990994
} else {
991995
if ( $echo ) {
992-
echo wp_kses_post( sprintf( __( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ), '<b>' . esc_url( $url ) . '</b>' ) );
996+
echo wp_kses_post(
997+
sprintf(
998+
// translators: %s: Feed URL.
999+
__( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ),
1000+
'<b>' . esc_url( $url ) . '</b>'
1001+
)
1002+
);
9931003
}
9941004
}
9951005
}
@@ -1005,7 +1015,13 @@ protected function get_valid_source_urls( $feed_url, $cache, $echo = true ) {
10051015
$valid_feed_url[] = $feed_url;
10061016
} else {
10071017
if ( $echo ) {
1008-
echo wp_kses_post( sprintf( __( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ), '<b>' . esc_url( $feed_url ) . '</b>' ) );
1018+
echo wp_kses_post(
1019+
sprintf(
1020+
// translators: %s: Feed URL.
1021+
__( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ),
1022+
'<b>' . esc_url( $feed_url ) . '</b>'
1023+
)
1024+
);
10091025
}
10101026
}
10111027
}
@@ -1245,7 +1261,11 @@ private function get_dry_run_results( $sc, $item ) {
12451261
if ( ! empty( $item['full_content_error'] ) ) {
12461262
$statuses[] = array(
12471263
'success' => false,
1248-
'msg' => sprintf( __( 'Full content: %s', 'feedzy-rss-feeds' ), $item['full_content_error'] ),
1264+
'msg' => sprintf(
1265+
// translators: %s: Error message for full content extraction.
1266+
__( 'Full content: %s', 'feedzy-rss-feeds' ),
1267+
$item['full_content_error']
1268+
),
12491269
);
12501270
} elseif ( isset( $item['item_full_content'] ) ) {
12511271
if ( ! empty( $item['item_full_content'] ) ) {

includes/admin/feedzy-rss-feeds-admin.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function render_upsell_rn() {
369369
<li>- Translate content</li>
370370
<li>- Elementor Templates support</li>
371371
</ul>';
372-
echo '<a class="button button-primary " href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'metabox', 'new-category' ) . '" target="_blank">View more details</a>';
372+
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>';
373373

374374
}
375375

@@ -389,10 +389,17 @@ public function feedzy_category_feed() {
389389

390390
$output = '
391391
<input type="hidden" name="feedzy_category_meta_noncename" id="feedzy_category_meta_noncename" value="' . $nonce . '" />
392-
<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/>'
392+
<strong>' .
393+
sprintf(
394+
// translators: %1$s and %2$s are placeholders for HTML anchor tags.
395+
__( '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' ),
396+
'<a href="' . esc_url( 'https://simplepie.org/wiki/faq/typical_multifeed_gotchas' ) . '" target="_blank">',
397+
'</a>'
398+
)
399+
. '</strong><br/><br/>'
393400
. $invalid
394401
. '<textarea name="feedzy_category_feed" rows="15" class="widefat" placeholder="' . __( 'Place your URL\'s here followed by a comma.', 'feedzy-rss-feeds' ) . '" >' . $feed . '</textarea>
395-
<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>
402+
<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>
396403
';
397404
echo wp_kses( $output, apply_filters( 'feedzy_wp_kses_allowed_html', array() ) );
398405
}
@@ -540,9 +547,9 @@ public function feedzy_filter_plugin_row_meta( $links, $file ) {
540547
$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>';
541548

542549
if ( ! feedzy_is_pro() ) {
543-
$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>';
550+
$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>';
544551
} elseif ( false === apply_filters( 'feedzy_is_license_of_type', false, 'agency' ) ) {
545-
$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>';
552+
$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>';
546553
}
547554
$links = array_merge( $links, $new_links );
548555
}

includes/admin/feedzy-rss-feeds-import.php

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function upsell_content( $content, $area, $location ) {
102102
<div class="only-pro-container">
103103
<div class="only-pro-inner upgrade-alert">
104104
' . __( 'This feature is available in the Pro version. Unlock more features, by', 'feedzy-rss-feeds' ) . '
105-
<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>
105+
<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>
106106
</div>
107107
</div>
108108
</div>';
@@ -708,7 +708,12 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
708708
$then = new DateTime();
709709
$then = $then->setTimestamp( $last );
710710
$in = $now->diff( $then );
711-
$msg = sprintf( __( 'Ran %1$d hours %2$d minutes ago', 'feedzy-rss-feeds' ), $in->format( '%h' ), $in->format( '%i' ) );
711+
$msg = sprintf(
712+
// translators: %1$d: number of hours, %2$d: number of minutes
713+
__( 'Ran %1$d hours %2$d minutes ago', 'feedzy-rss-feeds' ),
714+
$in->format( '%h' ),
715+
$in->format( '%i' )
716+
);
712717
}
713718

714719
$msg .= $this->get_last_run_details( $post_id );
@@ -726,7 +731,14 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
726731
$then = new DateTime();
727732
$then = $then->setTimestamp( $next );
728733
$in = $now->diff( $then );
729-
echo wp_kses_post( sprintf( __( 'In %1$d hours %2$d minutes', 'feedzy-rss-feeds' ), $in->format( '%h' ), $in->format( '%i' ) ) );
734+
echo wp_kses_post(
735+
sprintf(
736+
// translators: %1$d: number of hours, %2$d: number of minutes
737+
__( 'In %1$d hours %2$d minutes', 'feedzy-rss-feeds' ),
738+
$in->format( '%h' ),
739+
$in->format( '%i' )
740+
)
741+
);
730742
}
731743
break;
732744
default:
@@ -1134,15 +1146,45 @@ private function dry_run() {
11341146
'feedzy_default_error',
11351147
function ( $errors, $feed, $url ) {
11361148
$errors .=
1137-
sprintf( __( 'For %1$ssingle feeds%2$s, this could be because of the following reasons:', 'feedzy-rss-feeds' ), '<b>', '</b>' )
1149+
sprintf(
1150+
// translators: %1$s and %2$s are opening and closing bold tags respectively.
1151+
__( 'For %1$ssingle feeds%2$s, this could be because of the following reasons:', 'feedzy-rss-feeds' ),
1152+
'<b>', '</b>'
1153+
)
11381154
. '<ol>'
1139-
. '<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>'
1140-
. '<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>'
1141-
. '<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>'
1155+
. '<li>'
1156+
. sprintf(
1157+
// translators: %1$s and %2$s are opening and closing bold tags respectively.
1158+
__( '%1$sSource invalid%2$s: Check that your source is valid by clicking the validate button adjacent to the source box.', 'feedzy-rss-feeds' ),
1159+
'<b>', '</b>'
1160+
)
1161+
. '</li>'
1162+
. '<li>'
1163+
. sprintf(
1164+
// translators: %1$s and %2$s are opening and closing bold tags respectively.
1165+
__( '%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>'
1166+
)
1167+
. '</li>'
1168+
. '<li>'
1169+
. sprintf(
1170+
// translators: %1$s and %2$s are opening and closing bold tags respectively.
1171+
__( '%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>'
1172+
)
1173+
. '</li>'
11421174
. '</ol>'
1143-
. 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>' )
1175+
. sprintf(
1176+
// translators: %1$s and %2$s are opening and closing bold tags respectively.
1177+
__( 'For %1$smultiple feeds%2$s (comma-separated or in a Feedzy Category), this could be because of the following reasons:', 'feedzy-rss-feeds' ),
1178+
'<b>', '</b>'
1179+
)
11441180
. '<ol>'
1145-
. '<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>'
1181+
. '<li>'
1182+
. sprintf(
1183+
// translators: %1$s and %2$s are opening and closing bold tags respectively.
1184+
__( '%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' ),
1185+
'<b>', '</b>'
1186+
)
1187+
. '</li>'
11461188
. '</ol>';
11471189

11481190
return $errors;
@@ -1574,7 +1616,11 @@ function ( $attr, $key ) {
15741616
if ( empty( $full_content_error ) ) {
15751617
$full_content_error = __( 'Unknown', 'feedzy-rss-feeds' );
15761618
}
1577-
$import_errors[] = sprintf( __( 'Full content is empty. Error: %s', 'feedzy-rss-feeds' ), $full_content_error );
1619+
$import_errors[] = sprintf(
1620+
// translators: %s: Error message for empty full content.
1621+
__( 'Full content is empty. Error: %s', 'feedzy-rss-feeds' ),
1622+
$full_content_error
1623+
);
15781624
}
15791625

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

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

0 commit comments

Comments
 (0)