Skip to content

Conversation

@masteradhoc
Copy link
Contributor

Fixes #757

What?

This PR intends to fix the MissingTranslatorsComment & MissingSingularPlaceholder Errors shown by the Plugin Check Plugin

Why?

This PR is necessary to resolve WordPress Coding Standards (PHPCS) i18n errors related to translatable strings with placeholders.

How?

The PR addresses these issues by:

  • Adding appropriate /* translators: ... */ comments immediately above all affected translation function calls that include placeholders, clarifying their meaning for translators.
  • Updating the singular form of an _n() call to include the same placeholders as the plural form, ensuring placeholder parity as required by WordPress i18n guidelines.

Testing Instructions

  1. Install Plugin Check Plugin
  2. Choose Two Factor, Categories = "General" and Types = "Error" & "Warning"
  3. see results
  4. apply fix
  5. see results

Screenshots or screencast

Changelog Entry

Fixed - Resolved WordPress i18n coding standards errors by adding missing translator comments and correcting placeholder usage in translatable strings.

@github-actions
Copy link

github-actions bot commented Jan 30, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: masteradhoc <masteradhoc@git.wordpress.org>
Co-authored-by: kasparsd <kasparsd@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Collaborator

@kasparsd kasparsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update the associated test case?

Noting that we also have #437 for general PHPCS cleanup.

/* translators: 1: number of failed login attempts, 2: time since last failed attempt */
_n(
'WARNING: Your account has attempted to login without providing a valid two factor token. The last failed login occurred %2$s ago. If this wasn\'t you, you should reset your password.',
'WARNING: Your account has attempted to login %1$s time without providing a valid two factor token. The last failed login occurred %2$s ago. If this wasn\'t you, you should reset your password.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this requires updating the associated phpunit test case:

  1. Test_ClassTwoFactorCore::test_maybe_show_last_login_failure_notice
    Failed asserting that '
    WARNING: Your account has attempted to login 1 time without providing a valid two factor token. The last failed login occurred 5 seconds ago. If this wasn't you, you should reset your password.
    ' contains "login without providing a valid two factor token".

/var/www/html/wp-content/plugins/two-factor/tests/class-two-factor-core.php:630

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasparsd thanks for the hint!

@kasparsd kasparsd merged commit 665e050 into WordPress:master Feb 1, 2026
26 checks passed
@masteradhoc masteradhoc deleted the patch-2 branch February 1, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin Check: MissingTranslatorsComment & MissingSingularPlaceholder

2 participants