Skip to content

Implement missing textdomain argument sniff #1020

@ernilambar

Description

@ernilambar

The WordPress.WP.I18n.MissingArgDomain sniff currently flags when a translation function is missing the text domain argument. However, its current severity level means it might not receive appropriate attention from plugin developers.

Background

  • When the domain argument is missing in WordPress translation functions, the function will default to using core translations
  • This behavior works technically but is discouraged in plugin or theme
  • In 99.9% of cases, this occurs because plugin authors are unaware they need to specify their text domain, not because they intentionally want to use core translations

Proposal

Increase the severity level of this sniff from its current level to 7 (as a blocker in PCP).

Suggested improvement provided from Plugins Team meeting

Compare plugin strings with a map of WordPress core strings to reduce false positives when checking for missing text domains.

For example:

echo esc_html__( 'Submit' ): // WARNING: This string exists in WP core.
echo esc_html__( 'Example plugin specific string' ): // ERROR: This string is not in core.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Team] PluginsIssues owned by Plugins Team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions