Skip to content

Commit

Permalink
Forms: Fix translation issue with % (#41345)
Browse files Browse the repository at this point in the history
  • Loading branch information
edanzer authored Jan 28, 2025
1 parent 8f2c943 commit 51dd460
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Translations: Fix spam % character.
2 changes: 1 addition & 1 deletion projects/packages/forms/src/contact-form/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ public function grunion_add_admin_scripts() {

$button_parameters = array(
/* translators: The placeholder is for showing how much of the process has completed, as a percent. e.g., "Emptying Spam (40%)" */
'progress_label' => __( 'Emptying Spam (%1$s%)', 'jetpack-forms' ),
'progress_label' => __( 'Emptying Spam (%1$s%%)', 'jetpack-forms' ),
'success_url' => $success_url,
'failure_url' => $failure_url,
'spam_count' => $spam_count,
Expand Down
10 changes: 8 additions & 2 deletions projects/packages/forms/src/contact-form/js/grunion-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ jQuery( function ( $ ) {

// Update the label on the "Empty Spam" button to use the active "Emptying Spam" language.
$( '.jetpack-empty-spam' ).text(
$( '.jetpack-empty-spam' ).data( 'progress-label' ).replace( '%1$s', '0' )
$( '.jetpack-empty-spam' )
.data( 'progress-label' )
.replace( '%1$s', '0' )
.replace( '%%', '%' ) // Convert escaped %% into a single %
);

initial_spam_count = parseInt( $( this ).data( 'spam-feedbacks-count' ), 10 );
Expand All @@ -106,7 +109,10 @@ jQuery( function ( $ ) {

// Update the progress counter on the "Check for Spam" button.
empty_spam_buttons.text(
empty_spam_buttons.data( 'progress-label' ).replace( '%1$s', percentage_complete )
empty_spam_buttons
.data( 'progress-label' )
.replace( '%1$s', percentage_complete )
.replace( '%%', '%' ) // Convert escaped %% into a single %
);

$.post( ajaxurl, {
Expand Down

0 comments on commit 51dd460

Please sign in to comment.