Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forms: Fix translation issue with % #41345

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1315,7 +1315,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
Loading